Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

[Bug] Crashes after upgrading to .NET 10: System.ObjectDisposedException: Cannot access a disposed object. #606

@Schoof-T

Description

@Schoof-T

Describe the bug
After upgrading to .NET 10, sometimes we get the following error:

Error: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Microsoft.JSInterop.Implementation.JSObjectReference'.   
 at :44366/Microsoft.JSInterop.Implementation.JSObjectReference.InvokeAsync[TValue](String identifier, Object[] args)   
 at :44366/Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args)    
at :44366/Blazored.Modal.BlazoredModal.ClearBodyStyles()    
at :44366/Blazored.Modal.BlazoredModal.CancelModals(Object sender, LocationChangedEventArgs e)    
at :44366/System.Threading.Tasks.Task.<>c.<ThrowAsync>b__124_0(Object state)   
 at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.PostAsync[TState](:44366/Task antecedent, Action`1 callback, TState state)

To Reproduce
Steps to reproduce the behavior:

  1. Create new Blazor Interactive Server application
  2. Add Blazored modal
  3. Create a few pages and inject the service
  4. Launch the application and navigate between the pages

Expected behavior
No crash should be happening

Screenshots
Image

Hosting Model (is this issue happening with a certain hosting model?):

  • Blazor Server

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingTriageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions