-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot access a disposed object #119
Comments
The According to the stack trace, the issue is not related to the first editor instance but the new one. Looks like the new editor is already disposed when it's rendered. This sounds like a reuse of the disposed first editor instance. If you're not disposing anything manually, this may be related to Blazor's object instance management and how Blazor reuses the instances between renders. I would suggest checking the similar values you use between the first and the second editor instance to see if Blazor may think that they're actually the same instance and reuse the first instance. |
I got the same issue on a .NET 8 Blazor Web App. Just make sure the code editor does not get rendered in the prerender phase. |
Hello - i have the same Problem. -> Just make sure the code editor does not get rendered in the prerender phase. How I'm gonna do that ? THank you |
You can do it in two ways:
@if (rendered)
{
<StandaloneCodeEditor />
}
@code
{
private bool rendered = false;
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
rendered = true;
}
}
} |
Hi, just upgraded from version 2 to 3, now im getting this error on my second instance of the editor. I open the editor in one div, then i close that div, then create a completely new instance.
I put debug statements around every place I'm calling GetValue, its none of my calls to that, so I dont think I can gracefully handle this exception.
I've tried called DiposeEditor and Dispose on the Standalone editor but no change.
Any advice?
The text was updated successfully, but these errors were encountered: