Skip to content
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

System.ObjectDisposedException showing up in Production Logs #27

Closed
enusbaum opened this issue Jan 22, 2022 · 2 comments
Closed

System.ObjectDisposedException showing up in Production Logs #27

enusbaum opened this issue Jan 22, 2022 · 2 comments

Comments

@enusbaum
Copy link

I'm seeing the following error show up in my Logs.

I'm unable to replicate it manually but I'm seeing it on my production site. The best I can guess, it's a timing issue where the client has navigated away from the page while OnParameterSetAsync() is still executing. I suspect this might be caused by a crawler bot quickly navigating the links on the site?

This is Blazor Server running on .NET 6 and HeadElement 6.0.2 hosted in Azure AppService.

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'JSObjectReference'.
   at Microsoft.JSInterop.Implementation.JSObjectReference.ThrowIfDisposed()
   at Microsoft.JSInterop.Implementation.JSObjectReference.InvokeAsync[TValue](String identifier, Object[] args)
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.InvokeJSAsync[T](String identifier, Object[] args)
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultTitleAsync()
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultsAsync()
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.ResetIfNeededAsync()
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.SetLinkElementsAsync(LinkElement[] elements)
   at Toolbelt.Blazor.HeadElement.Link.OnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
@jsakamoto
Copy link
Owner

@enusbaum Thanks for reporting!

I fixed this issue and published the new versions of these packages.

We can not avoid client disconnection while asynchronous processing, so I decided to treat this situation gracefully without any crashes.

Please check it out. 😄

@enusbaum
Copy link
Author

Thanks! I can confirm after installing 7.0.0 I haven't seen the exception in my error logs in production.

I sincerely appreciate your maintaining this package as well as your swift response. Cheers! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants