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

See original GitHub issue

In a Blazor Server app, starting with version 3.1.0, we are seeing the exception below in our logs. It seems to occur when a user navigates from a page that includes a map. Is there something that needs done in the component to properly dispose?

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.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)
   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 GoogleMapsComponents.Helper.MyInvokeAsync[TRes](IJSRuntime jsRuntime, String identifier, Object[] args)
   at GoogleMapsComponents.JsObjectRef.InvokeAsync(String functionName, Object[] args)
   at GoogleMapsComponents.Maps.MapEventListener.RemoveAsync()
   at GoogleMapsComponents.Maps.MapEventListener.DisposeAsyncCore()
   at GoogleMapsComponents.Maps.MapEventListener.DisposeAsync()
   at GoogleMapsComponents.Maps.Extension.EventEntityBase.DisposeAsyncCore()
   at GoogleMapsComponents.Maps.Map.DisposeAsyncCore()
   at GoogleMapsComponents.Maps.Map.DisposeAsync()
   at GoogleMapsComponents.MapComponent.DisposeAsyncCore()
   at GoogleMapsComponents.MapComponent.DisposeAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.<>c__DisplayClass74_0.<<Dispose>g__HandleAsyncExceptions|1>d.MoveNext()

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
turner11commented, Jul 19, 2023

I think it is reasonable enough to do so. Since:

  1. dotnet framework and dotnet core has converged into “dotnet” since version 5.0
  2. The above happend a long time ago.
  3. This aligns with MS announcment

The downsides I can think of are:

  1. legcay user components that relays on this project and targets dotnet standard - I think this project is not popular enough (yet!) for this to be a real consideration.

I have never released a resuable component to Nuget - so take the following with a grain of salt: I think that as a reusable component auther you should target the lowest version that is “modern” and feature rich enogh for you. This will allow your users to use this component, without constraining them to a new version that they might not have migrated to yet. I think in your case this would be .net5.0, possiblly .net6.0.

Also, take a look this section in the linked article. It is very relevnt to this topic.

1reaction
turner11commented, Jul 19, 2023

Was able to reproduce. Fixed in this PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript interop calls cannot be issued at this time. .. ...
JavaScript (JS) interop calls can't be issued after a SignalR circuit is disconnected. Without a circuit during component disposal or at any ...
Read more >
JavaScript interop calls cannot be issued at this time. ...
JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed #48220.
Read more >
Identifying what is causing interop errors : r/Blazor
JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is ...
Read more >
JavaScript interop calls cannot be issued at this time when ...
I work on blazor web app with .net core 7 . I get error when try to pass user name from login page...
Read more >
NET 6 RC1 Telerik Blazor
JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found