We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7724407 commit 3570efeCopy full SHA for 3570efe
src/Blazor.BroadcastChannel/BroadcastChannelService.cs
@@ -46,10 +46,17 @@ public async Task AddMessageEventListener(BroadcastChannel channel)
46
47
public async ValueTask DisposeAsync()
48
{
49
- if (_moduleTask.IsValueCreated)
+ try
50
51
- IJSObjectReference module = await _moduleTask.Value;
52
- await module.DisposeAsync();
+ if (_moduleTask.IsValueCreated)
+ {
53
+ IJSObjectReference module = await _moduleTask.Value;
54
+ await module.DisposeAsync();
55
+ }
56
57
+ catch (JSDisconnectedException)
58
59
+ // When disposing the module, the JS runtime may be disconnected.
60
}
61
62
0 commit comments