You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NullReferenceException in SignalR's DefaultHubDispatcher #25612
DefaultHubDispatcher calls DisposeAsync on a null reference if IServiceScopeFactory.CreateScope throws an exception here, so NullReferenceException is thrown from the finally block, overwriting the original exception. This happens when the application is stopping and dispatcher methods are called after IServiceProvider is disposed.
I'm guessing your app is being shutdown ungracefully? If so, we can't really guarantee cleanup to be clean either.
We can do a little cleanup here and move the CreateScope call outside of the try catch so the original exception is preserved.
If you have a long running hub method that isn't observing connection close's (when the app shuts down) then that could cause this issue as well. Either using ApplicationStopping, or Context.ConnectionAborted.
Activity
BrennanConroy commentedon Sep 4, 2020
I'm guessing your app is being shutdown ungracefully? If so, we can't really guarantee cleanup to be clean either.
We can do a little cleanup here and move the
CreateScopecall outside of the try catch so the original exception is preserved.If you have a long running hub method that isn't observing connection close's (when the app shuts down) then that could cause this issue as well. Either using ApplicationStopping, or Context.ConnectionAborted.
imb590 commentedon Sep 7, 2020
The shutdown is not graceful, but it is still reasonable to expect an exception from a disposed
IServiceProviderin this case, not a NRE, isn't it?davidfowl commentedon Oct 2, 2020
Yes absolutely it just makes it a lower priority.