Closed
Description
The Blazor Server client is configured to disconnect the circuit when the user navigates away from a page.
Previously, this disconnect happened on the browser's unload
event, but this event isn't dispatched in all scenarios. it was changed to beforeunload
but that was dispatched on too many scenarios.
We need to figure out a reliable event to listen to that strikes a balance between:
- Being dispatched reliably on all browsers
- Not being dispatched in false positive scenarios (e.g. triggering a download)
Previous issue description
The ClosingTheBrowserWindow_GracefullyDisconnects_WhenNavigatingAwayFromThePage test fails.Output:
Assert.Contains() Failure\r\nNot found: (Debug, CircuitTerminatedGracefully)\r\nIn value: List<ValueTuple<LogLevel, String>> [(Debug, CircuitDisconnectStarted), (Debug, CircuitNotActive), (Information, ExecutedEndpoint), (Information, RequestFinished)]
at Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests.CircuitGracefulTerminationTests.ClosingTheBrowserWindow_GracefullyDisconnects_WhenNavigatingAwayFromThePage() in /_/src/Components/test/E2ETest/ServerExecutionTests/CircuitGracefulTerminationTests.cs:line 87
--- End of stack trace from previous location ---