Blazored / Video

The easiest html5 video implementation for Blazor applications
https://blazored.github.io/Video
MIT License
124 stars 28 forks source link

[Bug] Exceptions being logged during dispose #34

Open BritBlaster opened 5 months ago

BritBlaster commented 5 months ago

Describe the bug I am noticing a lot of exceptions being recorded in the log when (automatic) disposing is being called on BlazoredVideo component. Not sure if this is me using the component incorrectly. I think the exception is harmless, but it would be nice to suppress it in the log.

To Reproduce I am not sure what steps specifically are necessary and under what conditions the log messages are being recorded. Will update this issue if I get more info.

Expected behavior Log messages suppressed if not indicative of an actual problem.

Screenshots Example log entry: "@mt":"Unhandled exception rendering component: {Message}","@l":"Warning","@x":"Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.\r\n at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)\r\n at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args)\r\n at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)\r\n at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)\r\n at Microsoft.JSInterop.Implementation.JSObjectReference.DisposeAsync()\r\n at Blazored.Video.BlazoredVideo.DisposeAsyncCore()\r\n at Blazored.Video.BlazoredVideo.System.IAsyncDisposable.DisposeAsync()\r\n at Microsoft.AspNetCore.Components.RenderTree.Renderer.<>c__DisplayClass74_0.<g__HandleAsyncExceptions|1>d.MoveNext()","Message":"JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.","EventId":{"Id":100,"Name":"ExceptionRenderingComponent"},"SourceContext":"Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer","RequestId":"0HN2308GEOR03:00000041","RequestPath":"/_blazor/disconnect","ConnectionId":"0HN2308GEOR03","ClientIp":"::1"}

Hosting Model (is this issue happening with a certain hosting model?):

Additional context Add any other context about the problem here.

BritBlaster commented 5 months ago

Created a pull request with changes to resolve issue. See https://stackoverflow.com/questions/72488563/blazor-server-side-application-throwing-system-invalidoperationexception-javas for an example of what causes the JSDisconnectedException in Blazor server apps with SignalR.

PR: #35