dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

MissingMethodException IsComponentDisposed() after update to .NET 7.0.17 #54614

Closed MichaelL79 closed 7 months ago

MichaelL79 commented 7 months ago

Is there an existing issue for this?

Describe the bug

After the update to .NET 7.0.17 we are constantly having the unhandled exception System.MissingMethodException: Method not found: 'Boolean Microsoft.AspNetCore.Components.ComponentBase.IsComponentDisposed()' in our Blazor Serverside solution.

It is hard to tell when it occurs as it only happens on the production server which is Windows Server 2019. It seems to happen when a property of the model of an EditForm is changed but this is just a guess as we cannot reproduce it with all such scenarios.

A downgrade to .NET 7.0.16 did not resolve the issue so we went straigt back to .NET 7 which fixed it. Unfortunately we could not spend a lot of time to investigate the issue as the application is business crititcal an we had to resolve the issue as fast as possible.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

2024-03-19 08:50:59.1216 WARN 10.2.222.64 Unhandled exception rendering component: Method not found: 'Boolean Microsoft.AspNetCore.Components.ComponentBase.IsComponentDisposed()'. System.MissingMethodException: Method not found: 'Boolean Microsoft.AspNetCore.Components.ComponentBase.IsComponentDisposed()'. at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-03-19 08:50:59.1216 ERROR 10.2.222.64 Unhandled exception in circuit 'P2dziy8Hm18dvsCKuDguPDRV1QJphHMJZC3fnuXJxk4'. System.MissingMethodException: Method not found: 'Boolean Microsoft.AspNetCore.Components.ComponentBase.IsComponentDisposed()'. at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-03-19 08:50:59.1216 ERROR 10.2.222.64 Unhandled exception in circuit 'P2dziy8Hm18dvsCKuDguPDRV1QJphHMJZC3fnuXJxk4'. Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed. at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at Microsoft.JSInterop.Implementation.JSObjectReference.DisposeAsync() at BlazorInputFileExtended.InputFileExtended.UnLoadDropScriptsAsync() at BlazorInputFileExtended.InputFileExtended.Dispose() at System.Threading.Tasks.Task.<>c.b__128_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource completion, SendOrPostCallback d, Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)

.NET Version

7.0.17

Anything else?

No response

javiercn commented 7 months ago

@MichaelL79 thanks for contacting us.

This very likely points to an issue in one of your dependencies that hasn't been updated to the latest 7.0 versions. The method you are talking about is internal. Could you please ensure all packages are updated to the most recent 7.0 versions and let us know whether you continue to experience the issue?

MichaelL79 commented 7 months ago

Hi @javiercn, this could indeed be the case as we updated a paket a few weeks ago that already uses .NET8

mkArtakMSFT commented 7 months ago

Closing as this seems to be a dependency mixup problem. Hopefully you will be able to find the cause and address it quickly.