question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor exception thrown when visiting a non-existent url and then trying to interact with page when RenderMode="Server"

See original GitHub issue

Is 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

  1. Create a new Blazor Server App (VS 2022 Preview)
  2. Change _Host.cshtml render mode to <component type="typeof(App)" render-mode="Server" />
  3. Goto a non-existent link and see “Sorry, there’s nothing at this address.” message.
  4. Click on a nav link in the menu on the left
  5. 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?

image

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vflamecommented, Jan 5, 2023

Turns out it was an extension I had for Chrome specifically that was mutating page title. Once I removed it, the issue stopped occurring.

0reactions
vflamecommented, Jan 4, 2023

It looks like this affects Chrome but not Firefox/Edge. I haven’t tested with other browsers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >
c# - Blazor: NullReferenceException in _Host.cshtml when ...
When creating a new object with the EditForm it seems like the (at)bind doesn't like the 'non-existing' classes. Because the form seems to...
Read more >
Unhandled Exceptions in Blazor Server with Error ...
When an unhandled exception occurs, Blazor Server treats it as a fatal error because the circuit hangs in an undefined state, which can ......
Read more >
Error Handling in Blazor Server .NET 7
T This technique involves intercepting HttpClient requests to catch any exceptions thrown by the API and log them appropriately. Visit API Interaction tutorial ......
Read more >
Configuring a custom error page in a Razor Pages web site
When a visitor tries to request a page on your site that doesn't exist, or an unhandled exception occurs while executing server-side code ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found