Blazor exception thrown when visiting a non-existent url and then trying to interact with page when RenderMode="Server"
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Exception is thrown after navigating to a non-existent page and then clicking on a nav link that’s part of the main layout when the RenderMode
is set to Server
. Doesn’t occur when the RenderMode
is set to ServerPreferred
.
Brower output:
blazor.server.js:1 [2022-02-08T06:59:11.892Z] Error: There was an error applying batch 6. log @ blazor.server.js:1 processBatch @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 _invokeClientMethod @ blazor.server.js:1 _processIncomingData @ blazor.server.js:1 Tt.connection.onreceive @ blazor.server.js:1 o.onmessage @ blazor.server.js:1 blazor.server.js:1 [2022-02-08T06:59:11.931Z] Error: System.AggregateException: One or more errors occurred. (TypeError: Cannot read properties of null (reading ‘insertBefore’)) —> System.InvalidOperationException: TypeError: Cannot read properties of null (reading ‘insertBefore’) at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents) — End of inner exception stack trace —
Expected Behavior
Should navigate without throwing any exceptions.
Steps To Reproduce
- Create a new Blazor Server App (VS 2022 Preview)
- Change _Host.cshtml render mode to
<component type="typeof(App)" render-mode="Server" />
- Goto a non-existent link and see “Sorry, there’s nothing at this address.” message.
- Click on a nav link in the menu on the left
- Exception thrown
Exceptions (if any)
Error: System.AggregateException: One or more errors occurred. (TypeError: Cannot read properties of null (reading ‘insertBefore’)) —> System.InvalidOperationException: TypeError: Cannot read properties of null (reading ‘insertBefore’) at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
.NET Version
6.0.101
Anything else?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
Turns out it was an extension I had for Chrome specifically that was mutating page title. Once I removed it, the issue stopped occurring.
It looks like this affects Chrome but not Firefox/Edge. I haven’t tested with other browsers.