Unified to throw NotSupportedException when SendFile() for connectionless sockets (#87108)
* Unified to throw NotSupportedException when SendFile() for connectionless sockets
The issue was that the Socket.SendFile() threw inconsistent exceptions when the platform was Windows and the protocol was UDP.
The first call would throw a SocketException, while the second call would throw a NotSupportedException.
With this commit, SendFile() will consistently throw NotSupportException on all platforms when the protocol is UDP.
Fix #47472
* Change to throws `NotSupportedException` if `!IsConnectionOriented` or `!Connected`.
Before:.
Throws `NotSupportedException` on UDP.
After:
Throws `NotSupportedException` if `!IsConnectionOriented` or `!Connected`.
* Changed test case `UdpConnection_ThrowsException` to run regardless of platform.
* Update src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs
Co-authored-by: Karel Zikmund <karelz@microsoft.com>
---------
Co-authored-by: Karel Zikmund <karelz@microsoft.com>