Skip to content

Commit 4c4b72d

Browse files
Ensure that fileApiHelperTask is also disposed.
1 parent b881c8d commit 4c4b72d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/KristofferStrube.Blazor.FileAPI/FileReader.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,16 @@ public async Task InvokeOnLoadEndAsync(IJSObjectReference jsProgressEvent)
276276

277277
await OnLoadEnd.Invoke(new ProgressEvent(JSRuntime, jsProgressEvent, new() { DisposesJSReference = true }));
278278
}
279+
280+
/// <inheritdoc/>
281+
public new async ValueTask DisposeAsync()
282+
{
283+
if (fileApiHelperTask.IsValueCreated)
284+
{
285+
IJSObjectReference module = await helperTask.Value;
286+
await module.DisposeAsync();
287+
}
288+
await base.DisposeAsync();
289+
GC.SuppressFinalize(this);
290+
}
279291
}

0 commit comments

Comments
 (0)