Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5.1.0 Throwing JSDisconnectedException after browser closed, left then reopened

digitalVPO opened this issue · comments

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

This is a server side blazor app