Commit Graph
881 Commits
Author SHA1 Message Date
Tom Deseyn edc5a414f0 Socket: don't disconnect Socket for unknown/unsupported socket options. (#59925)
Fixes #59055.
2021-10-08 15:07:19 +02:00
Anton Firszov a8c2d1eae1 Disable more SendPacketsElement tests on Win11 (#59359) 2021-09-23 14:48:47 +02:00
Jan Jahoda cf79661315 Suppress SendPacketsElement_FileStreamMultiPartMixed_MultipleFileStreams_Success test on windows 11 (#59203) 2021-09-20 19:48:25 +02:00
Andrii Kurdiumov 5588f94924 Remove usused rd.xml files (#59201)
Closes #51112
2021-09-16 16:53:54 -06:00
Bar Arnon 975aa549b6 Elide SocketFlags in Socket API (#57634)
* Elide SocketFlags in Socket API

Fix #43934

* Fix SocketAsyncEventArgs tests

* Cosmetics

* Elide SocketFlags in tests

* Comments
2021-09-14 21:32:22 +02:00
Anton Firszov 566b3ebe2f Increase some of the DnsEndPointTest timeouts (#58129)
Long story short:
I have spent several hours trying to get a test run on SLES in order to repro #57929, no success so far, and it may take days to make progress, since I'm unfamiliar with SLES.

I recommend to bump the timeout values for now, and see if it helps with the issue. If not, we may invest into another round of investigation.

(hopefully) fixes #57929
2021-09-03 12:24:28 +02:00
Tom Deseyn b726f7b1c8 Socket: check connect result when non-blocking connect completes. (#57756)
* Socket: check connect result when non-blocking connect completes.

In addition to checking whether the socket is writable to know the
connect completed, also read SO_ERROR to know if the connect was
succesful before setting the Socket state to connected.

* Avoid EADDRNOTAVAIL on Windows/OSX by connecting to port 1 instead of 0.

* We don't expect InProgress result from reading SO_ERROR.

* Handle platform differences.

* Poll timeout is microseconds instead of milliseconds.

* PR feedback

* PR feedback
2021-08-31 14:46:51 +02:00
Anton Firszov 0d3ce719f4 Make SendFile_NonParallel<T> abstract (#58003) 2021-08-24 21:29:18 +02:00
Anton Firszov 918e6a9a27 Move GreaterThan2GBFile_SendsAllBytes to a non-parallel test collection (#57946)
Fixes #57907

Intentionally left out `***CancellableTask` and `***SyncForceNonBlocking` to somewhat counterpart the increased execution time. I don't think we need all the cases for this particular test.
2021-08-24 09:35:59 +02:00
Anton Firszov 9b93ac64e4 Move Select_AcceptNonBlocking_Success to non-parallel collection (#57503) 2021-08-17 11:13:40 +02:00
Anton Firszov ebc0f05ebc Define timeout for CreateSocket.Ctor_SafeHandle_Listening_Success (#56717) 2021-08-06 14:36:27 +02:00
Anton Firszov c1185726b9 Enable BeginAcceptV4BoundToAnyV4_Success with better timeout handling (#56406) 2021-07-30 14:15:09 +02:00
Anton Firszov 6d79c7e210 Make LocalEndPointTest and some Connect tests non-parallel (#56399) 2021-07-30 14:11:24 +02:00
Mitchell HwangandMitchell Hwang ee729c80dd Remove ActiveIssues from tests no longer failing (#56393)
Co-authored-by: Mitchell Hwang <[email protected]>
2021-07-27 15:04:37 -04:00
Anton Firszov a85d36fed4 Fix some DualMode connect test issues (#56226)
Fixes #55053, fixes #54677
2021-07-26 19:41:12 +02:00
Anton Firszov a2235e775b Disable BeginReceiveFrom_RemoteEpIsReturnedWhenCompletedSynchronously on catalyst (#56304) 2021-07-26 19:39:31 +02:00
Anton Firszov 1a3a042f92 Fix static Socket.ConnectAsync for DnsEndPoint containing IPv6-mapped address string (#56102)
Fixes #56099
2021-07-23 17:37:13 +02:00
Miha ZupanandStephen Toub 12c4e4cd63 Update System.Net.Security Telemetry tests (#55910)
* Update System.Net.Security Telemetry tests

* Always return Task from ProcessAuthenticationAsync

* Name bool arguments

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2021-07-22 17:35:54 +00:00
Karel Zikmund 5e176538e7 Disable test Connect_DualMode_MultiAddressFamilyConnect_RetrievedEndPoints_Success on Linux (#56002)
* Disable test Connect_DualMode_MultiAddressFamilyConnect_RetrievedEndPoints_Success on Linux

Disabled test tracked by #55053

* Update Connect.cs
2021-07-20 22:13:10 -04:00
Karel Zikmund 5026c2582f Disable test Connect_DualMode_DnsConnect_RetrievedEndPoints_Success on Linux (#56003)
Disabled test tracked by #54677 and #55709
2021-07-20 22:31:55 +02:00
Anton Firszov 067aa165d9 Expose a global switch to disable IPV6 (#55012)
Fixes #47583. Resolves #52287, #54807 and similar issues, without changing customer application code.

Introduces an AppContext switch `System.Net.DisableIPv6` and environment variable `DOTNET_SYSTEM_NET_DISABLEIPV6` to emulate the lack of OS-level IPv6 support. This is useful to workaround dual-stack socket issues when the OS reports support of IPv6, but some other underlying infrastructure element (typically VPN) doesn't function well with IPv6 request.

For consistency, this switch also impacts NameResolution and Ping, not only Sockets.
2021-07-12 14:24:54 +02:00
Anton Firszov 1b61065966 Fix Connect_DualMode_DnsConnect_RetrievedEndPoints_Success on Linux (#54681) 2021-06-29 15:03:09 +02:00
LateApexEarlySpeed b317d0624f UdpClient with span support (#53429)
Add API from #864
2021-06-24 14:30:55 +02:00
Miha Zupan f3af8d8b14 Fix telemetry for Socket connects to Dns endpoints (#54071) 2021-06-23 17:21:42 -07:00
Tom Deseyn 06cf0b0245 Sockets.tests: TcpReceiveSendGetsCanceledByDispose: remove Timeout. (#52599)
* Sockets.tests: TcpReceiveSendGetsCanceledByDispose: remove Timeout.

This timeout is not needed and masks a more useful exception thrown
by the test.

* Add WaitAsync to timeout on all async operations

* Add missing timeout
2021-06-08 16:47:16 +02:00
Tom Deseyn 0d31ddb6c0 Socket: don't assign right endpoint until the connect is successful. (#53581)
* Socket: don't assign right endpoint until the connect is successful.

'Right endpoint' must match the address family of the Socket or
we can't serialize the LocalEndPoint and RemoteEndPoint.

When multiple connect attempts are made against a DualMode Socket with
both IPv4 and IPv6 addresses, a failed attempt must not set 'right
endpoint'.

* SocketTaskExtensionsTest.EnsureMethodsAreCallable: update expected exceptions

* PR feedback

* EnsureMethodsAreCallable: move ReceiveFromAsync before ConnectAsync to avoid wildcard bind on Windows that leads to a different exception
2021-06-04 19:09:30 -07:00
Tom Deseyn d3ed5a9ede Socket: delete unix local endpoint filename on Close (#52103)
Fixes #45537
2021-05-31 18:07:31 +02:00
Geoff KizerandGeoffrey Kizer 11dc7d45ee remove WSL checks in tests (#53475)
Co-authored-by: Geoffrey Kizer <[email protected]>
2021-05-30 13:28:37 +02:00
Geoff KizerandGeoffrey Kizer b5c91e4c29 add AcceptAsync cancellation overloads (#53340)
* add AcceptAsync cancellation overloads

* pass cancellationToken to AcceptAsync in Unix NamedPipe impl

* add TcpListener overloads too

* enable pipe cancellation test on Unix

Co-authored-by: Geoffrey Kizer <[email protected]>
2021-05-29 12:10:10 -07:00
Geoff Kizer bb38de7bc6 implement cancellation support for SendFileAsync and DisconnectAsync (#53062)
implement cancellation support for SendFileAsync and DisconnectAsync, and rework some internal async logic to support this and reduce code duplication
2021-05-26 22:58:37 -07:00
Alexander Köplinger 4a73cb9af5 Use OperatingSystem APIs instead of RuntimeInformation in more places (#52548)
* Use OperatingSystem APIs instead of RuntimeInformation in more places

These are recommended instead of the older APIs.

* PR feedback
2021-05-19 01:08:15 +02:00
hrrrrustic 7be77b8fa0 Obsolete Socket.UseOnlyOverlappedIO (#52475)
close #47163
2021-05-18 21:16:09 +02:00
Tom Deseyn e05f6a9a9c TcpReceiveSendGetsCanceledByDispose: fix test timing out with latest RHEL7 kernel (#52833)
The timeout on this test is less than the accumulated delay on retries,
which causes the test to timeout on a RHEL7 system that has the kernel bug fixed.
2021-05-17 14:48:52 +02:00
Miha Zupan db3784c30c Fix empty byte[] bug in EventSource (#52602)
* Fix empty byte[] bug in EventSource

* Add some non-zero data to byte[] tests

* Remove leftover usings from testing

* Return Array.Empty for empty byte[]

* Pass correct pointer to Marshal copy
2021-05-13 09:01:21 +02:00
5297337e5b [iOS][libraries] Skip failing iOS tests with ActiveIssues and proj level skips (#51491)
In effort to assess the state of the iOS library tests, a number of tests will be skipped

Test suites that crash, hang, or have a significant number of failures (mostly 20+ failing unique test methods) are skipped on at the `tests.proj` level. Otherwise, `[ActiveIssue]` attributes have been attached to either the individual test methods that fail or the entire class if the whole test class fails. Any pre-existing `ActiveIssue` attribute associated with iOS had been reassessed to either remain or be closed.

A few test suites have been skipped because they fail with some form of `PlatformNotSupportedException`. `[SkipOnPlatform]` attributes are attached to the failing test methods.

All of the Issues can be tracked at https://github.com/dotnet/runtime/projects/48#column-9236436

The ActiveIssues and `tests.proj` exclusions have been tested on https://github.com/dotnet/runtime/pull/49917 as well.

-----------
This PR makes the following changes in the following files:
`src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj` - Removed `$(NetCoreAppCurrent)-iOS` from target frameworks as it is stated to currently only supported on Windows.

`src/libraries/tests.proj` - Update the test suites that need to be skipped at the project level, reducing the number and categorizing as a skip due to PNSE, a skip due to numerous failures, and a skip due to the suite crashing.

The remaining files changed are either:
`[ActiveIssue("<issue-url>", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]`
`[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")]`

Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Tammy Qiu <[email protected]>
2021-05-12 17:40:55 +02:00
Anton Firszov 753b764d1c Relax Socket.DualMode exception behavior (#50585)
Stop throwing from Socket.DualMode getter for IPV4 sockets, return false instead.
2021-05-11 12:30:38 +02:00
Karel Zikmund be3f8203ef Disable System.Net.Sockets.Tests.LoggingTest.EventSource_EventsRaisedAsExpected (#52563) 2021-05-11 10:57:10 +02:00
Mitchell HwangandMitchell Hwang 913fdbe2f4 [Android][libraries] Skip failing Android tests with ActiveIssues and proj level skips (#50800)
* [Android][libraries] Update test suites skipped

* [Android][libraries] Add System.Globalization.Tests ActiveIssues 36672

* [Android][libraries] Add System.IO.Compression.Tests ActiveIssues 36845

* [Android][libraries] Add System.Text.RegularExpressions ActiveIssues 36848

* [Android][libraries] Add System.Diagnostics.DiagnosticSource.Switches.Tests ActiveIssues 37073

* [Android][libraries] Add System.Net.Requests.Tests ActiveIssues 37087

* [Android][libraries] Add System.Runtime.Tests test proj skip 37088

* [Android][libraries] Add System.Runtime.Numerics.Tests ActiveIssues 37093

* [Android][libraries] Add System.Security.Cryptography.Pkcs.Tests test proj skip 37094

* [Android][libraries] Add System.Console.Tests Active Issues 37465

* [Android][libraries] Consolidate System.Runtime.Extensions.Tests ActiveIssues into 49868

* [Android][libraries] Add System.Threading.Tasks.Parallel.Tests ActiveIssue 50566

* [Android][libraries] Add System.Net.NetworkInformation.Functional.Tests ActiveIssues 50567

* [Android][libraries] Add System.Net.Sockets.Tests ActiveIssues 50568

* [Android][libraries] Add System.Diagnostics.Debug.Tests ActiveIssues 50570

* [Android][libraries] Add Microsoft.VisualBasic.Core.Tests ActiveIssues 50572

* [Android][libraries] Add System.Text.Encoding.Tests ActiveIssues 50573

* [Android][libraries] Add System.Net.Ping.Functional.Tests ActiveIssues 50574

* [Android][libraries] Add Microsoft.Extensions.Logging.Console.Tests ActiveIssues 50575

* [Android][libraries] Add System.Collections.Concurrent.Tests ActiveIssues 50576

* [Android][libraries] Add System.Threading.Thread.Tests ActiveIssues 50577

* [Android][libraries] Rename System.Collections.Immutable.Tests ActiveIssues 50579

* [Android][libraries] Rename System.Security.Cryptography.Csp.Tests ActiveIssues 50580

* [Android][libraries] Remove test level skips that are now test specific skips

* [Android][libraries] Remove closed ActiveIssues

* [Android][libraries] Add more crashing test suites to be skipped

* [Android][libraries] Add Microsoft.Extensions.Configuration.Functional.Tests ActiveIssue 50866

* [Android][libraries] Add Microsoft.Extensions.Configuration.Ini.Tests ActiveIssue 50867

* [Android][libraries] Add Microsoft.Extensions.Configuration.Json.Tests ActiveIssue 50868

* [Android][libraries] Add Microsoft.Extensions.Configuration.Xml.Tests ActiveIssue 50870

* [Android][libraries] Add Microsoft.Extensions.DependencyInjection.Tests test proj skip

* [Android][libraries] Add Microsoft.Extensions.DependencyModel.Tests ActiveIssue 50872

* [Android][libraries] Add Microsoft.Extensions.Http.Tests ActiveIssue 50873

* [Android][libraries] Add Microsoft.Extensions.Logging.EventSource.Tests test proj skip

* [Android][libraries] Add Microsoft.Extensions.Logging.Tests ActiveIssues 50875

* [Android][libraries] Add Microsoft.Extensions.Options.Tests ActiveIssues 50877

* [Android][libraries] Add Microsoft.Extensions.Primitives.Tests ActiveIssues 50878

* [Android][libraries] Add System.CodeDom.Tests ActiveIssues 50879

* [Android][libraries] Add System.Collections.Immutable.Tests ActiveIssues 50579

* [Android][libraries] Add System.Collections.NonGeneric.Tests ActiveIssues 37069

* [Android][libraries] Add System.Collections.Tests test proj skip

* [Android][libraries] Add System.ComponentModel.Primitives.Tests ActiveIssues 50881

* [Android][libraries] Add System.ComponentModel.Annotations.Tests ActiveIssues 50882

* [Android][libraries] Add System.ComponentModel.TypeConverter.Tests test proj skip

* [Android][libraries] Add System.Composition.Hosting.Tests ActiveIssues 50917

* [Android][libraries] Add System.Composition.Runtime.Tests ActiveIssues 50918

* [Android][libraries] Add System.Composition.Tests ActiveIssues 50919

* [Android][libraries] Add System.Data.Common.Tests test proj skip

* [Android][libraries] Add System.Diagnostics.DiagnosticSource.Tests ActiveIssue 50924

* [Android][libraries] Add System.Diganostics.TextWriterTraceListener.Tests ActiveIssue 50925

* [Android][libraries] Add System.Diagnostics.Tracing.Tests test proj skip

* [Android][libraries] Add System.IO.Pipelines.Tests ActiveIssue 50927

* [Android][libraries] Add System.Linq.Expressions.Tests ActiveIssue 37474

* [Android][libraries] Add System.Net.NameResolution.Functional.Tests ActiveIssue 50928

* [Android][libraries] Add System.Net.Primitives.Functional.Tests ActiveIssue 50571

* [Android][libraries] Add System.Net.Requests.Tests ActiveIssue 37087

* [Android][libraries] Add System.ObjectModel.Tests ActiveIssue 50933

* [Android][libraries] Add System.Resources.Extensions.Tests ActiveIssue 50934

* [Android][libraries] Add System.Resources.ResourceManager.Tests ActiveIssue 50935

* [Android][libraries] Add System.Runtime.Serialization.Primitives.Tests ActiveIssue 50936

* [Android][libraries] Add System.Security.Cryptography.X509Certificates.Tests ActiveIssue 50937

* [Android][libraries] Add System.Text.Json.Tests test proj skip

* [Android][libraries] Add System.Text.RegularExpressions.Tests ActiveIssues 50942

* [Android][libraries] Add System.Threading.Channels.Tests ActiveIssues 50943

* [Android][libraries] Add System.Xml.Linq.xNodeBuilder.Tests ActiveIssues 50944

* [Android][libraries] Add System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests test proj skip

* [Android][libraries] Add System.Xml.XmlSchemaSet.Tests test proj skip

* [Android][libraries] Add System.Xml.Xsl.XslCompiledTransformApi.Tests test proj skip

* [Android][libraries] Add System.Xml.Xsl.XslTransformApi.Tests test proj skip

* [Android][libraries] Add System.Net.Sockets ActiveIssue EventSource 50568

* [Android][libraries] Add System.Net.Mail.Functional.Tests ActiveIssue  50999

* [Android][libraries] Clean up Android test architecture specific skips

* [Android][libraries] Add more test suite skips

* [Android][libraries] Skip test suites failing with PlatformNotSupportedException related failures

* [Android][libraries] Add more suites that have execution compromised

* [Android] Add new Microsoft.Extensions.Configuration.FileExtensions.Tests active issue

* [Android] Add new Microsoft.Extensions.Configuration.Ini.Tests active issue

* [Android] Add new Microsoft.Extensions.Configuration.Json.Tests active issue

* [Android] Add new Microsoft.Extensions.Configuration.Xml.Tests active issue

* [Android] Add new Microsoft.Extensions.Http.Tests active issue

* [Android] Fix System.Text.Json.Tests project path skip

Co-authored-by: Mitchell Hwang <[email protected]>
2021-05-10 11:16:38 -04:00
Pieter-Jan Briers dcb42e861e Adds synchronous span APIs for datagram sockets. (#51956)
* Adds synchronous span APIs for datagram sockets.

Part of #33418/#938

* Doc comments for new APIs.

* Fix review nits.

* Add 0-byte send tests.
2021-05-10 12:12:04 +02:00
Günther Foidl 3e6de7ea5a Socket.SendFileAsync based on SendPacketsAsync (#52208)
* Socket.SendFileAsync layered on top of SendPacketsAsync

* Tests

* Cleanup

* Set SendPacketsFlags

* Check if the socket is connection orientated

Cf. https://github.com/dotnet/runtime/pull/52208#discussion_r625922176

* Try to re-use the SendPacketsElement-array

Cf. https://github.com/dotnet/runtime/pull/52208#discussion_r625346014

* Fixed test

Cf. https://github.com/dotnet/runtime/pull/52208#discussion_r625316709

* Update src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs
2021-05-06 08:44:25 -07:00
Geoff KizerandGeoffrey Kizer 16db832670 use AssertExtensions.SequenceEqual in a few places (#52054)
Co-authored-by: Geoffrey Kizer <[email protected]>
2021-05-03 11:23:28 -07:00
Geoff KizerandGeoffrey Kizer 59025152f0 refactor old APM [Begin/End]Accept methods on top of Task APIs, and enable for Unix as well (#51212)
* refactor old APM [Begin/End]Accept methods on top of Task APIs, and enable for Unix as well

* fix BeginAccept to throw synchronously, and relevant test changes

* fix AcceptReceive test to run on unix too

* dispose accepted socket if receive throws

* remove CallbackClosure cache

* fix test helper to indicate AcceptReceive with EAP is still only supported on Windows

Co-authored-by: Geoffrey Kizer <[email protected]>
2021-04-26 12:17:44 -07:00
Geoff KizerandGeoffrey Kizer 333a6c79b2 fix zero byte Send on linux (#51473)
* fix zero byte send on linux and update tests

Co-authored-by: Geoffrey Kizer <[email protected]>
2021-04-20 09:30:38 -07:00
Geoff KizerandGeoffrey Kizer 8093c52a9a add Task-based DisconnectAsync and refactor APM methods on top of it (#51213)
* add Task-based DisconnectAsync and refactor APM methods on top of it

* fix BeginDisconnect to throw synchronously and add relevant tests

* remove #region stuff in Socket.cs and add link to github issue

Co-authored-by: Geoffrey Kizer <[email protected]>
2021-04-17 19:40:53 -07:00
Miha Zupan b80ddefa8d Disable SendRecvPollSync_TcpListener_Socket on Windows 8 (#51186) 2021-04-14 17:57:55 +02:00
Alexander Köplinger bc9f00c226 Cleanup PlatformSpecific/SkipOnMono attributes that skip a platform (#50907)
We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.

The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.
2021-04-09 13:20:18 +02:00
Stephen Toub 1fea73f457 Add Random.Shared (#50297)
* Add Random.Shared

* Disable on wasm test requiring parallelism
2021-03-31 22:32:03 -07:00
Anton Firszov 0b38ef179d move NonDisposedSocket_SafeHandlesCollected to a non-parallel test collection (#50279) 2021-03-26 12:28:24 -04:00
Anton Firszov 60037aae82 Improve NonDisposedSocket_SafeHandlesCollected test (#50104)
Apply timeouts in NonDisposedSocket_SafeHandlesCollected
2021-03-24 12:46:32 +01:00
Tom Deseyn 2606d828b8 AnonymousPipeStreams.Linux, Process.Unix Streams: perform async I/O by using Socket implementation (#44647)
* experiment: use read/write for socket operations instead of recvmsg/sendmsg

* AnonymousPipeStreams: perform async I/O by using Socket implementation

* PipeStream.Unix: use sync/async functions on Socket

* Refactor Socket creation

* Cleanup

* Fix broken comment

* Allow passing pipe fd to Socket/SafeSocketHandle public ctor

* macOS: Handle EPIPE on registration

* Refactor IsPipe to IsSocket

* Move registration error handling in to single method

* Process: use AnonymousPipeClientStream for redirected streams.

* Remove unneeded BufferedStream

* PR feedback

* PipeStream.Unix: enable cancelation tests

* Add back Ctor_SafeHandle_Invalid_ThrowsException test

* SysRead/SysWrite: Assert not used for socket-type handle
2021-03-16 22:03:36 -04:00