Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
.net 9.0 has improved a lot, but the reconnect logic still doesn't work when restoring from PC sleep mode. It would be great if only this part could be fixed.
When a Blazor Server app is open in a desktop browser and the PC goes to sleep, the SignalR connection terminates as expected. However, after the system wakes from sleep, the Blazor client does not properly recover the connection.
The UI is still visible, and user input (e.g., clicking buttons, filling out forms) is unresponsive to any client-side actions.
This results in a "zombie UI" where the user thinks they are still connected, but the server session is already gone.
Expected Behavior
Upon waking from sleep mode, Blazor Server should attempt to reconnect via SignalR and either:
- Successfully restore the session (ideal), or
- Display the built-in "Disconnected" overlay with a reconnect button, or
- Trigger a lifecycle event (e.g.,
OnConnectionDown
) so the app can handle it manually.
Steps To Reproduce
- Open the Blazor Server app in Chrome or Edge on your Windows PC.
- Your PC is set to sleep mode. Wait for about 20 minutes without doing anything. Ex) Lunch time
- Then press the mouse or keyboard on your PC to wake it from sleep mode.
- Interact with the page (ex. click a button that triggers a server event).
- Verify that nothing happens. The connection is dropped, but there is no error indication in the UI.
Exceptions (if any)
- The issue is consistent across Windows 10 and Windows 11.
- Occurs in Chrome, Edge, and Firefox (latest versions).
- Mobile devices do not exhibit this issue — they either refresh the session or trigger reconnection properly.
This is the only part of the Blazor Server experience that still breaks immersion and can lead to serious data loss or confusion for end users.
.NET Version
9.0
Anything else?
If the PC wakes up within a short period of time (less than a minute), the reconnect process works as expected.
However, if the PC is in sleep mode for a long period of time (e.g. lunch break), the reconnect timeout has already expired and the client becomes a zombie and no longer attempts to reconnect.
This shows that the current reconnect logic is time-based and not related to lifecycle events like sleep/resume.
It would be nice if we could reset or retry the reconnect logic when returning from sleep.