Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.1.0 Throwing JSDisconnectedException after browser closed, left then reopened #1680

Open
digitalVPO opened this issue Nov 14, 2021 · 1 comment

Comments

@digitalVPO
Copy link

Tried this with .net6.0 official release version and working very well generally however, if you display a SWAL dialog, then close your browser window with your web application still running and wait for approximately 2 minutes and try and use the same SWAL dialog a JSDisconnectedException is thrown when calling SWAl.FireAsync.

I am only using JS interop functionality in OnAfterRenderAsync as recommended by MS

Microsoft.JSInterop.JSDisconnectedException
HResult=0x80131500
Message=JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.
Source=Microsoft.AspNetCore.Components.Server
StackTrace:
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.d__161.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask1.get_Result()
at CurrieTechnologies.Razor.SweetAlert2.SweetAlertService.d__18.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ----- .Application.Shared.NavMenu.<>c__DisplayClass27_0.<b__0>d.MoveNext() in ---
This exception was originally thrown at this call stack:
[External Code]

Expected behavior
The IJSRuntime is injected without issue

Fails with multiple browsers.

Visual Studio 2022 net6.0 both released official versions

@digitalVPO
Copy link
Author

This is a server side blazor app

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

No branches or pull requests

1 participant