platform/upstream/dotnet/runtime.git
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

4 years agoSimplify Array.Copy(a, 0, b, 0, c) to Array.Copy(a, b, c) (dotnet/corefx#42343)
Stephen Toub [Mon, 4 Nov 2019 11:16:06 +0000 (06:16 -0500)]
Simplify Array.Copy(a, 0, b, 0, c) to Array.Copy(a, b, c) (dotnet/corefx#42343)

VS regex search and replace from `Array.Copy\((.+), 0, (.+), 0` to `Array.Copy($1, $2`, then manually reviewed.  The only changes I reverted were those to the tests for Array itself.

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

4 years agoDisable some FileSystemWatcher tests on MacOS (dotnet/corefx#42346)
David Shulman [Mon, 4 Nov 2019 05:17:05 +0000 (21:17 -0800)]
Disable some FileSystemWatcher tests on MacOS (dotnet/corefx#42346)

Contributes to dotnet/corefx#42344

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

4 years agoTests for BIFE containing path (dotnet/corefx#42150)
Dan Moseley [Mon, 4 Nov 2019 04:09:24 +0000 (20:09 -0800)]
Tests for BIFE containing path (dotnet/corefx#42150)

* Tests for BIFE containing path

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

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

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

4 years agoTest for null FNFE.FusionLog (dotnet/corefx#42152)
Dan Moseley [Mon, 4 Nov 2019 04:08:54 +0000 (20:08 -0800)]
Test for null FNFE.FusionLog (dotnet/corefx#42152)

* Test for null FNFE.FusionLog

* CR

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

4 years agoRead values from /proc/[pid]/status (dotnet/corefx#41122)
Shubham Ranjan [Mon, 4 Nov 2019 03:52:19 +0000 (09:22 +0530)]
Read values from /proc/[pid]/status (dotnet/corefx#41122)

* Fix dotnet/corefx#23449 - Read values from /proc/[pid]/status

* Fix tests for new returned data from /prod/[pid]/status

* Update tests of process info on OSX

* Rename property ParsedStatus.pid --> ParsedStatus.Pid

* 1. Avoid reallocation of delimiter array
2. Use tryParse instead of Parse to avoid exceptions

* Rename static field and mark it as readonly

* Change pid from /status to be read only from debug mode

* Change status file read implementation using spans

* Remove unecessary debug statement

* Revert "Remove unecessary debug statement"

This reverts commit dotnet/corefx@f60b4f3939cffc4a2753bc27981bd228a0801f79.

* Refactor logic using if statements with reduction in code redundancy

* Improve condition arrangement to avoid reading subsequent files if process name doesn't match

* Avoid failure of process info creation in case of fail read from one of many files.

* Refactor Interop.ProcFsStat for better understanding

* Change process creation logic to fail on read /stat

* Change logic for unit and non unit values in file

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

4 years agoImprove tests for StreamReader cancellation (dotnet/corefx#42171)
Stephen Toub [Mon, 4 Nov 2019 02:59:00 +0000 (21:59 -0500)]
Improve tests for StreamReader cancellation (dotnet/corefx#42171)

Existing tests were only validating precancellation and not canceling once a Read{Block}Async call was already in flight.

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

4 years agoMerge pull request dotnet/corefx#42322 from davidsh/cert_tests
David Shulman [Mon, 4 Nov 2019 02:42:42 +0000 (18:42 -0800)]
Merge pull request dotnet/corefx#42322 from davidsh/cert_tests

Cleanup HttpClient certificate tests

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

4 years agoMerge pull request dotnet/corefx#42342 from davidsh/win7_disable_tests
David Shulman [Mon, 4 Nov 2019 02:41:12 +0000 (18:41 -0800)]
Merge pull request dotnet/corefx#42342 from davidsh/win7_disable_tests

Disable some networking tests on Windows 7

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

4 years agoAddress PR feedback
David Shulman [Mon, 4 Nov 2019 00:48:16 +0000 (16:48 -0800)]
Address PR feedback

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

4 years agoDisable some networking tests on Windows 7
David Shulman [Sun, 3 Nov 2019 22:10:28 +0000 (14:10 -0800)]
Disable some networking tests on Windows 7

Contributes to dotnet/corefx#42339

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

4 years agoConsolidate .netcoreapp.cs test files in System.Data.* (dotnet/corefx#42325)
Roman Marusyk [Sun, 3 Nov 2019 23:32:26 +0000 (00:32 +0100)]
Consolidate .netcoreapp.cs test files in System.Data.* (dotnet/corefx#42325)

* Consolidate .netcoreapp.cs files because System.Data.* projects is no longer cross-compiled

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

4 years agoConsolidate .netcoreapp.cs test files in System.IO.* (dotnet/corefx#42329)
Roman Marusyk [Sun, 3 Nov 2019 23:31:21 +0000 (00:31 +0100)]
Consolidate .netcoreapp.cs test files in System.IO.* (dotnet/corefx#42329)

* Consolidate .netcoreapp.cs files because System.IO.* projects is no longer cross-compiled

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

4 years agoAdd System.Net.Quic.dll assembly with basic object model and mock implementation...
Geoff Kizer [Sun, 3 Nov 2019 20:01:32 +0000 (12:01 -0800)]
Add System.Net.Quic.dll assembly with basic object model and mock implementation (dotnet/corefx#42311)

* add stub System.Net.Quic assembly

* mock QUIC implementation

* QUIC: Remove ConnectAsync on QuicStream (dotnet/corefx#42203)

remove explicit connect on QuicStream and related fixes

* rename Create*Stream to Open*Stream

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

4 years agoCleanup HttpClient certificate tests
David Shulman [Sat, 2 Nov 2019 20:22:04 +0000 (13:22 -0700)]
Cleanup HttpClient certificate tests

Some of the client certificate tests weren't running because they were conditioned on having
the "test root" installed. But that isn't needed for these tests.

Moved test to the loopback server. Also, cleaned up code which assumed the tests ran against
.NET Framework or UAP which isn't true anymore.

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

4 years agoAssert ValueTask completion in SslStream.Read/Write (dotnet/corefx#42331)
Stephen Toub [Sun, 3 Nov 2019 13:58:27 +0000 (08:58 -0500)]
Assert ValueTask completion in SslStream.Read/Write (dotnet/corefx#42331)

We're employing a pattern in SslStream to avoid redundant code: we reuse the same code paths for both sync and async operations, with different interface implementations for each.  The sync implementation has implementations that complete synchronously, and we then guarantee that the whole operation actually completes synchronously, even though it's implemented with async methods.  We then .GetAwaiter().GetResult() to extract the result.  Since by construction the task will have already completed, it's ok to do so, but it's difficult for a human to see this, and harder for an analyzer.  Add an assert to both convey to an analyzer that we know what we're doing, and add a message for a human to understand it better. We can also remove an unnecessary "AsTask()" operation from the synchronous Write path, which should also remove a tiny bit of overhead.

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

4 years agoFix ValueTask usage in XmlTextReaderImpl.ParseTextAsync (dotnet/corefx#42330)
Stephen Toub [Sun, 3 Nov 2019 13:58:06 +0000 (08:58 -0500)]
Fix ValueTask usage in XmlTextReaderImpl.ParseTextAsync (dotnet/corefx#42330)

Found by an analyzer for ValueTasks I'm writing (and using corefx to test).

The ParseTextAsync(int) method returns a ValueTask, which then potentially has both .Result called on it and .AsTask (if fullValue is false), and such double-consumption of a ValueTask is not allowed.  It hasn't caused any problems because `async ValueTask` methods would always be backed by either a result or a Task, and as an implementation detail double-consumption of such instances doesn't cause a problem.  But for .NET 5 we've added the ability for `async ValueTask` methods to use pooled instances, in which case such double-consumption would cause problems (e.g. exceptions about the double use).  A fix here is to use Preserve.

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

4 years agoRemove unused return value from ChannelUtilities.QueueWaiter (dotnet/corefx#42328)
Stephen Toub [Sun, 3 Nov 2019 13:57:50 +0000 (08:57 -0500)]
Remove unused return value from ChannelUtilities.QueueWaiter (dotnet/corefx#42328)

Found while working on an analyzer for ValueTasks.

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

4 years agoOptimize FindFirstCharToEncode for JavaScriptEncoder.Default using Ssse3 intrinsics...
Günther Foidl [Sun, 3 Nov 2019 00:05:42 +0000 (01:05 +0100)]
Optimize FindFirstCharToEncode for JavaScriptEncoder.Default using Ssse3 intrinsics (dotnet/corefx#42073)

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

4 years agoMerge pull request dotnet/corefx#42324 from davidsh/disable_hanging_tests
David Shulman [Sat, 2 Nov 2019 21:31:29 +0000 (14:31 -0700)]
Merge pull request dotnet/corefx#42324 from davidsh/disable_hanging_tests

Disable hanging tests

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

4 years agoDisable hanging tests
David Shulman [Sat, 2 Nov 2019 21:29:55 +0000 (14:29 -0700)]
Disable hanging tests

Contributes to dotnet/corefx#42323

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

4 years ago[master] Update dependencies from dotnet/coreclr (dotnet/corefx#42314)
dotnet-maestro[bot] [Sat, 2 Nov 2019 17:12:06 +0000 (17:12 +0000)]
[master] Update dependencies from dotnet/coreclr (dotnet/corefx#42314)

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

- Microsoft.NET.Sdk.IL - 5.0.0-alpha1.19551.3
- Microsoft.NETCore.ILAsm - 5.0.0-alpha1.19551.3
- Microsoft.NETCore.Runtime.CoreCLR - 5.0.0-alpha1.19551.3

* Update System.Runtime.Intrinsics.Experimental: https://github.com/dotnet/coreclr/pull/27533 https://github.com/dotnet/coreclr/pull/27421

* Update System.Runtime.Intrinsics.Experimental: https://github.com/dotnet/coreclr/pull/27430

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

4 years agoGuard against null refs when attempting to deserialize mismatched JSON into collectio...
Layomi Akinrinade [Sat, 2 Nov 2019 01:37:19 +0000 (18:37 -0700)]
Guard against null refs when attempting to deserialize mismatched JSON into collections (dotnet/corefx#42254)

* Guard against null refs when attempting to deserialize mismatched JSON into collections

* Address review feedback

* Address review feedback

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

4 years agoConsolidate .netcoreapp.cs files because System.Collections.* projects is no longer...
Roman Marusyk [Sat, 2 Nov 2019 00:51:16 +0000 (01:51 +0100)]
Consolidate .netcoreapp.cs files because System.Collections.* projects is no longer cross-compiled (dotnet/corefx#42302)

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

4 years agoSetup HTTP/2 code for sharing (dotnet/corefx#42070)
Chris Ross [Sat, 2 Nov 2019 00:31:16 +0000 (17:31 -0700)]
Setup HTTP/2 code for sharing (dotnet/corefx#42070)

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

4 years agoCleanup GDI interop in System.Drawing.Common (dotnet/corefx#39727)
Hugh Bellamy [Fri, 1 Nov 2019 23:43:13 +0000 (23:43 +0000)]
Cleanup GDI interop in System.Drawing.Common (dotnet/corefx#39727)

* Cleanup GDI object Interop

* Cleanup GDI region interop

* Cleanup GDI font interop

* Cleanup GDI DC interop

* Address PR feedback

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

4 years agoAdd desktop build of System.Runtime.CompilerServices.Unsafe (dotnet/corefx#42297)
Eric StJohn [Fri, 1 Nov 2019 23:16:21 +0000 (16:16 -0700)]
Add desktop build of System.Runtime.CompilerServices.Unsafe (dotnet/corefx#42297)

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

4 years agoRemove hardcoded paths from native build scripts (dotnet/corefx#42295)
Eirik Tsarpalis [Fri, 1 Nov 2019 20:32:32 +0000 (20:32 +0000)]
Remove hardcoded paths from native build scripts (dotnet/corefx#42295)

* remove hardcoded paths from Native scripts

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