Skip to content

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

@lewing

Description

@lewing

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: #65694

Error Message

{
  "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: #65457 catches ObjectDisposedException at the DI boundary in DefaultHubDispatcher.OnDisconnectedAsync.

Known issue validation

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

Report

Build Definition Step Name Console log Pull Request
1392201 dotnet/aspnetcore Run E2E tests Log #66427
1391892 dotnet/aspnetcore Run E2E tests Log #66422
1382693 dotnet/aspnetcore Run E2E tests Log #66344
1378920 dotnet/aspnetcore Run E2E tests Log #66317
1376101 dotnet/aspnetcore Run E2E tests Log #66276
1375151 dotnet/aspnetcore Run E2E tests Log #66276
1371261 dotnet/aspnetcore Run E2E tests Log #66236
1371101 dotnet/aspnetcore Run E2E tests Log
1370518 dotnet/aspnetcore Run E2E tests Log
1370198 dotnet/aspnetcore Run E2E tests Log #66216
1362207 dotnet/aspnetcore Run E2E tests Log #66087
1361415 dotnet/aspnetcore Run E2E tests Log #66081
Build Definition Test Pull Request
1398868 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Client.Tests--net10.0.WorkItemExecution #64819
1397926 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Client.Tests--net11.0.WorkItemExecution #66383
1397438 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests--net11.0.WorkItemExecution #66260
1393598 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests--net11.0.WorkItemExecution #66442
1390936 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests--net11.0.WorkItemExecution #66184
1386958 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests--net11.0.WorkItemExecution
1383866 dotnet/aspnetcore Microsoft.AspNetCore.SignalR.Tests--net11.0.WorkItemExecution

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
3 7 19

Metadata

Metadata

Labels

Known Build ErrorIssue that should show up in Build Analysisarea-signalrIncludes: SignalR clients and servers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions