* Fix HttpClientHandler ServerCertificateCustomValidationCallback for UWP
This PR implements the ServerCertificateCustomValidationCallback for UWP. While implementing this, I discovered that the behavior of
the current .NET Core code is incorrect regarding how to propagate exceptions from the user provided callback. I opened up a new
issue dotnet/corefx#21904 and revised the test as well.
Fixesdotnet/corefx#21627
* Address more PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/e30fdc38e60f6fa2ed8e7e103d1f8c44655438cd
* Using alternative Oid constructor
This alternative contructor will avoid trigging a potentially costly
lookup for the friendly name associated with the OID.
* Alternative way to lookup OID
This method avoids the AD lookup, while also not making any localization
assumptions
* fix typo
had the wrong OID for Server Auth
* Optional parameter on FromOidValue to disable AD search
New optional parameter on FromOidValue to disable lookup, update server
auth OID lookup in WinHttpCertificateHelper and SecureChannel to use
this new parameter when doing lookup
* Revert "Optional parameter on FromOidValue to disable AD search"
This reverts commit dotnet/corefx@6d0fd6df3d.
* Limit Server Auth OID lookup to local machine
Same change as what was made to SecureChannel class to avoid OID lookup
via AD
* Use alternative OID contructor
Use OID as friendly name to avoid lookup as well as localization issues
Commit migrated from https://github.com/dotnet/corefx/commit/81f80a8a0088d482afdb077b23f21a3e75a1c30c
The WinHTTP team has recommended that we always set the HTTP/2 options
explicitly when setting up the WinHTTP request handle. Future versions
of Windows might adjust the WinHTTP default value for this setting.
So, by always setting the value at the WinHTTP layer, we can ensure
that we have a stable default value at the .NET layer.
Commit migrated from https://github.com/dotnet/corefx/commit/d553cb46c0da91406e55b756160cfa87e2ee2f68
* Add nice messages for assemblies with autogenerated PNSE
* Fix failing builds
* Apply feedback
* Temporary workaround for Microsoft.Win32.Registry which needs using System statement
* Add new resource files
* Temporary workaround for System.Security.Cryptography.Cng which needs using System statement on Unix platforms
* Update BuildTools version and use resource strings for all PNSE messages
* Fix builds
* Fix typo
Commit migrated from https://github.com/dotnet/corefx/commit/00b2a853429c896eb973ffc1bbff04b186ab5d07
To help diagnose pernicious exceptions, this debug-build-only change augments exceptions created using CreateExceptionUsingError to include the calling thread's stack trace, so that when these exceptions are then moved to other threads and propagated there, we can better correlate where they came from.
Commit migrated from https://github.com/dotnet/corefx/commit/2c368e81d9d07f0d40edf36047e5b93e44db200b
WinHttpHandler was incorrectly sending two zero-length chunks (a violation of HTTP protocol)
when POST'ing empty data using chunked encoding. The second zero-length chunk was ok since it
means end of data. The first zero-length chunk was because it was the empty string being encoded.
This was causing problems by sending extra data to WinHTTP and hence to the server. Any
subsequent requests to the server might get mis-understood by the server and the server would then
send back an error. That translated to getting a WinHTTP error (12152)
"The server returned an invalid or unrecognized response".
This is hard to repro except in the HttpListener tests because of the timing of when the extra
zero-length chunk of request data gets sent to the server. There is already an HttpClient unit test
for POSTing zero-length data using chunked encoding. But this but was not triggering this error
due to timing issues. Even the HttpListener test needed to be adjusted to force a consistent repro.
Added asserts to validate the logic of making sure that we don't try to chunk encode zero length
data.
Fixesdotnet/corefx#18869.
Commit migrated from https://github.com/dotnet/corefx/commit/dad35ea3d495798dd04da90dec68230063f1331e
Fixed a test bug in PostAuthHelper which caused the wrong entity-body
semantics to get used during the test. This actually exposed a netfx
bug dealing with ambiguous semantics (Content-Length vs. chunked).
After fixing this test bug, it then exposed a product bug where we
leak an InvalidOperationException that isn't wrapped properly by an
HttpRequestException. The scenario that exposed this related to
POST'ing content that is non-rewindable and having to resubmit the
POST due to authentication challenges. This test was passing on
.NET Core because the test was written using the wrong assumptions.
It failed on .NET Framework which exposed the problem.
The InvalidOperationException comes from when a StreamContent's
SerializeToStreamAsync method is called and the content needs to be rewound.
If the content can't be rewound, then the exception is thrown with the
error message "The stream was already consumed. It cannot be read again."
Updated the WinHttpHandler and CurlHandler to wrap the InvalidOperationException
in an HttpRequestException. Updated the test accordingly.
Fixesdotnet/corefx#17621.
Commit migrated from https://github.com/dotnet/corefx/commit/e7e3c581870787d87393e674db22589ad56e944c
NotSupportedOnTargetFramework was used to explicitly make a package fail
to install (due to ref/lib guardrails check) where it would otherwise
succeed. This is no longer serving its purpose since NuGet removed the
guardrails check. It's also creating a less desireable failure mode:
FileNotFound vs PlatformNotSupported.
Commit migrated from https://github.com/dotnet/corefx/commit/e7533ab2c24728a5937bfb68609e183833359b27
Now instead of Use*Key a project can instead define the assembly key
in the project (genreally the common dir.pops for a project) using
the AssemblyKey property. The accepted values are Open, ECMA, MSFT,
Test.
This change allows for a repo to set the default key they want to use
for projects. In corefx we have switched the default to use the Open
key instead of the old BuildTools default of MSFT key.
As part of this update we are explicitly setting the AssemblyKey in
all the library projects (although it is really only necessary for
projects that aren't the default).
Also with this change we are updating all the new libraries that have
not yet shipped stable (compared to our 1.1 release) and making them
use the Open key. Which means that for prerelease dependencies there
might be some binary breaking changes to consume.
The following libraries ahven't shipped so there key is being
changed from MSFT to Open:
Microsoft.XmlSerializer.Generator
System.CodeDom
System.Configuration.ConfigurationManager
System.Data.Odbc
System.DirectoryServices
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Json
System.Memory
System.Net.HttpListener
System.Net.Mail
System.Net.ServicePoint
System.Net.WebClient
System.Net.WebProxy
System.Private.Xml
System.Private.Xml.Linq
System.Security.Cryptography.Xml
System.Security.Permissions
System.Transactions.Local
System.Web.HttpUtility
Commit migrated from https://github.com/dotnet/corefx/commit/ac09a797d09502ebab61f7167bb856846602e1e6
* Fix MaxResponseHeadersLengthSemantics
The new HttpClientHandler.MaxResponseHeadersLength property is defined differently from the similarly
named WebRequestHandler and HttpWebRequest properties. The units are supposed to be in Kilobytes
(1024 bytes). This problem was discovered while doing .NET Core vs. .NET Framework compat testing.
Fix the semantics to match the existing WebRequestHandler and HttpWebRequest properties. Adjust tests.
Contributes to dotnet/corefx#17691
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/170f7a5ac7f98f2076f0776c573e3188a390d565
* Fix UWP Pinvoke checker condition
* analyzer baselines
* Remove redundant local define
* Remove redundant CA lines
* Special case Registry
* Fix BlockReflectionAttribute
* Replace NETNATIVE with uap define
* baselines
* Disable Pinvoke scan on specific projects
* Disable BlockReflectionAttribute on ilproj
* Revive 2 baselines
* Disable UWP validation on SQlClient
* Convert some defines to `uwp`
* Fix S.N.Primitives baseline
* Remove dead baselines
* Clean up NET_NATIVE defines
* Remove FEATURE_CORECLR except from shared sources
* Change Threading.Thread defines to just uapaot
* Fix comment
* Fix comment 2
* Change serialization uap defines to uapaot
* Rename EnableWinRT to UWPCompatible
* Fix UAP build for Console
* Fix uap condition in XML csproj
* Fix condition in XmlSerializer project
* Replace netcore50
* Remove dead #if
* Redundant console condition
* Redundant console condition2
* Trim baseline
* Revert Console baseline to pre UAP
* Fix MemoryMappedFiles uap build
* Fix S.Linq.Expressions build for UAP by temporarily disabling it
* Fix S.N.Sockets build for uap
* No plans to put SQLClient in UWP
* Fix RuntimeInformation build
* Fix MemoryMappedFiles build for Unix
* Add UWPCompatible to all netstandard versions
* Add EnablePinvokeAnalyzer to disable Pinvoke checking entirely for some reason
* Remove dead System.Xml.XmlSerializer.Tests.settings.targets
* Fix interop services build
* Remove last uap/uapaot define in Xml tests
* PInvoke check doc
* Fix PInvoke casing
* PInvoke file is case sensitive
* Remove unnecessary references to uapaot from projects that don't have uapaot configs
* Remove unnecessary uapaot from S.R.I.RI
* Replace UWPCompatible for TargetGroup in csproj conditions
* Reverse FileSystem edit as not ready to build for UWP
Commit migrated from https://github.com/dotnet/corefx/commit/b1865ea0847a7a86baefe8378b772ecf0b785681