Add Socket async polyfills: ConnectAsync, DisconnectAsync, ReceiveFromAsync, SendToAsync#540
Merged
SimonCropp merged 3 commits intoSimonCropp:mainfrom Apr 14, 2026
Merged
Conversation
…mAsync, SendToAsync Add polyfills for System.Net.Sockets.Socket async methods that are missing on older target frameworks: - ConnectAsync(EndPoint, CancellationToken) - polyfilled for <net5.0 - DisconnectAsync(bool, CancellationToken) - polyfilled for <net6.0 - ReceiveFromAsync(Memory<byte>, SocketFlags, EndPoint, CancellationToken) - polyfilled for <net6.0 - SendToAsync(ReadOnlyMemory<byte>, SocketFlags, EndPoint, CancellationToken) - polyfilled for <net6.0 Also adds SocketReceiveFromResult type polyfill for net461, net462, net47, and uap10.0 which lack the struct natively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match BCL's System.Net.Sockets which uses [module: NullablePublicOnly(false)]. Fields become nullable-oblivious, avoiding CS0649 for the never-assigned EndPoint field on internal struct builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add polyfills for
System.Net.Sockets.Socketasync methods missing on older target frameworks:ConnectAsync(EndPoint, CancellationToken)DisconnectAsync(bool, CancellationToken)ReceiveFromAsync(Memory<byte>, SocketFlags, EndPoint, CancellationToken)SendToAsync(ReadOnlyMemory<byte>, SocketFlags, EndPoint, CancellationToken)Also adds a
SocketReceiveFromResulttype polyfill for net461, net462, net47, and uap10.0.Notes
ApiBuilderTestsshould be re-run to regenerate them officially.