Skip to content

System.Net.Sockets.Tests tests fail with ObjectDisposedException #126183

Open

Description

@danmoseley

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1512502
Build error leg or test failing: System.Net.Sockets.Tests.WorkItemExecution
Pull request: #126006

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": ["System.Net.Sockets.Tests", "ObjectDisposedException", "System.Net.Sockets.SafeSocketHandle"],
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

net11.0-osx-Debug-x64-Mono_Minijit_Debug-OSX.15.Amd64.Open

  Starting:    System.Net.Sockets.Tests (parallel test collections = on [2 threads], stop on fail = off)
[ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.SafeSocketHandle'.
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs:line 165
   at System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller`1.ManagedToUnmanagedIn[[System.Runtime.InteropServices.SafeHandle, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].FromManaged(SafeHandle handle) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshalling/SafeHandleMarshaller.cs:line 32
   at Interop.Sys.Fcntl.SetIsNonBlocking(SafeHandle fd, Int32 isNonBlocking) in /_/artifacts/obj/System.Net.Sockets/Debug/net11.0-unix/Microsoft.Interop.LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator/LibraryImports.g.cs:line 314
   at System.Net.Sockets.SocketAsyncContext.SetHandleBlocking() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 1386
   at System.Net.Sockets.SafeSocketHandle.SetBlocking() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SafeSocketHandle.Unix.cs:line 154
   at System.Net.Sockets.SocketAsyncContext.ConnectOperation.InvokeCallback(Boolean allowPooling) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 681
   at System.Net.Sockets.SocketAsyncContext.OperationQueue`1[[System.Net.Sockets.SocketAsyncContext.WriteOperation, System.Net.Sockets, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].ProcessAsyncOperation(WriteOperation op) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 1027
   at System.Net.Sockets.SocketAsyncContext.ProcessAsyncWriteOperation(WriteOperation op) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 1468
   at System.Net.Sockets.SocketAsyncContext.WriteOperation.System.Threading.IThreadPoolWorkItem.Execute() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 347
   at System.Net.Sockets.SocketAsyncContext.AsyncOperation.Process() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 291
   at System.Net.Sockets.SocketAsyncContext.HandleEvents(SocketEvents events) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs:line 2302
   at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEngine.Unix.cs:line 279
   at System.Threading.ThreadPoolWorkQueue.Dispatch() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs:line 950
   at System.Threading.PortableThreadPool.WorkerThread.WorkerDoWork(PortableThreadPool threadPoolInstance) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs:line 145
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs:line 121
   at System.Threading.Thread.StartHelper.RunWorker() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs:line 90

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1512502
Error message validated: [System.Net.Sockets.Tests ObjectDisposedException System.Net.Sockets.SafeSocketHandle]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 7/17/2026 11:25:31 AM UTC

Report

Summary

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

Report

Build Repository Test Pull Request
1512502 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #130416

Summary

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

Report

Build Repository Test Pull Request
1633937 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134592
1628188 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #135237
1625807 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #135323
1624774 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #135226
1623850 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #135238
1622081 dotnet/runtime System.Net.Sockets.Tests.AcceptSyncForceNonBlocking.AcceptGetsCanceledByDispose
1621451 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #135064
1620359 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #133659
1619114 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134883
1618332 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134967
1616302 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134675
1612733 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution
1612492 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134210
1611188 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #133696
1610552 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134584
1609145 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134424
1605789 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #133804
1602519 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134124
1602112 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #134121
1596873 dotnet/runtime System.Net.Sockets.Tests.WorkItemExecution #133921

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 2 20

Activity

  1. added
    blocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
    Known Build ErrorUse this to report build issues in the .NET Helix tab
    on Mar 27, 2026
  2. dotnet-policy-service commented on Mar 27, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @karelz, @dotnet/ncl
    See info in area-owners.md if you want to be subscribed.

  3. rzikm commented on Mar 27, 2026

    @rzikm
    Member

    @liveans seems like this is related to setting non-blocking after connectasync

  4. liveans commented on Mar 27, 2026

    @liveans
    Contributor

    @liveans seems like this is related to setting non-blocking after connectasync

    Seems like we need to make SetHandleBlocking best effort, I'll take a look next week.

  5. removed
    untriagedNew issue has not been triaged by the area owner
    on Mar 27, 2026
  6. added this to the 11.0.0 milestone on Mar 27, 2026
  7. removed
    blocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
    on Jun 1, 2026
  8. jeffschwMSFT commented on Jun 1, 2026

    @jeffschwMSFT
    Member

    removing blocking-clean-ci as it has not failed in 30 days

    24-Hour Hit Count 7-Day Hit Count 1-Month Count
    0 0 0
  9. added
    blocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
    on Jul 17, 2026
  10. svick commented on Jul 17, 2026

    @svick
    Member

    I have encountered this in #130416, so I'm adding blocking-clean-ci back. Note that the ErrorMessage seems to have been wrong: it rarely matched, so I have fixed it.

  11. removed their assignment
    on Aug 3, 2026
  12. modified the milestones: 11.0.0, 12.0.0 on Aug 4, 2026
  13. bblankenship78 commented on Oct 12, 2026

    @bblankenship78

    We're testing .NET11 and encountering this issue in RC1. Any updates?

  14. self-assigned this
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Known Build ErrorUse this to report build issues in the .NET Helix tabarea-System.Net.Socketsblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions