Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/Core/Components/InputFile/FluentInputFile.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class FluentInputFile : FluentComponentBase, IAsyncDisposable
private ElementReference? _containerElement;
private InputFile? _inputFile;
private IJSObjectReference? _containerInstance;

public static string ResourceLoadingBefore = "Loading...";
public static string ResourceLoadingCompleted = "Completed";
public static string ResourceLoadingCanceled = "Canceled";
Expand Down Expand Up @@ -427,15 +427,24 @@ private async Task UpdateProgressAsync(int percent, string title)
// Unregister the drop zone events
public async ValueTask DisposeAsync()
{
if (_containerInstance != null)
try
{
await _containerInstance.InvokeVoidAsync("dispose");
await _containerInstance.DisposeAsync();
}
if (_containerInstance is not null)
{
await _containerInstance.InvokeVoidAsync("dispose");
await _containerInstance.DisposeAsync().ConfigureAwait(false);
}

if (Module != null)
if (Module != null)
{
await Module.DisposeAsync().ConfigureAwait(false);
}
}
catch (Exception ex) when (ex is JSDisconnectedException ||
ex is OperationCanceledException)
{
await Module.DisposeAsync();
// The JSRuntime side may routinely be gone already if the reason we're disposing is that
// the client disconnected. This is not an error.
}
}
}
Loading