QuickGrid throws InvokeAsync exception when RefreshDataAsync() is called #58794
Labels
area-blazor
Includes: Blazor, Razor Components
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
Milestone
Is there an existing issue for this?
Describe the bug
Hi there,
as the title already states,
QuickGrid
possibly throws anInvokeAsync
exception whenRefreshDataAsync()
is invoked from a callback associated with a background service, like a timer.This is caused by a call to
StateHasChanged()
withinRefreshDataAsync()
without wrapping it inInvokeAsync
as described in https://learn.microsoft.com/en-us/aspnet/core/blazor/components/synchronization-context?view=aspnetcore-8.0#invoke-component-methods-externally-to-update-state.My current solution is to catch the exception and call
StateHasChanged()
withInvokeAsync
otherwise rethrow:Expected Behavior
It would be nice to have
await InvokeAsync(StateHasChanged)
calls inQuickGrid
to avoid the need to usetry catches
here and there.Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: