-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
🏁 Release: .NET 8Work items for the .NET 8 releaseWork items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking change
Description
Description
The previous ad-hoc behavior of the SendFile
method family for connectionless (eg. UDP) sockets has been harmonized to throw NotSupportedException
on all platforms.
Version
.NET 8 RC 1
Previous behavior
Assuming a connectionless (eg. UDP) Socket
:
SendFile
throwsSocketException
on Windows, and no exception on Unix-like platforms- Awaiting a
ValueTask
returned fromSendFileAsync
throwsSocketException
asynchronously on all platforms - Calling
EndSendFile
on anIAsyncResult
returned fromBeginSendFile
throwsSocketException
on all platforms
New behavior
Assuming a connectionless (eg. UDP) Socket
:
SendFile
throwsNotSupportedException
on all platforms- Awaiting a
ValueTask
returned fromSendFileAsync
throwsNotSupportedException
asynchronously on all platforms - Calling
EndSendFile
on anIAsyncResult
returned fromBeginSendFile
throwsNotSupportedException
on all platforms
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
- Behavioral change: Existing binaries may behave differently at run time.
Reason for change
Given that SendFile
is typically used with large amounts of data, it doesn't really make sense to use it with connectionless sockets. The previous behavior was ad-hoc, throwing SocketException
on some platforms, while succeeding on others with unclear outcome.
See dotnet/runtime#47472.
Recommended action
SendFile
should not be attempted for connectionless sockets.
Feature area
Networking
Affected APIs
Socket.SendFile
, Socket.SendFileAsync
, Socket.EndSendFile
(all overloadss).
Metadata
Metadata
Assignees
Labels
🏁 Release: .NET 8Work items for the .NET 8 releaseWork items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking change