Closed DevVanilli closed 5 days ago
@vicancy, it looks related with #1960
DefaultHubDispatcher --> HubLifetimeManager\
Interesting. Supposedly v1.26.0 fixed the problem but for me the problem started with that version (maybe just a coincidence).
Connections were not cleaned up when disposing server connections. So it is possible that the HubDispatcher is running when the server connection is disposed. Maybe v1.26 further exposed the issue.
It's interesting that v1.26 introduce in the error, the error should be always there. Hi @DevVanilli , is it possible for you to share with me a mini-project that could repro the issue that uses Autofac?
@vicancy
Are you saying this should be fixed? Because after upgrading from Microsoft.Azure.SignalR" Version="1.26.0" to Microsoft.Azure.SignalR" Version="1.26.1", I see this error many, many times every time I deploy a new version of my app on Azure (Docker container):
HResult -2146232798
Message Cannot access a disposed object.Object name: 'IServiceProvider'.
ObjectName IServiceProvider
Source Microsoft.Extensions.DependencyInjection
StackTrace at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception)
TargetSite Void ThrowObjectDisposedException()
Type System.ObjectDisposedException
We encounter the same problem, is there any solution? I updated to v1.27.0 and the error is still there.
With a recent version update, the library started spamming with the given error. It happens whenever application is stopped/restarted.
Error when dispatching '"OnDisconnectedAsync"' on hub. System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed. at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException() at Autofac.Core.Lifetime.LifetimeScope.BeginLifetimeScope(Object tag) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher
1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.HubConnectionHandler
1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.HubConnectionHandler1.RunHubAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler
1.OnConnectedAsync(ConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection) at Microsoft.Azure.SignalR.ServiceConnection.ProcessApplicationTaskAsyncCore(ClientConnectionContext connection)