aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Blazor Server page crashing after reconnect with multiple clients

Open heckradr opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

I created a component that is able to reload the whole page when blazor server gets disconnected (for example after a server restart). In this case the automatic reconnect mechanism does not work and normally the user has to reload the page manually.

The control is able to detect this case and will perform a reload of the page with a JS call.

With only 1 connected client (browser window) this works perfectly. If I start multiple clients / browser windows sometimes the page crashes with the typical blazor error bar.

Error output

The following error is logged in the console:

Error: The list of component operations is not valid.

image

Expected Behavior

The page should be reloaded on all clients, without any error message (no matter how many clients are connected at the same time).

Steps To Reproduce

I created a demo project here: https://github.com/heckradr/BlazorReconnectTest

  • compile and start the project
  • point at least two browsers to the url http://localhost:5006
  • when the page is loaded on all clients -> re-start the debugger
  • you will notice the ReconnectModal: First it will try to restore the connection but this fails (Connection failed, Reconnecting...). Then after a sleep time of 5 seconds the javascript call will reload the whole page.
  • when the error occurs, one of the 2 pages will stop working with the typical blazor error bar
  • the error does not occur on every attempt, maybe you have to repeat the steps

Exceptions (if any)

No response

.NET Version

8.0.100 / 8.0.200-preview.23624.5

Anything else?

The problem occurs on a system with .NET 8.0.100 and also with .NET 8.0.200-preview.23624.5.

Here is the output of "dotnet --info":

.NET SDK: Version: 8.0.200-preview.23624.5 Commit: 8065b9770c Workload version: 8.0.200-manifests.66f5ce51

Laufzeitumgebung: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.200-preview.23624.5\

Installierte .NET-Workloads: Workload version: 8.0.200-manifests.66f5ce51 Es sind keine installierten Workloads zum Anzeigen vorhanden.

Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71

.NET SDKs installed: 8.0.200-preview.23624.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not foud

heckradr avatar Jan 31 '24 11:01 heckradr

Can confirm this bug is still an issue

garrettlondon1 avatar Mar 16 '24 18:03 garrettlondon1

This should have been addressed in the latest 8.0.3 release, which was shipped a few weeks ago. Can someone please confirm that 8.0.3 actually fixed this issue?

mkArtakMSFT avatar Mar 25 '24 23:03 mkArtakMSFT

Hi @heckradr. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

First I thought the error still exists, but the latest VS preview (17.10.0. preview 2) didn't get 8.0.3 yet. With a regular VS installation (with 8.0.3) the error does not occur any more.

Thank you :-)

heckradr avatar Mar 26 '24 09:03 heckradr

@mkArtakMSFT was it fixed also in 9.0?

karelz avatar Apr 02 '24 20:04 karelz

For others finding this issue: I was still seeing this error in 8.0.7 (8.0.303 SDK) but it's possibly related to #54002

supertr0n avatar Aug 14 '24 12:08 supertr0n