aspnetcore: Blazor JS Interop Takes 1 min to throw exception

Describe the bug

I am doing a simple JSInterop call to display a document in a new browser tab. The document is displayed but the await hangs for one minute and then delivers an exception. If you run the same code using Firefox as your browser no exception occurs.

To Reproduce

This repository shows the issue. Build & run then select “button ‘Press me#1’”. Wait one minute to see the exception.

https://github.com/OptimiumHealth/BlazorJSInteropApp

Exceptions (if any)

System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Obj… is observed in the blazor app

Uncaught (in promise) TypeError: Converting circular structure to JSON –> starting at object with constructor ‘Window’ — property ‘window’ closes the circle at JSON.stringify (<anonymous>) at D (blazor.server.js:1) at blazor.server.js:1

is observed in the chrome developer console

Further technical details

  • ASP.NET Core version:
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version:
  • Include the output of dotnet --info:
C:\Solutions\TemporarySolutions\BlazorJSInteropApp>dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  3.1.415 [C:\Program Files\dotnet\sdk]
  5.0.302 [C:\Program Files\dotnet\sdk]
  6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

C:\Solutions\TemporarySolutions\BlazorJSInteropApp>

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I really don’t believe this should be closed. Still not explained is why it takes a full minute for the exception to occur.