ObjectDisposedException when updating sheet
We get this error at random, when clicking around the page or when the sheet reference is updated.
This is how the sheet is rendered:
@if (sheet != null)
{
<div style="overflow:scroll;" id="mil_sheet_container">
<BlazorDatasheet.Datasheet @ref=_control Sheet="sheet" CustomCellTypeDefinitions="_customTypes" IsReadOnly="false" FrozenLeftCount="3" FrozenRightCount="0" OverscanColumns="100" Icons="SheetIcons"
MenuOptions="MenuOptions">
<ColumnHeaderTemplate>
<div style="background-color:@(context.Index >= gridCols.Length ? "unset" : GlobalConstColors.ColumnColors[gridCols[context.Index].Type]);">
@context.Heading
</div>
</ColumnHeaderTemplate>
<MenuItems>
<GridContextMenu ParentView="this"></GridContextMenu>
</MenuItems>
</BlazorDatasheet.Datasheet>
</div>
}
The sheet is null at the beginning of the Page lifetime. When the user loads data, the sheet is initialized like this:
sheet = new Sheet(Math.Min(_vm.PageSize, _vm.LoadedProducts.Count), gridCols.Length);
and the rows rendered, pretty basic stuff.
Every subsequent data retrieval instantiates a new sheet and assigns it to the sheet variable referenced by the Datasheet component.
Could you please look into the cause of this? Thank you.
As a workaround, I wrapped the Component in an ErrorBoundary:
<Microsoft.AspNetCore.Components.Web.ErrorBoundary>
<ChildContent>
//sheet here
</ChildContent>
<ErrorContent>
@{
new Task(async () => await _vm.SavePageData().ConfigureAwait(false)).RunSynchronously();
navigationManager.Refresh(true);
}
</ErrorContent>
</Microsoft.AspNetCore.Components.Web.ErrorBoundary>
But obviously, this is trash. May be useful to someone who stumbles upon this issue.
Hi @jbartula can you please try and update to the latest version available (0.6) and see if you still get the same error?
Hi @jbartula have you had a chance to look at this again?