Skip to content

Conversation

@boukenka
Copy link

@boukenka boukenka commented Nov 16, 2025

Proposal to intercept exceptions when disposing components.
Adding checks for null and try/catch in Dispose methods and during Rendering.
Below is an exception example to be handled.

[ERR] Unhandled exception in circuit 'dQIPK23O_RFuJINsK-Aq9BIEWyzyITdAq6VK6OW-ZSc'.
Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. 
This is because the circuit has disconnected and is being disposed.
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken 
cancellationToken, Object[] args)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Blazor.Diagrams.Extensions.JSRuntimeExtensions.UnobserveResizes(IJSRuntime jsRuntime, ElementReference element)
at Blazor.Diagrams.Components.DiagramCanvas.DisposeAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.<>c__DisplayClass93_0.
<<Dispose>g__HandleAsyncExceptions|0>d.MoveNext()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant