EdCharbeneau / BlazorSize

Blazor browser size interop for matchMedia and browser window size at runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.

EdCharbeneau opened this issue Β· comments

@Mike-E-angelo
Greetings,

This component is working really well for me, thank you again for taking the time to develop it. I do appear to be getting some intermittent exceptions, however, and was hoping to track them down.

Additionally, I have also seen this one as well:

Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.
   at void Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(long asyncHandle, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
   at ValueTask<TValue> Microsoft.JSInterop.JSRuntime.InvokeAsync<TValue>(long targetInstanceId, string identifier, CancellationToken cancellationToken, object[] args)
   at async ValueTask<TValue> Microsoft.JSInterop.JSRuntime.InvokeAsync<TValue>(long targetInstanceId, string identifier, object[] args)
   at async ValueTask Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, string identifier, params object[] args)
   at async Task BlazorPro.BlazorSize.MediaQueryService.RemoveQuery(MediaQuery mediaQuery)
   at async Task BlazorPro.BlazorSize.MediaQueryList.RemoveQuery(MediaQuery mediaQuery)
   at async ValueTask BlazorPro.BlazorSize.MediaQuery.DisposeAsync()
   at async void Microsoft.AspNetCore.Components.RenderTree.Renderer.Dispose(bool disposing)+HandleAsyncExceptions(?)
No worries if they cannot be addressed. I wanted to report them and see if there is a best practice I am overlooking and/or if this is something that can indeed be addressed on your side.

Thank you for any consideration/assistance you can provide.

commented

Thank you very much for this @EdCharbeneau. I appreciate all the effort out there, and your patience in figuring out the remaining issue here. πŸ‘πŸ™

Uploading release 6.2.1 to NuGet now. Please reopen if the issue persists.
https://www.nuget.org/packages/BlazorPro.BlazorSize/6.2.1

commented

Wow! QUICK... thank you for attending to this so quickly @EdCharbeneau! It is greatly appreciated. πŸ™

commented

This issue still occurs with 6.2.1.

You added the try-catch in the dispose method of the class, but not in the RemoveQuery method which is called when the MediaQuery is disposed, which is were this error is occuring.

commented

This issue still occurs with 6.2.1.

I can confirm and have opened #93 to track. It's a different error but the same principle that is being encountered. :D

@Mike-E-angelo @jnsn Please try 6.2.2 and reopen any related issues if the problem persists.

Yay, I finally got a chance to try this out and I do not see any errors! Thank you very much for your diligent efforts @EdCharbeneau πŸ‘πŸ™