Invalid Operation Exception during closing dialog

Hello,

I get the following Issue, wenn I am trying to confirm or close a Dialog from a page:

image

System.InvalidOperationException
HResult=0x80131509
Nachricht = JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.
Quelle = Microsoft.AspNetCore.Components.Server
Stapelüberwachung:
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId) in //src/Components/Server/src/Circuits/RemoteJSRuntime.cs:line 78
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) in /
/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs:line 132
at Microsoft.JSInterop.JSRuntime.d__151.MoveNext() in /_/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs:line 91 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 173 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150 at System.Threading.Tasks.ValueTask1.get_Result() in //src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ValueTask.cs:line 789
at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult() in /
/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ValueTaskAwaiter.cs:line 126
at Microsoft.JSInterop.JSRuntimeExtensions.d__0.MoveNext() in //src/JSInterop/Microsoft.JSInterop/src/JSRuntimeExtensions.cs:line 29
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /
/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 56
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in //src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 173
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /
/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs:line 150
at System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ValueTaskAwaiter.cs:line 44
at BlazorDownloadFile.BlazorDownloadFileService.<<-ctor>b__4_0>d.MoveNext()

Diese Ausnahme wurde ursprünglich von dieser Aufrufliste ausgelöst:
Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(long, string, string, Microsoft.JSInterop.JSCallResultType, long) in RemoteJSRuntime.cs
Microsoft.JSInterop.JSRuntime.InvokeAsync(long, string, System.Threading.CancellationToken, object[]) in JSRuntime.cs
Microsoft.JSInterop.JSRuntime.InvokeAsync(long, string, object[]) in JSRuntime.cs
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in ExceptionDispatchInfo.cs
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) in TaskAwaiter.cs
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) in TaskAwaiter.cs
System.Threading.Tasks.ValueTask.Result.get() in ValueTask.cs
System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult() in ValueTaskAwaiter.cs
Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(Microsoft.JSInterop.IJSRuntime, string, object[]) in JSRuntimeExtensions.cs
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in ExceptionDispatchInfo.cs
...
[Aufrufliste abgeschnitten]

Any Hints how to solve will be appreciated
Regards
Gilles

Hi @Gilles_Sawa,

Is there any Radzen code in that stacktrace as I don't see it. In any case wrapping the code a try/catch block is the only known workaround to us.