Skip to content

Blazor throws JSException message 'Interop methods are already registered for renderer 1' in unobserved task #64738

@RikvanSpreuwel

Description

@RikvanSpreuwel

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We have a server side rendered blazor app, which we just updated to .net 10. After updating, we sometimes get the exception from the taskScheduler where we subscribe on UnobservedTaskExceptions (see section 'Exceptions').

Expected Behavior

No exception, we would like to know what causes this exception to occur.
Is it normal that it occurs and should we ignore it, or is there a clean way to prevent it?

Steps To Reproduce

Difficult and inconsistently, but it seems to happen mostly when the browser on a mobile phone disconnects or tries to reconnect.

Exceptions (if any)

Microsoft.JSInterop.JSException with result 0x80131500 with message 'Interop methods are already registered for renderer 1
Error: Interop methods are already registered for renderer 1
at Object.E [as attachWebRendererInterop] (http://IP:Port/_framework/blazor.server.js:1:14639)
at w.processJSCall (http://IP:Port/_framework/blazor.server.js:1:4442)
at w.beginInvokeJSFromDotNet (http://IP:Port/_framework/blazor.server.js:1:4119)
at Vt._invokeClientMethod (http://IP:Port/_framework/blazor.server.js:1:66680)
at Vt._processIncomingData (http://IP:Port/_framework/blazor.server.js:1:64039)
at Vt.connection.onreceive (http://IP:Port/_framework/blazor.server.js:1:57680)
at i.onmessage (http://IP:Port/_framework/blazor.server.js:1:81773)'%27) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +17
in module System.Private.CoreLib.dll version 10.0.0-rtm.25523.111+b0f34d51fccc69fd334253924abd8d6853fad7aa
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task, System.Threading.Tasks.ConfigureAwaitOptions options) +45
in module System.Private.CoreLib.dll version 10.0.0-rtm.25523.111+b0f34d51fccc69fd334253924abd8d6853fad7aa
at Microsoft.JSInterop.JSRuntime+d__23`1.MoveNext() +0
in module Microsoft.JSInterop.dll version 10.0.0+b0f34d51fccc69fd334253924abd8d6853fad7aa
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +17
in module System.Private.CoreLib.dll version 10.0.0-rtm.25523.111+b0f34d51fccc69fd334253924abd8d6853fad7aa
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task, System.Threading.Tasks.ConfigureAwaitOptions options) +45
in module System.Private.CoreLib.dll version 10.0.0-rtm.25523.111+b0f34d51fccc69fd334253924abd8d6853fad7aa
at Microsoft.JSInterop.JSRuntimeExtensions+d__0.MoveNext() +127
in module Microsoft.JSInterop.dll version 10.0.0+b0f34d51fccc69fd334253924abd8d6853fad7aa

.NET Version

10.0.101

Anything else?

Our current workaround is to catch this exception in a global handler and ignore the exception. This only requires the user to refresh the page (which works), and doesn't crash our entire application. However, we would prefer a better solution if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions