#65702·aspnetcore

[Known Build Error] TestServerTests.LongPollingWorks - ObjectDisposedException in OnDisconnectedAsync during shutdown

Author: lewingCreated Mar 7, 2026Updated Sep 17, 2026
Labelsarea-signalrKnown Build Error

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1325148 Build error leg or test failing: Tests: Helix x64 Subset 2 / Microsoft.AspNetCore.SignalR.Client.Tests--net11.0 Pull request: https://github.com/dotnet/aspnetcore/pull/65694

Error Message

json
{
  "ErrorMessage": "Error when dispatching 'OnDisconnectedAsync' on hub",
  "BuildRetry": true,
  "ExcludeConsoleLog": false
}

Description

TestServerTests.LongPollingWorks fails intermittently when the test host shuts down and OnDisconnectedAsync races with IServiceProvider disposal. The HttpConnectionDispatcher.ProcessDeleteAsync fire-and-forgets server-side connection disposal, so when the host tears down, DefaultHubDispatcher.OnDisconnectedAsync can attempt to call CreateAsyncScope() on an already-disposed ServiceProvider, throwing ObjectDisposedException.

Stack trace:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'IServiceProvider'.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateScope()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.CreateScope()
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.CreateAsyncScope(IServiceScopeFactory serviceScopeFactory)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)

Fix in progress: https://github.com/dotnet/aspnetcore/pull/65457 catches ObjectDisposedException at the DI boundary in DefaultHubDispatcher.OnDisconnectedAsync.

Known issue validation

Build: :mag_right: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1325148 Error message validated: [Error when dispatching 'OnDisconnectedAsync' on hub] Result validation: :white_check_mark: Known issue matched with the provided build. Validation performed at: 3/7/2026 10:12:12 PM UTC

Report

Build Repository Step Name Console log Pull Request
1598302 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#69332
1597797 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#69327
1596556 dotnet/aspnetcore Run E2E tests Log
1593683 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#69250
1593346 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#69250
1591601 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#69209
1590117 dotnet/aspnetcore Run E2E tests Log
1579746 dotnet/aspnetcore Run E2E tests Log
1576875 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#68958
1575159 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#68922
1566426 dotnet/aspnetcore Run E2E tests Log dotnet/aspnetcore#60884
Build Repository Test Pull Request
1597177 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Client.Tests.TestServerTests.LongPollingWorks dotnet/aspnetcore#69301
1587176 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests.HubConnectionHandlerTests.CanSetMessageBufferSizeOnServer

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 7 13