Skip to content

blazor headcontent throws exception #54842

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:Other]
Head content throws exceptions when using global interactive server mode.

Repro:

  1. Create a new blazor server app project.

  2. For "Interactive Render Mode", select "Server".

  3. For "Interactivity Location", select "Global".

  4. Add a HeadContent component to the "Home.razor" page. Inside that component, and any valid HTML (doesn't have to be a blazor component).

  5. Run the application.

  6. From the "Home Page", navigate to the "Counter" page.

  7. Click on the browsers "Back" button (using Edge in this case) or click the sidebar nav link for Counter that also has a meta tag

  8. Default blazor error message appears.

Here is the error message from the Output or Immediate Window

Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: 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)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'XwKDhTBqDdbOIORvnq38ZTsq1zlmyisXYpb55dTgcUg'.

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 ---

Wait for the Microsoft Developer Community Bot to tell us that this is closed, not enough info or this is expected with no further explanation.


Original Comments

Feedback Bot on 3/28/2024, 00:45 AM:

(private comment, text removed)


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Author: Migration Bot 🤖The issue was created by a issue mover bot. The author may not be the actual author.ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions