Skip to content

[main] Forward-port SocketAsyncEventArgs address-family reuse fix - #136524

Merged
rbhanda merged 3 commits into
mainfrom
users/rbhanda/oob-20261027-sockets-main
Oct 27, 2026
Merged

rbhanda merged 3 commits into
mainfrom
users/rbhanda/oob-20261027-sockets-main

Conversation

@rbhanda

@rbhanda rbhanda commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Forward-port the released .NET 11 RC3 SocketAsyncEventArgs address-family reuse fix to dotnet/runtime/main.

This continues dotnet/dotnet#10450 in the component repository for runtime-specific build and test coverage. The VMR PR remains open; this PR does not merge or close it.

  • Size the Windows native socket-address buffer from the current socket's address family and grow it when reused across address families.
  • Replace an undersized cached managed SocketAddress and use the declared native buffer size for WSAMsg.
  • Preserve both released regression theories for IPv4/IPv6 event-args reuse and caller-supplied address-family mismatches.

Source and adaptation

The three-file fix comes from public dotnet/dotnet commit 6f0fa48bddc8e7baaf5932d9340487ef12621103, included in v11.0.0-rc.3.26522.148. The paths are mapped from src/runtime/ into this repository.

One intentional safety adjustment addresses the allocation-order comment on dotnet/dotnet#10450: allocate the replacement native buffer before freeing the previous allocation. If allocation throws, the event args retain the existing allocation and remain safe to dispose.

No servicing version changes or unrelated fixes are included.

Validation

  • The released patch applied without conflicts.
  • git diff --check passed.
  • Bootstrapped the repository-required .NET SDK and built the changed Windows implementation successfully:
    dotnet build src\libraries\System.Net.Sockets\src\System.Net.Sockets.csproj --framework net11.0-windows --no-restore --nologo
    Result: 0 warnings, 0 errors.
  • The all-target build was stopped in favor of the focused Windows build. Non-Windows configurations have not been fully validated locally.
  • Functional regression tests have not run locally. This checkout has no built CoreCLR/testhost, and the machine has no installed Visual Studio C++ build tools for the native baseline.
  • Runtime CI, including Windows regression tests, and component-owner review are still required before merging.

@wfurt, please review the runtime forward-port, including the allocation-safety adjustment.

Note

This PR was prepared with GitHub Copilot.

Port the released .NET 11 RC3 fix and its regression tests from dotnet/dotnet commit 6f0fa48bddc8e7baaf5932d9340487ef12621103. Continue dotnet/dotnet#10450 in the runtime repository for component-level validation.

Allocate the replacement native address buffer before freeing the previous buffer so an allocation failure leaves the existing allocation intact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c16c76d8-4d37-43f3-b2c4-890b9a3ce0a7
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@rbhanda
rbhanda marked this pull request as ready for review October 27, 2026 17:18
@rbhanda
rbhanda requested a review from wfurt October 27, 2026 17:18
@rbhanda
rbhanda enabled auto-merge (squash) October 27, 2026 17:48
@MihaZupan

Copy link
Copy Markdown
Member

/ba-g The build failure was #136543

@rbhanda
rbhanda merged commit a9655c5 into main Oct 27, 2026
22 of 88 checks passed
@rbhanda
rbhanda deleted the users/rbhanda/oob-20261027-sockets-main branch October 27, 2026 21:23
@lewing

lewing commented Oct 27, 2026

Copy link
Copy Markdown
Member

/ba-g The build failure was #136543

@MihaZupan which was already fixed on main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants