* Change netfx to target .NET 4.7.1
* Fix CoreFx.Private.TestUtilities to not reference System.Runtime.InteropServices.RuntimeInformation which is now inbox in netfx
* Fix StackTrace.Tests to be built against netstandard and run against netfx inbox
* Fix ValueTuple configurations to support net461 and add netfx placeholder configuration since in net471 it is now inbox
* Fix projects' package configurations that had netfx (net461) to still support net461 and netfx as a buildconfigurations
* Disable failing tests when running on .NET 4.7.1
* Make netfx target net472 and merge with master
* Update ActiveIssue comments to issue number only
* Workaround packages tests due to not installed targeting pack
* Match NSSupportPackage version to CLI's
* Remove netstandard support lib bin placing to runtime and testhost for netfx, fix reference paths to match new package
* Run UpdateVSConfigurations after merging conflicts with the newly updated SDK projects
* Add net461 package configuration to System.CodeDom
* Add net461 package configuration to System.Configuration.ConfigurationManager
* Add net461 package configuration to System.Security.Cryptography.Xml
* Add net461 package configuration to System.Security.Permissions
* Add net461 package configuration to System.ServiceModel.Syndication
Commit migrated from https://github.com/dotnet/corefx/commit/faad2e63b35bed10fe18195987a413308b97eded
A bunch of tests have the following structure:
```C#
var clientTask = hc.GetAsync(...);
await server.HandleRequest();
Handle(await clientTask);
```
If the HttpClient request fails in a way that causes the server not to receive the request, the test will hang, as the await for the server operation to complete will never complete.
This commit changes a bunch of the tests to avoid that pattern. This makes several of the tests disabled due to hanging actually reveal the cause of the problem, e.g. the ManagedHandler not supporting 1.0 requests and failing immediately if provided with that version without making a request to the server.
Commit migrated from https://github.com/dotnet/corefx/commit/e34b6fd99085c69c8fd7a64ed5eb4da5b66f4136
HttpClient on Unix fails for some sites, in cases where the site sends a response before it’s fully received the entirety of the request. That’s because HttpClient has logic to Dispose of the request content once the Task returned from the handler’s SendAsync completes, and unlike WinHTTP, libcurl doesn’t require that the whole request be sent before any of the response is processed. That means that CurlHandler may receive the response (or the response headers), complete the SendAsync task, but still be reading from the request content, which may then be disposed of by HttpClient while it’s still in use, causing potential corruption, exceptions, etc.
The Dispose behavior has other problems with it. A more generalized version of the above is that it prevents handlers that want to support full duplex communication, since it essentially requires that the whole request be sent before the response is processed. It also forces extra cost onto consuming code in some situations, as it means that the request content objects can’t be pooled and reused (since disposal typically invalidates objects for such a purpose, though in some cases a custom content could be developed to override and ignore Dispose).
A variety of approaches were explored to address this:
- Change CurlHandler to only complete the SendAsync Task when both the request has been fully sent and the appropriate portion of the response has been received. This is problematic, though, as with the pull model employed by libcurl, we don’t know reliably when the request has been fully sent.
- Change the disposal to be handled by the handlers rather than by HttpClient. This could help in that a handler like CurlHandler could simply defer disposal until libcurl tells it the “easy” operation is done. But it has other downsides. Today code can use an HttpClientHandler without HttpClient, e.g. by using HttpMessageInvoker instead of HttpClient, in which case it bypasses this disposal logic (and other logic provided by the relatively thin HttpClient wrapper). If we were to move the disposal logic to the HttpClientHandler, now such code that was never having its request content disposed will start to, which is bad and exactly the opposite of what we want. It also causes problems for chains of handlers, e.g. if HttpClient is given a handler that wraps CurlHandler, and that handler expects to be able to look at the request content after the SendAsync Task from CurlHandler completes but before it itself completes its SendAsync Task. And while such a scenario may seem far fetched, we effectively have it in the bits today: the diagnostic handler that's used to pass details off to DiagnosticListeners is injected in the middle like this, and it does pass off the request content after the wrapped SendAsync Task completes... if a listener was expecting a non-disposed request content at that point, it would be sorely disappointed.
- Simply stop disposing. The primary downside here is existing code that may have expected disposal to happen, e.g. if a StreamContent wrapping a FileStream isn't explicitly disposed of by the app code, cleanup of the FileStream will be left to its finalizer.
The least bad option is to simply stop disposing. This PR makes that change.
Commit migrated from https://github.com/dotnet/corefx/commit/6d06c39857f8bb7a798ca118944d25a43aaa8beb
Finished investigation of failures on .NET Framework for
System.Net.Http.
Added specific NETFX test changes where necessary. Opened up additional
bugs for investigation.
Added missing parameter validation for HttpClientHandler.MaxConnectionsPerServer
for the net46 OOB. This matches .NET Core now.
Removed some test code that was incorrectly trying to do CredentialCache.Add()
with a 'basic' authtype and using DefaultCredentials. This is invalid and
throws exception on netfx. Added dotnet/corefx#18870.
Remove PlatformNotSupportedProxy test code. It was throwing an exception
on netfx and the purpose of it didn't seem to make sense in the one test
that was using it.
Fixesdotnet/corefx#17691.
Commit migrated from https://github.com/dotnet/corefx/commit/b1246c7f1ee1d9e42594988073fd06580d23fe84
Got the Http Functional tests running with no errors against NETFX (Desktop). Found a bunch
of compatibility differences between Desktop and Core that need to be investigated. For now,
the tests are skipped on Desktop.
Fixed the LoopbackServer so that it will run. It was blowing up with `MissingTypeException`
due to missing SocketTaskExtensions class (dotnet/corefx#17690).
Contributes to dotnet/corefx#17691
Commit migrated from https://github.com/dotnet/corefx/commit/b7f6f5f159ebe6c0597578bbd858697a6159a22f
The only change to the logic is that the tests now use RemoteInvoke to run each test in its own process, so as to avoid EventSource and DiagnosticSource interference.
Also removed the xunit attributes from the assembly that prevented parallelization. It's no longer needed as of this change.
Commit migrated from https://github.com/dotnet/corefx/commit/542d85e15bfe5fdeb59d7e6f7fb3b15a08640ebd
One of the HttpClient client tests hangs on a machine with a single core.
xunit by default uses a SynchronizationContext that has N threads to do
work, where N defaults to Environment.ProcessorCount. Thus on a single
core machine, there's only one thread available to run tests, and if that
thread blocks waiting for an async operation that'll schedule work back to
that context, it'll deadlock.
Commit migrated from https://github.com/dotnet/corefx/commit/916798757c122b81e61666c4f0af0c446d378824
- Fix Assert that was throwing in a background thread due to mistmatched type (it was looking explicitly for HttpResponseMessage rather than any type in its inheritance hierarchy, and CurlHandler uses a derived type).
- Update project.json package versions
- Unsubscribe the listener when done with it
Commit migrated from https://github.com/dotnet/corefx/commit/9a8d97852bcce9be0b4b6b5eff5ed87f4e36119e
Added more http tests to open source from the original internal ToF tests. Some of
the tests should be refactored in the future to avoid Assert'ing multiple
logical things.
Fixed up test namespaces for System.Net.Http and
System.Net.Http.WinHttpHandler.
Commit migrated from https://github.com/dotnet/corefx/commit/e5a017cb6ca01e99b1f1462298bc0cbf60c06ee0