platform/upstream/dotnet/runtime.git
4 years agoMake UriTypeConverter better handle relative URIs (dotnet/corefx#42580)
Eric StJohn [Wed, 13 Nov 2019 22:46:42 +0000 (14:46 -0800)]
Make UriTypeConverter better handle relative URIs (dotnet/corefx#42580)

We missed one case in handling relative URIs:
  ConvertTo(..., relativeUri, typeof(Uri))

Fix this, add tests, and share the UriKind calculation.

Commit migrated from https://github.com/dotnet/corefx/commit/136dba176f62308d701b992857d76ea790fd4631

4 years agoUse Strings.resx file for the exception messages (dotnet/corefx#40402)
Roman Marusyk [Wed, 13 Nov 2019 22:10:55 +0000 (23:10 +0100)]
Use Strings.resx file for the exception messages (dotnet/corefx#40402)

* Use Strings.resx file for the exception messages within  System.Windows.Extensions

* Use Strings resx file for the exception messages within System.Threading

* Use Strings resx file for the exception messages within System.Security.Cryptography.Xml

* Use Strings resx file for the exception messages within System.Runtime.WindowsRuntime

* Use Strings resx file for the exception messages within System.Reflection.Metadata

* Use Strings resx file for the exception messages within System.Private.Xml

* Use Strings resx file for the exception messages within System.Private.DataContractSerialization

* Use Strings resx file for the exception messages within System.Numerics.Tensors

* Use Strings resx file for the exception messages within System.IO.Packaging

* Use Strings resx file for the exception messages within System.IO.FileSystem

* Use Strings resx file for the exception messages within System.Drawing.Common

* Use Strings resx file for the exception messages within System.DirectoryServices

* Use Strings resx file for the exception messages within System.Diagnostics.DiagnosticSource

* Use Strings resx file for the exception messages within System.Composition.Hosting

* Update ExportDescriptorPromise.cs

* Fix build

Commit migrated from https://github.com/dotnet/corefx/commit/1518fdc5cc94571bf3ce1bb95e1a60f789a67f18

4 years agopropagate TLS alerts from OS layers (dotnet/corefx#41967)
Tomas Weinfurt [Wed, 13 Nov 2019 21:50:57 +0000 (13:50 -0800)]
propagate TLS alerts from OS layers  (dotnet/corefx#41967)

* initial alerts with openssl

* get alerts from schannel

* update tests to work with openssl 1.1.x

* fix ClientAsyncAuthenticate_ServerNoEncryption_NoConnect to work properly with Tls13

* remove extra comment

* feedback from review

* feedback from review

* remove unused variable

Commit migrated from https://github.com/dotnet/corefx/commit/784cb6b5b7e947d3a69c7183847652a0e9335ff0

4 years agoImprove diag tracing for NameResolution (dotnet/corefx#42428)
Tomas Weinfurt [Wed, 13 Nov 2019 21:50:14 +0000 (13:50 -0800)]
Improve diag tracing for NameResolution (dotnet/corefx#42428)

* WIP

* update

* update

* update

* cleanup

* fix windows

* disable GetHostEntryAsync_InvalidHost_LogsError on Windows

* feedback from review

Commit migrated from https://github.com/dotnet/corefx/commit/fe68ec506c7e2c5c104f912d8899778d022905d0

4 years agoPrintingServices.Unix.cs thread safety, Issue dotnet/corefx#24268 (dotnet/corefx...
Cody [Wed, 13 Nov 2019 21:18:42 +0000 (13:18 -0800)]
PrintingServices.Unix.cs thread safety, Issue dotnet/corefx#24268 (dotnet/corefx#37724)

* Fix thread-safety of LoadPrinters in PrintingServices.Unix.cs

* Restructure lazy initialization in PrintingServices.Unix.cs

Commit migrated from https://github.com/dotnet/corefx/commit/cf64918877d98577363bb40d5eafac52beb80a79

4 years agoFix NetStandard issue in System.IO.FileSystem.AccessControl in 5.0 (dotnet/corefx...
Carlos Sanchez Lopez [Wed, 13 Nov 2019 20:26:12 +0000 (12:26 -0800)]
Fix NetStandard issue in System.IO.FileSystem.AccessControl in 5.0 (dotnet/corefx#42546)

Fix NetStandard issue in System.IO.FileSystem.AccessControl

We built the fix incorrectly so that it would only apply for netcoreapp3.0 but customer needs it on netstandard2.0 (desktop + core).  Customer impact is that they’ll see a PlatformNotSupported exception rather than the new API.

Commit migrated from https://github.com/dotnet/corefx/commit/70150e6750c35c9a67803e9cddfda7b1db2ec487

4 years agoUpdate CoreLib path for consolidation (dotnet/corefx#42577)
Viktor Hofer [Wed, 13 Nov 2019 19:48:15 +0000 (20:48 +0100)]
Update CoreLib path for consolidation (dotnet/corefx#42577)

Commit migrated from https://github.com/dotnet/corefx/commit/dc6136f34c7d4ebbc493a7bb6cf1d15bc82250e6

4 years ago[master] Update dependencies from 4 repositories (dotnet/corefx#42511)
dotnet-maestro[bot] [Wed, 13 Nov 2019 19:31:28 +0000 (19:31 +0000)]
[master] Update dependencies from 4 repositories (dotnet/corefx#42511)

* Update dependencies from https://github.com/dotnet/arcade build 20191108.11

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.19558.11
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.19558.11
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.19558.11
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.19558.11
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19558.11
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.19558.11
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.19558.11
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.19558.11
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.19558.11
- Microsoft.DotNet.CoreFxTesting - 5.0.0-beta.19558.11
- Microsoft.DotNet.GenAPI - 5.0.0-beta.19558.11
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19558.11
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.19558.11
- Microsoft.DotNet.GenFacades - 5.0.0-beta.19558.11

* Update dependencies from https://github.com/dotnet/core-setup build 20191108.7

- Microsoft.NETCore.App - 5.0.0-alpha.1.19558.7
- Microsoft.NETCore.DotNetHostPolicy - 5.0.0-alpha.1.19558.7
- Microsoft.NETCore.DotNetHost - 5.0.0-alpha.1.19558.7

* Update dependencies from https://github.com/dotnet/corefx build 20191109.1

- runtime.native.System.IO.Ports - 5.0.0-alpha.1.19559.1
- Microsoft.NETCore.Platforms - 5.0.0-alpha.1.19559.1

* Update dependencies from https://github.com/dotnet/standard build 20191108.1

- NETStandard.Library - 2.2.0-prerelease.19558.1

* Update dependencies from https://github.com/dotnet/core-setup build 20191109.5

- Microsoft.NETCore.App - 5.0.0-alpha.1.19559.5
- Microsoft.NETCore.DotNetHostPolicy - 5.0.0-alpha.1.19559.5
- Microsoft.NETCore.DotNetHost - 5.0.0-alpha.1.19559.5

* Update dependencies from https://github.com/dotnet/corefx build 20191109.6

- runtime.native.System.IO.Ports - 5.0.0-alpha.1.19559.6
- Microsoft.NETCore.Platforms - 5.0.0-alpha.1.19559.6

* Update dependencies from https://github.com/dotnet/standard build 20191109.1

- NETStandard.Library - 2.2.0-prerelease.19559.1

* Update dependencies from https://github.com/dotnet/standard build 20191110.1

- NETStandard.Library - 2.2.0-prerelease.19560.1

* Update dependencies from https://github.com/dotnet/arcade build 20191111.8

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.19561.8
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.19561.8
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.19561.8
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.19561.8
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19561.8
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.19561.8
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.19561.8
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.19561.8
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.19561.8
- Microsoft.DotNet.CoreFxTesting - 5.0.0-beta.19561.8
- Microsoft.DotNet.GenAPI - 5.0.0-beta.19561.8
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19561.8
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.19561.8
- Microsoft.DotNet.GenFacades - 5.0.0-beta.19561.8

* Update dependencies from https://github.com/dotnet/core-setup build 20191111.10

- Microsoft.NETCore.App - 5.0.0-alpha.1.19561.10
- Microsoft.NETCore.DotNetHostPolicy - 5.0.0-alpha.1.19561.10
- Microsoft.NETCore.DotNetHost - 5.0.0-alpha.1.19561.10

* Update dependencies from https://github.com/dotnet/corefx build 20191112.1

- runtime.native.System.IO.Ports - 5.0.0-alpha.1.19562.1
- Microsoft.NETCore.Platforms - 5.0.0-alpha.1.19562.1

* React to SourceLink package rename

* Update dependencies from https://github.com/dotnet/arcade build 20191112.5

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.19562.5
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.19562.5
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.19562.5
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.19562.5
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19562.5
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.19562.5
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.19562.5
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.19562.5
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.19562.5
- Microsoft.DotNet.CoreFxTesting - 5.0.0-beta.19562.5
- Microsoft.DotNet.GenAPI - 5.0.0-beta.19562.5
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19562.5
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.19562.5
- Microsoft.DotNet.GenFacades - 5.0.0-beta.19562.5

* Update dependencies from https://github.com/dotnet/core-setup build 20191112.8

- Microsoft.NETCore.App - 5.0.0-alpha.1.19562.8
- Microsoft.NETCore.DotNetHostPolicy - 5.0.0-alpha.1.19562.8
- Microsoft.NETCore.DotNetHost - 5.0.0-alpha.1.19562.8

* Update dependencies from https://github.com/dotnet/corefx build 20191112.8

- runtime.native.System.IO.Ports - 5.0.0-alpha.1.19562.8
- Microsoft.NETCore.Platforms - 5.0.0-alpha.1.19562.8

* Update dependencies from https://github.com/dotnet/standard build 20191112.1

- NETStandard.Library - 2.2.0-prerelease.19562.1

* Fix SQLClient MatchingRefApiCompatBaselines

Now that SQL client no longer builds a netstandard2.0 ref we can't fix
API compat issues with it.  Baseline them instead.  Rename the file
since this is the only active configuration which requires baselining.

Commit migrated from https://github.com/dotnet/corefx/commit/e1bd638024a09174c3de6d5ddc0b4f018372d006

4 years agoRemove unused locals in System.Data.OleDb (dotnet/corefx#42485)
Eriawan Kusumawardhono [Wed, 13 Nov 2019 19:23:52 +0000 (02:23 +0700)]
Remove unused locals in System.Data.OleDb (dotnet/corefx#42485)

* emove unused locals in System.Data.OleDband keep some logic using discard. Partially fix issue dotnet/corefx#39962

* Update src/System.Data.OleDb/src/OleDbDataReader.cs

update as suggested (OleDbDataReader)

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Data.OleDb/src/OleDbTransaction.cs

Done update as suggested

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Data.OleDb/src/RowBinding.cs

Done update as suggested (RowDataBinding)

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Data.OleDb/src/RowBinding.cs

Done as suggested

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Data.OleDb/src/SafeHandles.cs

Done updating as suggested (SafeHandles)

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/eceea8b4284ca42d8bd0134414b43c835bd80e4c

4 years agoSmtpConnection: add _aborted field for debugging SmtpClientTest.TestZeroTimeout hang...
Tom Deseyn [Wed, 13 Nov 2019 15:56:41 +0000 (16:56 +0100)]
SmtpConnection: add _aborted field for debugging SmtpClientTest.TestZeroTimeout hang (dotnet/corefx#42557)

Commit migrated from https://github.com/dotnet/corefx/commit/7d3a7b7fb8fe648c1f402bb63b55f623c3065e42

4 years agoSet values of array and immutable collection properties directly (dotnet/corefx#42420)
Layomi Akinrinade [Wed, 13 Nov 2019 07:08:32 +0000 (23:08 -0800)]
Set values of array and immutable collection properties directly (dotnet/corefx#42420)

* Set values of array and immutable collection properties directly

* Address review feedback

Commit migrated from https://github.com/dotnet/corefx/commit/a528006b4536e5b73227285b57d2a56116532506

4 years agoMove arm jobs to new ArmArch helix queue (dotnet/corefx#42568)
Santiago Fernandez Madero [Wed, 13 Nov 2019 06:01:54 +0000 (22:01 -0800)]
Move arm jobs to new ArmArch helix queue (dotnet/corefx#42568)

Commit migrated from https://github.com/dotnet/corefx/commit/d62c8fe5a32ba889017cdc1f69984bb59a9ee5c0

4 years agoAnnotate System.Transactions.Local for nullable (dotnet/corefx#42465)
buyaa-n [Wed, 13 Nov 2019 05:59:33 +0000 (21:59 -0800)]
Annotate System.Transactions.Local for nullable (dotnet/corefx#42465)

* Annotate System.Transactions.Local for nullable

* Reverting assert on Transaction.State property and make it nullabe

* Small udpates

* Applying feedback

* Applying feedback

* Update src/System.Transactions.Local/src/System/Transactions/Transaction.cs

Co-Authored-By: Santiago Fernandez Madero <safern@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/8f8b895f843e2b659c8a722c3e38548cfecdb271

4 years agoFix exception tests where we are asserting against the literal message (dotnet/corefx...
Layomi Akinrinade [Wed, 13 Nov 2019 05:25:46 +0000 (21:25 -0800)]
Fix exception tests where we are asserting against the literal message (dotnet/corefx#42569)

* Fix up exception tests where we are asserting against the literal message

* Remove null assignments

Commit migrated from https://github.com/dotnet/corefx/commit/dd1892dc53e28b481bfab364a08573214d3df462

4 years agoAdd more test data for str.Replace(char, char) (dotnet/corefx#42521)
Ganbarukamo41 [Wed, 13 Nov 2019 01:02:51 +0000 (10:02 +0900)]
Add more test data for str.Replace(char, char) (dotnet/corefx#42521)

* Add more test data for str.Replace(char, char)

* Add longer strings to verify correctness of vectorised implementation

* Add more test cases for coverage

* Add more test cases for coverage

* Fix test data

* Add test data for different Vector<T> counts

Commit migrated from https://github.com/dotnet/corefx/commit/c43fae9412ed389f20badfa3ed51d5a42251dba2

4 years agoAdd test to verify that JsonEncodedText and Utf8JsonWriter use upper-case hex digits...
Ahson Khan [Wed, 13 Nov 2019 00:10:30 +0000 (16:10 -0800)]
Add test to verify that JsonEncodedText and Utf8JsonWriter use upper-case hex digits when escaping (2). (dotnet/corefx#42566)

* Add test to verify that JsonEncodedText and Utf8JsonWriter use
upper-case hex digits when escaping.

* Add test to verify that JsonEncodedText and Utf8JsonWriter use
upper-case hex digits when escaping.

* Fix spacing issue in expected text.

Commit migrated from https://github.com/dotnet/corefx/commit/6878693e4bdeb509abfdf51ad40a5a1aae46e2e4

4 years agoAdd HashAlgorithm.ComputeHashAsync
Jeremy Barton [Tue, 12 Nov 2019 23:28:59 +0000 (15:28 -0800)]
Add HashAlgorithm.ComputeHashAsync

Commit migrated from https://github.com/dotnet/corefx/commit/ac02476cfd31e0aed74e5ea4c9dd0af3d7b1ef7f

4 years agoSupport For Getting base-64 String as Byte Array (dotnet/corefx#41467)
Anton Landor [Tue, 12 Nov 2019 22:42:27 +0000 (23:42 +0100)]
Support For Getting base-64 String as Byte Array (dotnet/corefx#41467)

* Implemented support for getting Base64 as an equivalent byte array

* New implementation for base-64 support as suggested in review. Added new test cases for it.

* Changed comment

in -> and

Co-Authored-By: Ahson Khan <ahkha@microsoft.com>
* Updated minimum length for TryGetBytesFromBase64 to match minimum length of base-64 string

Co-Authored-By: Günther Foidl <gue@korporal.at>
* Added old Convert.FromBase64String implementation for older platforms. arrayReturnToPool is now cleared before return. Added test cases for edge cases and full branch coverage. Changed magic number to predefined constant.

* Changed catch-all to only catch FormatException. Removed try-finally since it is most likely unnecessary. Now only clears the sliced buffer.

* Changed back to a try-finally solution for readability.

* Using JsonConstants.StackallocThreshold instead of magic number

Co-Authored-By: Ahson Khan <ahkha@microsoft.com>
* Added test to validate TryGetBytesFromBase64(...) gives the corrresulting bytes.

* Allocate to JsonConstants.StackallocThreshold when doing stackalloc

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/6a591b2d24869657094816418c46593337550a32

4 years agoadd QuicConnection.NegotiatedApplicationProtocol stub (dotnet/corefx#42563)
Geoff Kizer [Tue, 12 Nov 2019 21:52:38 +0000 (13:52 -0800)]
add QuicConnection.NegotiatedApplicationProtocol stub (dotnet/corefx#42563)

Commit migrated from https://github.com/dotnet/corefx/commit/e717081e0074a0933a24182917c4c45739b85268

4 years agoProvide more specific exception message when an enumerable or dictionary cannot be...
Layomi Akinrinade [Tue, 12 Nov 2019 21:15:10 +0000 (13:15 -0800)]
Provide more specific exception message when an enumerable or dictionary cannot be instantiated (dotnet/corefx#42497)

* Provide more specific exception message when an enumerable or dictionary cannot be instantiated

* Address review feedback

Commit migrated from https://github.com/dotnet/corefx/commit/961bb667a056bb3b9a5f32e22aed8bb64eaddcad

4 years agoQUIC: Change constructor overloads for passing QuicImplementationProvider (dotnet...
Geoff Kizer [Tue, 12 Nov 2019 20:00:52 +0000 (12:00 -0800)]
QUIC: Change constructor overloads for passing QuicImplementationProvider (dotnet/corefx#42542)

* change constructor overloads for passing QuicImplementationProvider

* add and use QuicImplementationProviders.Default

* Update src/System.Net.Quic/src/System/Net/Quic/QuicImplementationProviders.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/460c422dc82f2a80cba8f1a900000e199f1bf02a

4 years agoRe-enable PKCSdotnet/corefx#1 decryption tests
Jeremy Barton [Tue, 12 Nov 2019 18:39:41 +0000 (10:39 -0800)]
Re-enable PKCSdotnet/corefx#1 decryption tests

Commit migrated from https://github.com/dotnet/corefx/commit/08f186eefe3272a5668775e4c47f19f3e390557f

4 years agoadd MaskedTextProviderTests (dotnet/corefx#7758) (dotnet/corefx#42513)
devtwogenies [Tue, 12 Nov 2019 17:53:17 +0000 (20:53 +0300)]
add MaskedTextProviderTests (dotnet/corefx#7758) (dotnet/corefx#42513)

* add MaskedTextProviderTests(dotnet/corefx#7758)

* Code review issues are fixed

Commit migrated from https://github.com/dotnet/corefx/commit/ff3e0409ea6f626696e0d440d05a8d44fefdc344

4 years agoFix all configurations build break on SqlClient (dotnet/corefx#42548)
Santiago Fernandez Madero [Tue, 12 Nov 2019 03:41:12 +0000 (19:41 -0800)]
Fix all configurations build break on SqlClient (dotnet/corefx#42548)

Commit migrated from https://github.com/dotnet/corefx/commit/63c85b9de80d101262be231ec9c33a915b2013c4

4 years agoHTTP/2 code sharing shell sync-script (dotnet/corefx#42425)
Günther Foidl [Mon, 11 Nov 2019 23:57:25 +0000 (00:57 +0100)]
HTTP/2 code sharing shell sync-script (dotnet/corefx#42425)

Commit migrated from https://github.com/dotnet/corefx/commit/cb5be3e9c76c337cb1752b206a50ffc71947aba1

4 years agoFix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/corefx...
Stephen Toub [Mon, 11 Nov 2019 23:49:48 +0000 (18:49 -0500)]
Fix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/corefx#42531)

Commit migrated from https://github.com/dotnet/corefx/commit/88f40addc220c73794f962f10d288c20c416ede1

4 years agoFix NegotitateStream (server) on Linux for NTLM (dotnet/corefx#42522)
David Shulman [Mon, 11 Nov 2019 23:49:41 +0000 (15:49 -0800)]
Fix NegotitateStream (server) on Linux for NTLM (dotnet/corefx#42522)

This PR is a follow up to PR dotnet/corefx#36827 which added support for Linux server-side
GSS-API (AcceptSecContext). This enabled NegotitateStream AuthenticateAsServer*
support. It also provided support for ASP.NET Core to allow Kestrel server to have
Negotiate authentication on Linux.

This PR fixes some problems with Negotiate (SPNEGO) fallback from Kerberos to NTLM.
Notably it passes in a correct GSS Acceptor credential so that fallback will work
correctly. As part of fixing that, I noticed some other problems with returning the
user-identity when NTLM is used.

This was tested in a separate enterprise testing environment that I have created.
It builds on technologies that we have started using like docker containers and Azure
pipelines (e.g. HttpStress). The environment is currently here:
https://dev.azure.com/systemnetncl/Enterprise%20Testing. The extra Kerberos tests
and container support is here: https://github.com/davidsh/networkingtests

When the repo merge is completed, I will work with the infra team to see what things
can be merged back into the main repo/CI pipeline and migrate the test sources to an
appropriate place in the new repo.

Contributes to dotnet/corefx#10041
Contributes to dotnet/corefx#24707
Contributes to dotnet/corefx#30150

Commit migrated from https://github.com/dotnet/corefx/commit/1054f1fba1b7222c138dcd20d8da80cd893fdd01

4 years agoRewind the Windows 10 PFX unreadable key point to RS1.
Jeremy Barton [Mon, 11 Nov 2019 21:52:25 +0000 (13:52 -0800)]
Rewind the Windows 10 PFX unreadable key point to RS1.

Commit migrated from https://github.com/dotnet/corefx/commit/6d111f30bc014793f4a676dee5b2451fcd25e4eb

4 years agoFix a "data too small" error in PasswordBasedEncryption
Jeremy Barton [Mon, 11 Nov 2019 20:52:44 +0000 (12:52 -0800)]
Fix a "data too small" error in PasswordBasedEncryption

Found during the Unix PFX reader/writer work, but wasn't directly relevant to that change.

Commit migrated from https://github.com/dotnet/corefx/commit/2d713265d5aecd5fe34099042e13fe7ba54dcdd1

4 years agomoping up the 10.0.16300 version (dotnet/corefx#42537)
Anirudh Agnihotry [Mon, 11 Nov 2019 19:53:58 +0000 (11:53 -0800)]
moping up the 10.0.16300 version (dotnet/corefx#42537)

Commit migrated from https://github.com/dotnet/corefx/commit/5683beb656f8ea3d24635445258662abdcd3de22

4 years agoBumping the assembly version to 5.0.0.0 (dotnet/corefx#41723)
Anirudh Agnihotry [Mon, 11 Nov 2019 18:43:58 +0000 (10:43 -0800)]
Bumping the assembly version to 5.0.0.0 (dotnet/corefx#41723)

* bumping the assembly Version

* correcting the resx file

* keeping netfx for oleDb

* fiixing the netfx tests as well

* fixing the DataSetExtensionsVersion

* removing netstandard2.0 from ref in datasetextensions

Commit migrated from https://github.com/dotnet/corefx/commit/9a4ed0d00bc642b015974684c32b00650426429f

4 years agoValidate member attributes (dotnet/corefx#42427)
Eric StJohn [Mon, 11 Nov 2019 18:24:28 +0000 (10:24 -0800)]
Validate member attributes (dotnet/corefx#42427)

* Fix APICompat issues for member attributes

* Addressing more member attribute diffs

* Fix SQLClient build

Commit migrated from https://github.com/dotnet/corefx/commit/33d0499898434aa2d57e8326317e3d6f6c6401ac

4 years agoRead ParentProcessId from kinfo_proc for FreeBSD (dotnet/corefx#42517)
Adeel Mujahid [Mon, 11 Nov 2019 16:55:54 +0000 (18:55 +0200)]
Read ParentProcessId from kinfo_proc for FreeBSD (dotnet/corefx#42517)

* Read ParentProcessId from kinfo_proc for FreeBSD

* Update src/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/7ff22479f523ea468577daf6819005458f475064

4 years agoAdd runtime id for Arch Linux
Omair Majid [Mon, 11 Nov 2019 15:12:57 +0000 (10:12 -0500)]
Add runtime id for Arch Linux

Like gentoo, Arch Linux is a rolling release and doesn't have explicit
version numbers.

    $ cat /etc/os-release
    NAME="Arch Linux"
    PRETTY_NAME="Arch Linux"
    ID=arch
    BUILD_ID=rolling
    ANSI_COLOR="0;36"
    HOME_URL="https://www.archlinux.org/"
    DOCUMENTATION_URL="https://wiki.archlinux.org/"
    SUPPORT_URL="https://bbs.archlinux.org/"
    BUG_REPORT_URL="https://bugs.archlinux.org/"
    LOGO=archlinux

Commit migrated from https://github.com/dotnet/corefx/commit/1f08b57bfd197a5492fe2ed0e0c5b2e6de9bf642

4 years agoRemove unnecessary assert in File_Move_Multiple_From_Watched_To_Unwatched_Mac (dotnet...
Jan Jahoda [Mon, 11 Nov 2019 15:09:04 +0000 (16:09 +0100)]
Remove unnecessary assert in File_Move_Multiple_From_Watched_To_Unwatched_Mac (dotnet/corefx#42527)

* Remove unnecessary check

* re-enable tests

Commit migrated from https://github.com/dotnet/corefx/commit/42c12be146397e671dd54509e824a79a1f8cc3f7

4 years agofix sockets tests on FreeBSD (dotnet/corefx#42518)
Tomas Weinfurt [Sun, 10 Nov 2019 04:45:23 +0000 (20:45 -0800)]
fix sockets tests on FreeBSD (dotnet/corefx#42518)

Commit migrated from https://github.com/dotnet/corefx/commit/bc115700c3ece60acd6b8dbe4b0bdb8f6f80c756

4 years agofix and enable FileSystemWatcher_File_Rename_NotAffectEachOther test (dotnet/corefx...
Tomas Weinfurt [Sat, 9 Nov 2019 20:54:06 +0000 (12:54 -0800)]
fix and enable FileSystemWatcher_File_Rename_NotAffectEachOther test (dotnet/corefx#42430)

* fix and enable FileSystemWatcher_File_Rename_NotAffectEachOther test

* throw on exception

* revert change to FileSystemWatcher_Unix_DoesNotLeak

* update

Commit migrated from https://github.com/dotnet/corefx/commit/b551a6c767551c2286c3fe726a80366fecd09a68

4 years agoenable FileSystem.Watcher on FreeBSD (dotnet/corefx#42488)
Tomas Weinfurt [Sat, 9 Nov 2019 20:53:06 +0000 (12:53 -0800)]
enable FileSystem.Watcher on FreeBSD (dotnet/corefx#42488)

Commit migrated from https://github.com/dotnet/corefx/commit/c88cb6e29e831097d6072a4ca467f6c890364627

4 years agoMake ServiceBase.Dispose safer by avoiding double free (dotnet/corefx#42472)
Ganbarukamo41 [Sat, 9 Nov 2019 20:52:40 +0000 (05:52 +0900)]
Make ServiceBase.Dispose safer by avoiding double free (dotnet/corefx#42472)

* Make Dispose safer by avoiding double free
* Use Interlocked.Exchange to avoid double freeing in multi-threading situations

* Remove _handleName field from ServiceBase
* This removes the _handleName field which holds the pointer to the service name, allocated in unmanaged heap. This is done to avoid having a central string that gets disposed of when the object is disposed, since having a central one might lead to dangling pointer if Dispose is called in other threads while in use. Instead, we allocate and deallocate unmanaged strings inside the interop methods.

* Make SERVICE_TABLE_ENTRY entirely manually marshalled
* Refactor the method to use Span<T> where possible
* Also fix a bug that may result in freeing arbitrary pointers

* Apply suggestions

* Don't use Marshal.SizeOf when manually marshalling
* use services.Length instead for readability
* use Span<T>.Clear to clear out the span beforehand

Co-Authored-By: jkotas <jkotas@microsoft.com>
* Attempt to free all the pointers in the list
* Passing IntPtr.Zero to Marshal.FreeHGlobal is a documented no-op. I don't think it is possible; but this change attempts to free every strings just in case there could be a string past a null element.

* Apply suggestions

Commit migrated from https://github.com/dotnet/corefx/commit/6bc6994074cd96dddb74ce014da63e9d0404859f

4 years ago[master] Update dependencies from dotnet/coreclr (dotnet/corefx#42443)
dotnet-maestro[bot] [Sat, 9 Nov 2019 20:33:43 +0000 (20:33 +0000)]
[master] Update dependencies from dotnet/coreclr (dotnet/corefx#42443)

* Arm64: Update reference assembly for ReverseBitOrder

* Arm64: Update reference assembly for AddAcross

* Add UnzipEven & UnzipOdd

* Add Ziplow & ZipHigh

* Expose and test MemoryExtensions.Sort

* Improve diagnostics from failing SendRecvIovMaxTcp_Success test

* Update dependencies from https://github.com/dotnet/coreclr build 20191109.4

Commit migrated from https://github.com/dotnet/corefx/commit/2e513ecac65f5a3fa9433df6f267544435914611

4 years agodisable two unreliable testson OSX (dotnet/corefx#42514)
Tomas Weinfurt [Sat, 9 Nov 2019 19:10:34 +0000 (11:10 -0800)]
disable two unreliable testson OSX (dotnet/corefx#42514)

Commit migrated from https://github.com/dotnet/corefx/commit/05b48811119ca6bd681adae94011b9bee8fa04f1

4 years agoClean up after CurlHandler removal (dotnet/corefx#42506)
Stephen Toub [Sat, 9 Nov 2019 13:19:42 +0000 (08:19 -0500)]
Clean up after CurlHandler removal (dotnet/corefx#42506)

Also fix some stragglers from the netfx and uap handler removals.

Commit migrated from https://github.com/dotnet/corefx/commit/c63fbb73226ae3de3ee38d9b25de24ed3e41b6e2

4 years agoFix EventWaitHandle/Mutex/Semaphore name max length unit tests failure
carlossanlop [Fri, 8 Nov 2019 22:07:01 +0000 (14:07 -0800)]
Fix EventWaitHandle/Mutex/Semaphore name max length unit tests failure

Commit migrated from https://github.com/dotnet/corefx/commit/87b899d5be2c95858637ab82e936770019b8a00f

4 years agoStackTrace.GetFrames should return an array of non-nullable frames (dotnet/corefx...
Joseph Musser [Sat, 9 Nov 2019 05:49:49 +0000 (00:49 -0500)]
StackTrace.GetFrames should return an array of non-nullable frames (dotnet/corefx#42490)

Commit migrated from https://github.com/dotnet/corefx/commit/531ec92a9cf34256208d2818950d88b36dd1a2fc

4 years agoHarden Decrypt_WrongKey tests.
Jeremy Barton [Sat, 9 Nov 2019 05:49:10 +0000 (21:49 -0800)]
Harden Decrypt_WrongKey tests.

This moves the 1 in 100,000 failure rate for the PKCS1 test to 1 in 3e19.

Commit migrated from https://github.com/dotnet/corefx/commit/e8a768dfe32cc8e2741e2a012a22ae9d8c479073

4 years agoUpdate compat pack to depend on WCF latest stable version and give ability to depend...
Santiago Fernandez Madero [Sat, 9 Nov 2019 03:32:41 +0000 (19:32 -0800)]
Update compat pack to depend on WCF latest stable version and give ability to depend on external non-stable packages (dotnet/corefx#42464)

* Update compat pack to depend on WCF latest stable version and give hability to depend on external non-stable packages

* Fix two issues found when diffing nuspecs

Commit migrated from https://github.com/dotnet/corefx/commit/b7e6f391041286c89e0eca3104a9b48c43fb30ee

4 years agoUse helix SDK bootstrapping for package testing and use repo one locally (dotnet...
Santiago Fernandez Madero [Sat, 9 Nov 2019 00:58:10 +0000 (16:58 -0800)]
Use helix SDK bootstrapping for package testing and use repo one locally (dotnet/corefx#42496)

Commit migrated from https://github.com/dotnet/corefx/commit/edcbf94941121022162b2e3085cada121861d54e

4 years agoimprove network stats on freebsd (dotnet/corefx#42484)
Tomas Weinfurt [Fri, 8 Nov 2019 22:54:20 +0000 (14:54 -0800)]
improve network stats on freebsd (dotnet/corefx#42484)

Commit migrated from https://github.com/dotnet/corefx/commit/dfb3c9efb7773376e022e4cc35e64a5628a60137

4 years agoCleanup MSBuild conditional operators to be all in lowercase (dotnet/corefx#42491)
Santiago Fernandez Madero [Fri, 8 Nov 2019 22:43:17 +0000 (14:43 -0800)]
Cleanup MSBuild conditional operators to be all in lowercase (dotnet/corefx#42491)

Commit migrated from https://github.com/dotnet/corefx/commit/ab01852685e659a685af2ace33af5b3cefdf8430

4 years agoRemove CurlHandler fallback from HttpClientHandler (dotnet/corefx#42451)
Marie Píchová [Fri, 8 Nov 2019 22:09:47 +0000 (23:09 +0100)]
Remove CurlHandler fallback from HttpClientHandler (dotnet/corefx#42451)

* Removed native curl usage and CurlHandler.

* More CURL removal in test code.

* More test fixing.

* Addressing PR comments

* Comments and typos.

* Removed constant bool fields with all occurences.

Commit migrated from https://github.com/dotnet/corefx/commit/8888c74e34f9a7df060258664dffe7ac29916443

4 years agoUse a custom PFX reader/writer on Unix OSes
Jeremy Barton [Fri, 8 Nov 2019 20:34:38 +0000 (12:34 -0800)]
Use a custom PFX reader/writer on Unix OSes

This change moves PFX import and export primarily into managed code to work around inconsistencies across the operating systems.

Current issues:
* Linux
  * Reading
    * PKCS12_parse doesn't support multiple cert-with-keys.
    * PKCS12_parse doesn't support reading a PFX with no MAC.
    * OpenSSL 1.0 had a weird bug where an ECDSA cert inexplicably didn't match to its key.
  * Writing
    * PKCS12_create doesn't support multiple cert-with-keys.
    * PKCS12_create doesn't support writing empty collections.
* macOS
  * Reading
    * Either SecItemImport does not understand the NULL (vs Empty) password, or we called it wrong... it/we cannot load a PFX which is MACd with the NULL password.
    * SecItemImport can only support "normalized" PFXes, where "normalized" means "how Windows XP would have written it":
      * PFX
        * SafeContents0 (no encryption) (won't load keys from an encrypted SafeContents, IIRC)
          * ShroudedKey0 (won't load keys from KeyBag (unencrypted), only ShroudedKeyBag (encrypted))
          * ...
          * ShroudedKeyN
        * SafeContents1 (encrypted) (won't load certs from an unencrypted SafeContents, IIRC)
          * Cert0
          * ...
          * CertM
       * MAC
         * AlgId: HMAC-SHA-1 (IIRC this was a requirement, but it's also the only allowed algorithm on Win7 or Win8.1...)
  * Writing
    * SecItemExport fails to create a PFX with only public keys (or, at least, with non-keychain-based certificates).
    * SecItemExport fails to create a PFX where some elements are in different keychains than others (including "some elements are not in a keychain").

This change moves the necessary ASN types from the Pkcs12 library into Common so they're shared between Pkcs12Info/Pkcs12Builder and X509Certificates, then uses a managed loader and managed writer.

Quirks:
* SecItemImport(PKCS8) doesn't support marking keys as non-exportable, so non-exportable keyloads on macOS read a PFX, write a normalized PFX in memory, then call SecItemImport(PKCS12).
  * Because one of the failure modes of SecItemImport(PKCS12) is that it returns certs without private keys associated, it's not possible to call SecItemImport first and fall back to the managed loader.
* Windows and Linux both will happily return the wrong private key with a cert if the PFX says to do so, but on macOS the SecIdentityRef creation fails and the cert comes back with no private key.
  * This isn't a very realistic situation outside of our tests, so it's not something worth doing heroics for right now.  The easiest answer is to make HasPrivateKey be true but the GetPrivateKey methods throw... but that's still different than the other platforms, and would be very weird with SslStream.

Commit migrated from https://github.com/dotnet/corefx/commit/1338e4e8a542c3b3e20d99e544e09860f23e99ea

4 years agoAdd CodeGenerator tests and fix NREs/bugs (dotnet/corefx#40838)
Hugh Bellamy [Fri, 8 Nov 2019 17:09:40 +0000 (17:09 +0000)]
Add CodeGenerator tests and fix NREs/bugs (dotnet/corefx#40838)

* Add CodeGenerator tests and fix NREs/bugs

* Reverting empty collection checks

* Small typo

* Skipping tests on full framework

* Some more need to be skipped on framework

* Fix test failure

* Adding format for ToString

Commit migrated from https://github.com/dotnet/corefx/commit/7c867c2fa7887327521f57e3a64b34754d68e390

4 years agoAdd temporary QUIC internal implementation abstraction (dotnet/corefx#42432)
Geoff Kizer [Fri, 8 Nov 2019 16:39:44 +0000 (08:39 -0800)]
Add temporary QUIC internal implementation abstraction (dotnet/corefx#42432)

Commit migrated from https://github.com/dotnet/corefx/commit/1ab8b616f0b622265c0911484e9794858047a748

4 years agoremove throw in exception handling of dispose (dotnet/corefx#42457)
Yuki Wong [Fri, 8 Nov 2019 13:15:37 +0000 (05:15 -0800)]
remove throw in exception handling of dispose (dotnet/corefx#42457)

Commit migrated from https://github.com/dotnet/corefx/commit/790785ac053e01f47ac42fa86378f1e8710ac4d6

4 years agoHttpResponseHeaders validates trailing headers by names (dotnet/corefx#42229)
Alexander Nikolaev [Fri, 8 Nov 2019 12:41:11 +0000 (13:41 +0100)]
HttpResponseHeaders validates trailing headers by names (dotnet/corefx#42229)

HttpResponseMessage.TrailingHeaders property is set to a new special instance of HttpResponseHeaders configured to validate trailing headers based on their names instead of types. When a header is being added via an explicit Add call, it checks the header type for the NonTrailing flag indicating a prohibited trailing header and throws an exception if it is found. In contrast, when a header arrives on the wire and is being added with TryAddWithoutValidation call, no extra check is performed because HttpConnection validates trailing headers in this scenario.
Fixes dotnet/corefx#41262

Commit migrated from https://github.com/dotnet/corefx/commit/805d06affd41715db4fb6102e05345d6323fcdf1

4 years agoAdd EventWaitHandle creation extension method that takes an ACL (dotnet/corefx#42213)
Carlos Sanchez Lopez [Fri, 8 Nov 2019 03:37:03 +0000 (19:37 -0800)]
Add EventWaitHandle creation extension method that takes an ACL (dotnet/corefx#42213)

* Add EventWaitHandle creation extension method that takes an ACL

* Call OpenExisting, add basic unit tests, move MAX_PATH in csproj for all Windows platforms, ensure same exceptions are thrown in both netcore and netfx.

* Address suggestions: using for the created handle, simplify try finally, merge methods, remove an unnecessary Debug.Assert

* simplify using, reorganize PInvokes a bit, let VS format resx as it expects it, remove BOM from csproj

* Add more unit tests

* Save basic access rights in a constant, generate name randomly

* Use FullControl (EVENT_ALL_ACCESS); update unit tests to use EventWaitHandleRights

* Apply suggestion of creating an EWH, then replacing its SWH.

* Remove using causing chaos, add more unit tests, remove null string unit test.

* spacing

* Address comments

* Remove unnecessary checks/exceptions, update unit tests

* Fix netfx x86 ut failure - different exception for mode validation.

* Small documentation fix

* Remove documentation for exception thrown with null security

* more documentation fixes

* New file for unit tests

* Dispose and remove windows only attributes in tests

* suggestion to not use var

* Remove duplicate resx after merge

* Readd cs files lost during merge

* Remove resx modification since it was untouched for this PR

* Address test comments

Commit migrated from https://github.com/dotnet/corefx/commit/14b0893b7aa8099711cceb908b42f6d5cbb9cd5c

4 years agoAdd Semaphore creation extension methods that take an ACL (dotnet/corefx#42377)
Carlos Sanchez Lopez [Fri, 8 Nov 2019 00:27:37 +0000 (16:27 -0800)]
Add Semaphore creation extension methods that take an ACL (dotnet/corefx#42377)

Approved API Proposal: dotnet/corefx#41662

Description
We don't currently have a way to create a Semaphore with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.

Customer impact
Before this change, customers had to create a Semaphore, then set its ACLs. This presents a few problems:
- Potential security hole as semaphores can be accessed between creation and modification.
- Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Semaphore and ensuring the provided ACLs are set during creation.

Commit migrated from https://github.com/dotnet/corefx/commit/3a9a6dbca3a04190fcf8bb8fd6dee960e79679c5

4 years agoImplement SequenceReader.TryPeek(long offset, out T value) (dotnet/corefx#42364)
Marco Rossignoli [Thu, 7 Nov 2019 18:31:48 +0000 (19:31 +0100)]
Implement SequenceReader.TryPeek(long offset, out T value) (dotnet/corefx#42364)

* implement trypeek offset

* updates

* address PR feedback

* amend comments

Commit migrated from https://github.com/dotnet/corefx/commit/43d30a1184fda891d53062b42f7b4fd8f5303e06

4 years agoSpecial case strings in System.Linq.Enumerable.OrderBy (dotnet/corefx#42286)
Paul Westcott [Thu, 7 Nov 2019 10:59:13 +0000 (21:59 +1100)]
Special case strings in System.Linq.Enumerable.OrderBy (dotnet/corefx#42286)

* Special case strings in OrderBy

* Style change to be more inline with code base, as per review

* Added OrderBy Culture test

* Added different culture OrderBy.ElementAt

* Make the tests Windows specific due to potential unicode ordering differences

* Made sorted result set dynamic due to different culturing sorting of different OSes

* Removed conditional

* Use of ThreadCultureChange, fixed Assert argument ordering

* Delousing...

Commit migrated from https://github.com/dotnet/corefx/commit/749fcdea9873d88c182ad94aef83290e96f95ff1

4 years agoRemove root cross folder in favor of eng/common/cross (dotnet/corefx#42434)
Viktor Hofer [Thu, 7 Nov 2019 10:32:29 +0000 (11:32 +0100)]
Remove root cross folder in favor of eng/common/cross (dotnet/corefx#42434)

* Manual darc update from build '20191106.10'

* Remove root cross folder in favor of common/cross

Commit migrated from https://github.com/dotnet/corefx/commit/f9eb7fdbdfbde3bfc525c3be3a67713b3f5a75a1

4 years agoUpdate azure pipelines to account for paths in consolidated repo (dotnet/corefx#42418)
Santiago Fernandez Madero [Thu, 7 Nov 2019 07:07:26 +0000 (23:07 -0800)]
Update azure pipelines to account for paths in consolidated repo (dotnet/corefx#42418)

Commit migrated from https://github.com/dotnet/corefx/commit/94a60d5238f654ab22f162ad3d6dac01adcdaeb8

4 years agoVectorise BitArray (dotnet/corefx#41896)
Ganbarukamo41 [Thu, 7 Nov 2019 05:58:11 +0000 (14:58 +0900)]
Vectorise BitArray (dotnet/corefx#41896)

* Speed up BitArray

1. Use AVX2, if available, for And/Or/Xor
2. Vectorize Not
3. Use Span<T>.Fill() for SetAll()
4. Add more test sizes to account for And/Or/Xor/Not loop unrolling cases

* Vectorise BitArray(bool[])

* Vectorise BitArray further

* Vectorise CopyTo(Array, int) when copying to a bool[]

* Use Vector128/256.Create and store it in static readonly field instead of loading from PE header

* Add some random test data for BitArray

Commit migrated from https://github.com/dotnet/corefx/commit/a4f04476ea74c61a52168cf0b31c0281822ecad3

4 years agoFix CompilerResults.CompiledAssembly in .NET Core (dotnet/corefx#39609)
Hugh Bellamy [Thu, 7 Nov 2019 04:38:19 +0000 (04:38 +0000)]
Fix CompilerResults.CompiledAssembly in .NET Core (dotnet/corefx#39609)

Fix CompilerResults.CompiledAssembly in .NET Core

Commit migrated from https://github.com/dotnet/corefx/commit/8ebc9bb07f72a3d7807a8b1fc4876cb851ef927f

4 years agoclose _eventStream when stopping watcher (dotnet/corefx#41013)
Tomas Weinfurt [Thu, 7 Nov 2019 02:08:59 +0000 (18:08 -0800)]
close _eventStream when stopping watcher (dotnet/corefx#41013)

* close _eventStream when stopping watcher

* feedback from review

* pull in ResourceLimits

* add test for leaking handle

* fix typo

* force run for finalizers

Commit migrated from https://github.com/dotnet/corefx/commit/dd4fa0d723ed6c9f08ed32540c688640b34c6e8a

4 years agoAdd Mutex creation extension methods that take an ACL (dotnet/corefx#42281)
Carlos Sanchez Lopez [Thu, 7 Nov 2019 01:05:31 +0000 (17:05 -0800)]
Add Mutex creation extension methods that take an ACL (dotnet/corefx#42281)

Approved API Proposal: dotnet/corefx#41662

Description
We don't currently have a way to create a Mutex with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.

Customer impact
Before this change, customers had to create a Mutex, then set its ACLs. This presents a few problems:

Potential security hole as mutexes can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Mutex and ensuring the provided ACLs are set during creation.

Commit migrated from https://github.com/dotnet/corefx/commit/46edc58620f29557e23fea29ed8392a0f2c9e31c

4 years agoFix path in detection logic to be absolute (dotnet/corefx#42417)
Viktor Hofer [Thu, 7 Nov 2019 00:45:55 +0000 (01:45 +0100)]
Fix path in detection logic to be absolute (dotnet/corefx#42417)

Commit migrated from https://github.com/dotnet/corefx/commit/475778fa982064e26a8b3a5d7545112f6586ac61

4 years agoDirectory move fix (dotnet/corefx#40570)
Jacob Lalonde [Wed, 6 Nov 2019 23:30:38 +0000 (18:30 -0500)]
Directory move fix (dotnet/corefx#40570)

* Fix to support case-insensitive directory moving/renaming

* More tests for other directories

* Include throwing win32 exp upon directory already existing

* Added ) that I dropped in previous rebase

* Directory get with pattern to check for case sensitivity

* Error message fix

* Rework to support multiple edge cases

* Rework to only support moving to the same directory case insentivity

* Handle situations for case-sensitive file systems

* Test changes

* Stopped modifying environment's current directory

* Cleanup, and tests for drive differences

* Only set route to lower, but only only compare roots ordinally

* Add additional if to check if any directory with that name exists

* Edit to what path to use

* Use destination path.

* Rework file directory scan

* Make utility function due to Any() with empty returning true

* Get the full path before getting the filename

* Check if the directory name is null or empty

* Removed extra line

* Now Defering to the OS for if the directory already exists

* Remove extra semi-colon

* Test Edit

* Comment edit

* Actually test the functionality the test is built for

* Remove platform specific tests and make them platform agnostic

* Target only OSX

* Target all platforms other than linux itself

* Changed how we detect case variants

* Remove unix specific test

* Convert OSX test into no-op test

* Code review feedback and additional tests

* Case-Sensitive file systems specific tests

* Fix to not include osx with other unixes

* Removed a ,

Commit migrated from https://github.com/dotnet/corefx/commit/e9ce2f734698ab5bf13f947c281fa4bec67b0216

4 years agoCentralize fix for nullability annotations in netstandard builds (dotnet/corefx#42391)
Eirik Tsarpalis [Wed, 6 Nov 2019 23:10:27 +0000 (23:10 +0000)]
Centralize fix for nullability annotations in netstandard builds (dotnet/corefx#42391)

* centralize fix for nullability in netstandard2.0

* remove project property from conditional

* Revert "remove project property from conditional"

This reverts commit dotnet/corefx@ffc54a15a4589381b3bd78aa5b3ef020c8a1c75e.

* move to Directory.Build.targets

* Add netcoreapp2.x check

* update logic for projects that use nullable annotations without it being enabled

* add nullable property to System.Data.SqlClient

* address newly added annotated project

* add nullable annotations to System.Security.Cryptography.Pkcs

Commit migrated from https://github.com/dotnet/corefx/commit/e52be6965496af9de49de585e6c62bdb0915c775

4 years agoMove tryrun out of cross to Unix Native build (dotnet/corefx#42411)
Viktor Hofer [Wed, 6 Nov 2019 21:58:04 +0000 (22:58 +0100)]
Move tryrun out of cross to Unix Native build (dotnet/corefx#42411)

* Move tryrun out of cross to Unix Native build

* Add full path and delete android tryruns

Commit migrated from https://github.com/dotnet/corefx/commit/3c4cad0c2908ecbb63f390036b235cb0584ad5c8

4 years agoSystem.Native: Add deployment target version for OSX (dotnet/corefx#42412)
Alexander Köplinger [Wed, 6 Nov 2019 19:01:11 +0000 (20:01 +0100)]
System.Native: Add deployment target version for OSX (dotnet/corefx#42412)

As noticed in https://github.com/dotnet/corefx/pull/42408 we don't pass any minimum OSX target version to CMake.
This means it falls back to the host version, e.g. if you build on Mojave it would pass `-mmacosx-version-min=10.14` to the compiler.

.NET Core's minimum supported OSX version is 10.13 so pass that to CMake.

Commit migrated from https://github.com/dotnet/corefx/commit/e9a2f96d5ce2d7f79d183aa07078983d95590390

4 years agoPhysicalAddress.Parse case-insensitive and support new formats (dotnet/corefx#41696)
Mitch Valenta [Wed, 6 Nov 2019 18:14:33 +0000 (10:14 -0800)]
PhysicalAddress.Parse case-insensitive and support new formats (dotnet/corefx#41696)

* Add parsing support for PhysicalAddresses with colon delimiter and lowercasing

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/0d2969f69c36e8d131f4620cc172b6a7c3840fc8

4 years agoReduce intrinsic converters (dotnet/corefx#42300)
Eric StJohn [Wed, 6 Nov 2019 16:46:25 +0000 (08:46 -0800)]
Reduce intrinsic converters (dotnet/corefx#42300)

* Replace IntrinsicTypeConverters with attributes

We're seeing various places where folks took dependencies on attributes
being present rather than calling GetConverter (WPF and Winforms design
time components).  Now we can add TypeConverter attribute in more places
as we pushed the type down.  Do this rather than relying on the
intrinsic converter table.

* Add Tests that cover TypeConverter mapping

Commit migrated from https://github.com/dotnet/corefx/commit/466fcb0dbb05d4d6fc4639719e0a993a9f74f76b

4 years agoSystem.Native: Make configure.cmake checks work for iOS (dotnet/corefx#42408)
Alexander Köplinger [Wed, 6 Nov 2019 15:09:40 +0000 (16:09 +0100)]
System.Native: Make configure.cmake checks work for iOS (dotnet/corefx#42408)

Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK,
the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it.
The compiler raises a warning when using an unsupported API, turn that into an error so `check_symbol_exists()`
can correctly identify whether the API is supported on the target.

This fixes compile errors after https://github.com/dotnet/corefx/pull/37583 was merged since `clonefile()` is iOS10+.

Replace usages of `check_function_exists()` since it only tests for existence of functions and the CMake docs
recommend using `check_symbol_exists()`: https://cmake.org/cmake/help/v3.15/module/CheckFunctionExists.html

Commit migrated from https://github.com/dotnet/corefx/commit/879127eb87346200b4ddf40a7fce96e79ec211fe

4 years agoFix Copy_LargeMultiDimensionalArray test bug (dotnet/corefx#42403)
Jan Kotas [Wed, 6 Nov 2019 15:02:39 +0000 (07:02 -0800)]
Fix Copy_LargeMultiDimensionalArray test bug (dotnet/corefx#42403)

Commit migrated from https://github.com/dotnet/corefx/commit/ba6da4698caeda5e56d4b09b84f3be872eed470d

4 years agoadjust nightly builds to PST (dotnet/corefx#42405)
Eirik Tsarpalis [Wed, 6 Nov 2019 13:05:13 +0000 (13:05 +0000)]
adjust nightly builds to PST (dotnet/corefx#42405)

Commit migrated from https://github.com/dotnet/corefx/commit/8d5c5f548deafb7cd5e6428f12152c339c672228

4 years agoRevert tryrun.cmake changes that brought coreclr's tryrun stuff (dotnet/corefx#42397)
Santiago Fernandez Madero [Wed, 6 Nov 2019 09:11:33 +0000 (01:11 -0800)]
Revert tryrun.cmake changes that brought coreclr's tryrun stuff (dotnet/corefx#42397)

Commit migrated from https://github.com/dotnet/corefx/commit/87cf12d7aa74843b7d0a7e710c5dc4845517b758

4 years agoTests for absolute path in exceptions (dotnet/corefx#42151)
Dan Moseley [Wed, 6 Nov 2019 04:08:31 +0000 (20:08 -0800)]
Tests for absolute path in exceptions (dotnet/corefx#42151)

* Tests for absolute path in exceptions

* Update src/System.Reflection/tests/AssemblyTests.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update src/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* CR

* fix tests

* Update AssemblyTests.cs

* Update AssemblyLoadContextTest.cs

* Update AssemblyTests.cs

* Update AssemblyLoadContextTest.cs

Commit migrated from https://github.com/dotnet/corefx/commit/f3d8bfa584ed9a128dce869b1e66f3fc2fad0041

4 years agoDelete unnecessary FStat (dotnet/corefx#42400)
Jan Kotas [Wed, 6 Nov 2019 03:32:13 +0000 (19:32 -0800)]
Delete unnecessary FStat (dotnet/corefx#42400)

Contributes to dotnet/corefx#42378

Commit migrated from https://github.com/dotnet/corefx/commit/fd3aaa4986e9964b1feb627aeb986364102aa3be

4 years agoImprove get/set performance in HashSet<T> (dotnet/corefx#40106)
Jeffrey Zhao [Wed, 6 Nov 2019 02:17:27 +0000 (20:17 -0600)]
Improve get/set performance in HashSet<T> (dotnet/corefx#40106)

* Improve get/set performance in HashSet<T>

Similar optimization in Dictionary<,> has been ported to HashSet<>.

`_comparer` has been made nullable, and default by `null`. This
makes us possible to check if it's null for faster branches, instead
of comparing it to `EqualityComparer<T>.Default`. Since `_comparer`
is `null` by default, the constructors and the `OnDeserialization`
method have been modified accordingly to save `null` instead of the
`EqualityComparer<T>.Default` if it's been passed/saved. Also, the
places that use `_comparer` directly much do a null check and switch
to `EqualityComparer<T>.Default` instead.

The major optimization is under `Contains` and `AddIfNotPresent`
methods. Basically the code was:

``
// Code uses _comparer
``

Now it becomes:

```
var comparer = _comparer;
if (comparer == null)
{
  if (default(T) != null)
  {
    // Code uses EqualityComparer<T>.Default for de-virtualizing.
  }
  else
  {
    var defaultComparer = EqualityComparer<T>.Default;
    // Code uses cached defaultComparer
  }
}
else
{
  // Code uses comparer
}
```

I've intentionally kept the origin implementation and comments as
much as possible, and the optimized code is not exactly the same as
in `Dictionary<T>`. Further micro-optimizations might be possible
but I think it's cleaner to keep it that way in the first step.

The `Remove` method hasn't been optimized since it's complicated,
and not been done in `Dictionary` either. Some other methods like
`AddOrGetLocation` or `InternalIndexOf` are not optimized since
they're only used in less-common scenarios, and not in the scope
of the current issue.

The benchmark shows there're obvious improvements in get and set
operations for all cases, especialy if the item is a value type.
I was actually expecting to see some pull back for "slower" case,
like if we use a custom comparer, but it turns out it's getting
faster too, since we have cached the comparer instead of using
`_comparer` directly in the loop.

The benchmark also shows the optimized `HashSet` has close or
better performance comparing to `Dictionary` in almost all cases,
except for `HashSet<string>` with default comparer. The default
comparer in `Dictionary<string>` is a "non-random" implementation
that performs better. Unfortunately the comparer is internal to
the CoreLib.

The optimized `HashSet<string>` is still faster since it's using
cached comparer of type `EqualityComparer<string>`, which uses
virtual method dispatching instead of interface dispatching. It's
just not as faster as `Dictionary<string, T>` yet.

Fix dotnet/corefx#36448

* Use Equals() to check _comparer in deserialization

After deserialization the `_comparer` will be set to a different
instance of default comparer, so we need to use `Equals` to compare
`_comparer` with `EqualityComparer<T>.Default` instead of reference
comparison by `==`.

* Remove unnecessary "default!" found in code review

* Ignore resetting "_comparer" in OnDeserialization

Previously we tried to reset `_comparer` in `OnDeserialization` if
it's `EqualityComparer<T>.Default`. But after discussion in dotnet/corefx#40150
we decide to follow the same approach as in `Dictionary<,>` to make
it simple.

* Remove extra line according to code review.

* Use _comparer?.GetHashCode(key) ?? key.GetHashCode() to leverage intrinsic.
Same to the Equals calls.

* Add "AggressiveInlining" to InternalGetHashCode/Equals methods

Make methods like "Remove" faster.

* Apply similar optimization to Remove and TryGetValue operations.

* Remove trailing whitespaces.

* Remove trailing whitespaces.

* Manually inline InternalEquals() method

Commit migrated from https://github.com/dotnet/corefx/commit/f9564cdbfa6590aa14b1be5fe1f6b20f51e94fcc

4 years agoConsolidate .netcoreapp.cs files because System.Security.Cryptography.* projects...
Roman Marusyk [Wed, 6 Nov 2019 02:03:17 +0000 (03:03 +0100)]
Consolidate .netcoreapp.cs files because System.Security.Cryptography.* projects is no longer cross-compiled (dotnet/corefx#42394)

Commit migrated from https://github.com/dotnet/corefx/commit/db4a737c66991a4d17f711b875616afd5cab4b5e

4 years agoAnnotate System.Runtime.Serialization.Formatters for nullable (dotnet/corefx#42188)
buyaa-n [Wed, 6 Nov 2019 02:01:44 +0000 (18:01 -0800)]
Annotate System.Runtime.Serialization.Formatters for nullable (dotnet/corefx#42188)

* Annotate System.Runtime.Serialization.Formatters for nullable

* Some update

* Some more update

* Applying feedback

* Reverting back some changes

* Little typo

Commit migrated from https://github.com/dotnet/corefx/commit/14424c1980f1ed7d8b5c56010675c8de7dbd7450

4 years agoFix some terms/typos (dotnet/corefx#42398)
Dan Moseley [Wed, 6 Nov 2019 01:53:59 +0000 (17:53 -0800)]
Fix some terms/typos (dotnet/corefx#42398)

* Fix some terms/typos

* a/an

* of

Commit migrated from https://github.com/dotnet/corefx/commit/4043dc1f855e2d5314620cd69b9dafa19cfee884

4 years ago Annotate System.Security.Cryptography.Primitives for nullable (dotnet/corefx#42298)
buyaa-n [Wed, 6 Nov 2019 00:04:38 +0000 (16:04 -0800)]
  Annotate System.Security.Cryptography.Primitives for nullable (dotnet/corefx#42298)

* Annotate System.Security.Cryptography.Primitives for nullable

Commit migrated from https://github.com/dotnet/corefx/commit/7a517eef6b50bff71ae69d0882ee69cad90f6d1f

4 years agoenable httpstress nightly runs (dotnet/corefx#42387)
Eirik Tsarpalis [Tue, 5 Nov 2019 23:35:05 +0000 (23:35 +0000)]
enable httpstress nightly runs (dotnet/corefx#42387)

Commit migrated from https://github.com/dotnet/corefx/commit/45e82c542ede629ba770cfec767456863b03c406

4 years agoAnnotate System.Text.Encodings.Web (dotnet/corefx#42362)
Eirik Tsarpalis [Tue, 5 Nov 2019 14:42:36 +0000 (14:42 +0000)]
Annotate System.Text.Encodings.Web (dotnet/corefx#42362)

Commit migrated from https://github.com/dotnet/corefx/commit/0cd8e74d310fb62a861ba1bda19e5d8ba3b42e0d

4 years agoUpdate linux containers to match coreclr's and use latest toolchain (dotnet/corefx...
Santiago Fernandez Madero [Tue, 5 Nov 2019 04:47:14 +0000 (22:47 -0600)]
Update linux containers to match coreclr's and use latest toolchain (dotnet/corefx#42376)

* Update linux containers to match coreclr's and use latest toolchain

* Use clang9 on alpine and update docs

Commit migrated from https://github.com/dotnet/corefx/commit/ee038925bde85c1c45c52f235ab09ea03b9c126c

4 years agoUpdate Directory.Build.props
Cory Nelson [Mon, 4 Nov 2019 23:06:45 +0000 (15:06 -0800)]
Update Directory.Build.props

This is a preview package, don't include it in shipped version.

Commit migrated from https://github.com/dotnet/corefx/commit/279292804fa4f6cb856577e59246ac934a2ef9e5

4 years agoAdd Array.Copy test for very large arrays (dotnet/corefx#42373)
Jan Kotas [Mon, 4 Nov 2019 23:05:27 +0000 (15:05 -0800)]
Add Array.Copy test for very large arrays (dotnet/corefx#42373)

Commit migrated from https://github.com/dotnet/corefx/commit/83a1672fd01f1191d8dd159163b1c0291a34560d

4 years agoFix SNIPacket.ReadFromStreamAsync to not consume same ValueTask twice (dotnet/corefx...
Stephen Toub [Mon, 4 Nov 2019 21:34:25 +0000 (16:34 -0500)]
Fix SNIPacket.ReadFromStreamAsync to not consume same ValueTask twice (dotnet/corefx#42338)

Found via an analyzer I'm working on for ValueTasks.

This calls stream.ReadAsync, and in the case where the ValueTask completes successfully by the time the code checks and where the returned Result <= 0, it then awaits the ValueTask again, representing a second consumption when only one is considered legal.

Fix it by replacing the original ValueTask with a new one containing the same result.

Commit migrated from https://github.com/dotnet/corefx/commit/a7cebb9ce454be31a0467ed418a221e5e3009768

4 years agoMerge pull request dotnet/corefx#42367 from dotnet/MattGal-patch-1
Matt Galbraith [Mon, 4 Nov 2019 18:31:49 +0000 (10:31 -0800)]
Merge pull request dotnet/corefx#42367 from dotnet/MattGal-patch-1

Change Platform -> ArchGroup for timeout increase

Commit migrated from https://github.com/dotnet/corefx/commit/bc7a5b1899f081dad41b418d6538a429caf5e7bf

4 years agoReduce System.Text.Json test count from ~150K to ~11K (dotnet/corefx#42365)
Stephen Toub [Mon, 4 Nov 2019 17:58:22 +0000 (12:58 -0500)]
Reduce System.Text.Json test count from ~150K to ~11K (dotnet/corefx#42365)

One theory was added with ~140K inputs and is causing our infrastructure to go haywire.

Commit migrated from https://github.com/dotnet/corefx/commit/9862cf5e1d1a73a5e62beef8edc2fc1f0f7e5d60

4 years agoUpdate src/sendtohelix.proj
Matt Galbraith [Mon, 4 Nov 2019 17:45:59 +0000 (09:45 -0800)]
Update src/sendtohelix.proj

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/corefx/commit/46ebf3382ecf54f6b7fe5c3f3efd87f55a67cbb1

4 years agoChange Platform -> ArchGroup for timeout increase
Matt Galbraith [Mon, 4 Nov 2019 17:30:21 +0000 (09:30 -0800)]
Change Platform -> ArchGroup for timeout increase

From reviewing the binlogs of arm and arm64 builds, this property check should definitely be ArchGroup not Platform (which ends up being AnyCPU here)

Commit migrated from https://github.com/dotnet/corefx/commit/77a27b97d015648059f3b7968442e0be29aca9e8

4 years agoFix DataRowExtensions.Field for nullable types
Shay Rojansky [Fri, 25 Oct 2019 16:30:06 +0000 (18:30 +0200)]
Fix DataRowExtensions.Field for nullable types

Fixes dotnet/corefx#41879

Commit migrated from https://github.com/dotnet/corefx/commit/f664740a41ea54e7b061731c36d262cfd9b39570

4 years agoFix wrong behaviour when move multiple files out of watched folder on mac (dotnet...
Jan Jahoda [Mon, 4 Nov 2019 16:07:14 +0000 (17:07 +0100)]
Fix wrong behaviour when move multiple files out of watched folder on mac (dotnet/corefx#41963)

* FS

watcher

* Multiple rename macOS fix

* Multiple rename macOS fix

* Format code

* Clean proj file

* Apply PR comments

* Apply suggestions from code review

Co-Authored-By: Cory Nelson <phrosty@gmail.com>
* Update src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Apply PR comments

* Apply PR comments

* Apply PR comments

* Document rename event id behaviour

Commit migrated from https://github.com/dotnet/corefx/commit/a1f8c919ac1280bb235264d5cc81f23b0d117710

4 years agoGetHostAddresses returns all IPs for local host name on Linux (dotnet/corefx#41764)
Marie Píchová [Mon, 4 Nov 2019 15:22:12 +0000 (16:22 +0100)]
GetHostAddresses returns all IPs for local host name on Linux (dotnet/corefx#41764)

Unifies behavior of GetHostAddresses for local host name on Linux with Windows and Mono versions by adding the result of getifaddrs.

Commit migrated from https://github.com/dotnet/corefx/commit/d8cfa3b6927408d4aa393689742c854eead61c8c

4 years agoARM tests take over 15 minutes (dotnet/corefx#42350) (dotnet/corefx#42355)
Lukáš Lánský [Mon, 4 Nov 2019 14:51:43 +0000 (15:51 +0100)]
ARM tests take over 15 minutes (dotnet/corefx#42350) (dotnet/corefx#42355)

Commit migrated from https://github.com/dotnet/corefx/commit/d027ad1819e2ffb68f0d39587f907cff956df94f

4 years agoRemove commented out test code
Stephen Toub [Mon, 4 Nov 2019 13:48:24 +0000 (08:48 -0500)]
Remove commented out test code

Commit migrated from https://github.com/dotnet/corefx/commit/372063c6129e3994fe5866cb5962504278a91650

4 years agoCleaning System.Data.Common.Tests up (dotnet/corefx#39958)
Ganbarukamo41 [Mon, 4 Nov 2019 13:47:35 +0000 (22:47 +0900)]
Cleaning System.Data.Common.Tests up (dotnet/corefx#39958)

* Cleanup System.Data.Common.Tests codes

* Fix broken tests, more cleanups

* Absurd spaces

* Use Equals/Null/Contains instead of True with comparison

* Fix typo

* Apply suggestions, more cleanups

* Use Equals typeof instead of comparing with Type.FullName

* Change AssertNotFound to assert exceptions directly

* Remove trailing whitespaces in comments

Commit migrated from https://github.com/dotnet/corefx/commit/1dc772565c8dddbb5fd15dd244d934b697f3103d

4 years agoRemove unused testdata version property (dotnet/corefx#42351)
Viktor Hofer [Mon, 4 Nov 2019 11:23:43 +0000 (12:23 +0100)]
Remove unused testdata version property (dotnet/corefx#42351)

Commit migrated from https://github.com/dotnet/corefx/commit/800862e8c7337efd09be5daffa49421f1399a031