-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Description
π Description
In a Blazor Server app, when a modal component is closed (via @if
) and an EventCallback
adds an item to a list bound to a QuickGrid, the server crashes with a NullReferenceException
in SignalR.
This causes:
- The entire app to freeze
- The SignalR circuit to die silently
- No exception being caught by any
ErrorBoundary
π§ͺ Repro steps
- A parent component displays a
QuickGrid
bound to a list:List<InvoiceDetailsModel>
- A modal component is shown via
@if (IsModalVisible)
- On form submit inside the modal, an
EventCallback
adds an item to the list and sets IsModalVisible = false - This causes Blazor to:
- Dispose the modal component
- Re-render the
QuickGrid
- At this point, SignalR crashes with a NullReferenceException
π£ What actually happens
RemoteJSRuntime.EndInvokeDotNet(...)
throwsNullReferenceException
- The app freezes completely
- No exception bubbles up
- Reproducible 100% of the time
β What has been tried (and failed)
Attempted Fix | Outcome |
---|---|
Using @key to force modal recreation | β No effect |
Implementing IDisposable and detaching event handlers | β Called, no leak β but still crashes |
Wrapping EventCallback in InvokeAsync() or Task.Yield() | β Still crashes |
Resetting bound model before disposal (Detail = new()) | β Still crashes |
Toggling visibility (Visible=true/false) instead of @if | β Same behavior |
Delaying updates to parent via Task.Delay() | β Still crashes |
Removing QuickGrid temporarily | β Prevents crash β likely trigger is grid rerender |
π Stack trace
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.EndInvokeDotNet(DotNetInvocationInfo invocationInfo, DotNetInvocationResult& invocationResult)
at Microsoft.AspNetCore.SignalR.ClientProxyExtensions.SendCoreAsync(...) // decompiled source
π§° Environment
- .NET 8.0.x
- Blazor Server
- Microsoft.AspNetCore.SignalR.Core (latest)
- Microsoft.AspNetCore.Components.QuickGrid (stable)
π Request
- Can this be addressed in QuickGrid's rendering logic or the frameworkβs circuit lifecycle?
- At minimum, can the runtime guard against this crash instead of throwing from SendCoreAsync()?
- Should there be documentation or pattern warnings around updating QuickGrid during component disposal?
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.