Skip to content

Breaking change: Socket.LocalEndPoint updated on SendToAsync(SocketAsyncEventArgs e) #20949

@antonfirsov

Description

@antonfirsov

Socket.LocalEndPoint updated on SendToAsync(SocketAsyncEventArgs e)

Behavioral breaking change after fixing a bug reported in dotnet/runtime#915 (fixed by dotnet/runtime#808).

Version introduced

.NET 5 RC1

Old behavior

Unlike other variants of SendTo, the SendToAsync(SocketAsyncEventArgs e) method did not alter the LocalEndpoint property on the socket instance.

New behavior

Just like in case of SendTo or BeginSendTo/EndSendTo, the property LocalEndpoint returns the (implicitly bound) socket's local address after the successful completion of SendToAsync(SocketAsyncEventArgs e).

Reason for change

Fix a bug, and consolidate behavior accross sendto variants.

Recommended action

Alter code that assumes that SendToAsync will keep LocalEndpoint's value unchanged/null.

Category

  • ASP.NET Core
  • C#
  • Code analysis
  • Core .NET libraries
  • Cryptography
  • Data
  • Debugger
  • Deployment
  • Globalization
  • Interop
  • JIT
  • LINQ
  • Managed Extensibility Framework (MEF)
  • MSBuild
  • Networking
  • Printing
  • Security
  • Serialization
  • Visual Basic
  • Windows Forms
  • Windows Presentation Foundation (WPF)
  • XML, XSLT

Affected APIs

Socket.SendToAsync(SocketAsyncEventArgs e)
Socket.LocalEndpoint


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 5Work items for the .NET 5 releasebreaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions