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

4 years agoFormatting and parsing changes to JsonString (dotnet/corefx#41940)
Kristian Hellang [Fri, 1 Nov 2019 20:10:04 +0000 (21:10 +0100)]
Formatting and parsing changes to JsonString (dotnet/corefx#41940)

* Pull duplicated code into JsonWriterHelper

* Add helpers for parsing and formatting ISO dates

* Update tests to expect new format

* Use new helpers in JsonString methods

* Rename methods

* Check for valid parse length

* Use AsSpan extension to work around missing implicit operators on netfx

* More netfx workarounds

* Use constant for stackalloc length

* Add back temp span to avoid writing too much when trimming

* Move IsValidDateTimeOffsetParseLength to JsonHelpers

* Always use StackallocThreshold instead of calling GetUtf8ByteCount

* Remove redundant length checks done by IsValidDateTimeOffsetParseLength

* Adapt test pattern from Utf8JsonWriterTests

* Revert "Always use StackallocThreshold instead of calling GetUtf8ByteCount"

This reverts commit dotnet/corefx@0d29b646166138413f311a3ccf6284a72024b439.

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

4 years agoDelete ILLinkTrim.xml from System.Net.Primitives (dotnet/corefx#42183)
Stephen Toub [Fri, 1 Nov 2019 20:08:46 +0000 (16:08 -0400)]
Delete ILLinkTrim.xml from System.Net.Primitives (dotnet/corefx#42183)

This existed because HttpListener is using a few internal members via reflection (boo).  One of the methods listed in this file isn't used by anyone, however, so it's not clear why it's here; probably a typo.  The other (ToServerString) has no internal usage and exists only to support HttpListener, which means we'd really like it to survive the initial assembly-level trimming, but then only be kept around for the app-level trimming if this functionality from HttpListener is used.

Given our current limitations, I've added the ability for an assembly to opt-out of keeping around PreserveDependency attributes, I've so opted-out in Primitives, and then I've used PreserveDependency on the two public ctors of Cookie that will always be hit if a cookie is created, such that ToServerString will survive the assembly build, but then these attributes evaporate.

I've also added PreserveDependency attributes into HttpListener, to codify its dependency on the various internals (most of which survive into the assembly initially because they're used by something reachable from public API).

There is still an issue tracking these reflection-based internals dependencies into Cookie from HttpListener.

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

4 years agoUpdate required cmake version
Viktor Hofer [Fri, 1 Nov 2019 18:07:01 +0000 (19:07 +0100)]
Update required cmake version

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

4 years agoUse Package suffix instead of PackageId and Version suffix instead of PackageVersion...
Viktor Hofer [Fri, 1 Nov 2019 17:27:23 +0000 (18:27 +0100)]
Use Package suffix instead of PackageId and Version suffix instead of PackageVersion (dotnet/corefx#42289)

* Use Package suffix instead of PackageId

* Manual darc update from build '20191101.2'

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

4 years agoAdd new method for parameterless Listen() (dotnet/corefx#42262)
Mohammed Adenwala [Fri, 1 Nov 2019 16:23:40 +0000 (11:23 -0500)]
Add new method for parameterless Listen() (dotnet/corefx#42262)

* Add new method for parameterless Listen()

This adds a parameterless overload for Listen(int) which passes in int.MaxValue as the default value. I changed existing tests that were explicitly using int.MaxValue or a random value to use the new overload with no parameter.

* Update src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs

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

4 years ago Use clonefile for CopyFile, if available (dotnet/corefx#37583)
Filip Navara [Fri, 1 Nov 2019 16:22:48 +0000 (17:22 +0100)]
 Use clonefile for CopyFile, if available (dotnet/corefx#37583)

* Rework SystemNative_CopyFile to use paths instead of file descriptors

Use clonefile for CopyFile, if available

* Bail out in SystemNative_CopyFile if access fails. We don't want to proceed if the destination file is read-only.

* Handle a race condition where clonefile can result in EEXIST error

* Update comment about fcopyfile

* Update PathInternal.TrimEndingDirectorySeparator to Path.TrimEndingDirectorySeparator

* Add missing close(outFd) call

* Remove unnecessary ! operator

* Save errno around close(outFd) calls

* access already sets EACCESS errno, just keep it

* Remove fcopyfile support

* Open destination file with O_CLOEXEC

* Return correct error code for source == destination

* Rearrange error handling a bit

* Remove forgotten HAVE_FCOPYFILE

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

4 years agoConsolidate .netcoreapp.cs files because System.Text.Encoding project is no longer...
Roman Marusyk [Fri, 1 Nov 2019 13:58:20 +0000 (14:58 +0100)]
Consolidate .netcoreapp.cs files because System.Text.Encoding project is no longer cross-compiled (dotnet/corefx#42282)

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

4 years agoHonor dictionary key policy when entry value is null (dotnet/corefx#42267)
Layomi Akinrinade [Fri, 1 Nov 2019 02:27:18 +0000 (19:27 -0700)]
Honor dictionary key policy when entry value is null (dotnet/corefx#42267)

* Honor dictionary key policy when entry value is null

* Address review feedback

* Remove reverse Json checks

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

4 years agoImprove LINQ diagnosability and startup performance (dotnet/corefx#42187)
David Wrighton [Fri, 1 Nov 2019 01:08:45 +0000 (18:08 -0700)]
Improve LINQ diagnosability and startup performance (dotnet/corefx#42187)

* - Generate LINQ interpreter Thunks with unique names
- Instead of generating thunks, for common cases, use a pre-compiled C# method.
  - This results in using generic sharing for many instead of requiring exact compiled code
* Give Compiled LINQ lambda expressions unique names

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

4 years agoExtend BOM test (dotnet/corefx#42279)
Steve Harter [Fri, 1 Nov 2019 00:48:02 +0000 (19:48 -0500)]
Extend BOM test (dotnet/corefx#42279)

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

4 years agoHttpStress: add docker documentation (dotnet/corefx#42268)
Eirik Tsarpalis [Thu, 31 Oct 2019 22:46:28 +0000 (22:46 +0000)]
HttpStress: add docker documentation (dotnet/corefx#42268)

* httpstress: add documentation on dockerized stress runs

* fix stress yml issue

* fix doc issues

* remove commented out code

* remove accidental change

* yaml pipeline variables naming consistency

* Update eng/pipelines/stress/http-linux.yml

Co-Authored-By: Stephen Halter <halter73@gmail.com>
Commit migrated from https://github.com/dotnet/corefx/commit/4c3bd8a0533a2e35df371b91045a1a5f0ada7d54

4 years agoChange master from testing Ubuntu 19.04 to Ubuntu 19.10
Jeremy Barton [Thu, 31 Oct 2019 22:26:18 +0000 (15:26 -0700)]
Change master from testing Ubuntu 19.04 to Ubuntu 19.10

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

4 years agoAnnotate System.Text.RegularExpressions for nullability (dotnet/corefx#42132)
Eirik Tsarpalis [Thu, 31 Oct 2019 22:08:58 +0000 (22:08 +0000)]
Annotate System.Text.RegularExpressions for nullability (dotnet/corefx#42132)

* Annotate System.Text.RegularExpressions for nullability

* fix release build

* address feedback

* address feedback

* disable compiler warning in TryGetValue annotation

* change annotation to MaybeNullWhen()

* Revert "change annotation to MaybeNullWhen()"

This reverts commit dotnet/corefx@542404ffb147dfc5cc40a6acb4a1e101317aef8a.

* remove redundant comment

* update reference source

* disable nullability warning in reference source

* remove outdated comment

* replace bangs with single Debug.Assert() at top of method body

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

4 years agoUpdate developer-guide.md
Viktor Hofer [Thu, 31 Oct 2019 21:18:35 +0000 (22:18 +0100)]
Update developer-guide.md

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

4 years agoFix ILLink when run from VS/desktop/direct (dotnet/corefx#42266)
Eric StJohn [Thu, 31 Oct 2019 19:43:54 +0000 (12:43 -0700)]
Fix ILLink when run from VS/desktop/direct (dotnet/corefx#42266)

ILLink needs the path to dotnet.exe and was relying on an optional
environment variable to find it.

Instead use the NetCoreRoot property set by the SDK.

This is a direct copy of
https://github.com/dotnet/sdk/blob/dotnet/corefx@b28a8efbfb30d84019351abb3aa9a2b15e008662/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets#L74-L80

We should try to eliminate our custom illink.targets and just configure
the built in ones if we can.

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

4 years agoUse PackageLicenseExpression instead of URL (dotnet/corefx#42271)
Eric StJohn [Thu, 31 Oct 2019 19:42:42 +0000 (12:42 -0700)]
Use PackageLicenseExpression instead of URL (dotnet/corefx#42271)

* Use PackageLicenseExpression instead of URL

* Cleanup packaging properties from Directory.Build.props

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

4 years agoImport root D.B.targets and set condition (dotnet/corefx#42261)
Viktor Hofer [Thu, 31 Oct 2019 16:40:32 +0000 (17:40 +0100)]
Import root D.B.targets and set condition (dotnet/corefx#42261)

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

4 years agoUpdate System.Reflection.TypeExtensions ref assembly for nullable (dotnet/corefx...
Santiago Fernandez Madero [Thu, 31 Oct 2019 11:37:23 +0000 (05:37 -0600)]
Update System.Reflection.TypeExtensions ref assembly for nullable (dotnet/corefx#42256)

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

4 years agoFix System.Composition.* public key (dotnet/corefx#42232)
Eric StJohn [Thu, 31 Oct 2019 06:43:12 +0000 (23:43 -0700)]
Fix System.Composition.* public key (dotnet/corefx#42232)

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

4 years agoUpdate analyzer versions (dotnet/corefx#42249)
Stephen Toub [Thu, 31 Oct 2019 04:27:10 +0000 (00:27 -0400)]
Update analyzer versions (dotnet/corefx#42249)

* Update analyzer packages to latest NuGet versions

* Fix new warnings

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

4 years agoFix inefficient string manipulations in RegularExpressions tests (dotnet/corefx#42241)
Jan Kotas [Thu, 31 Oct 2019 01:57:48 +0000 (18:57 -0700)]
Fix inefficient string manipulations in RegularExpressions tests (dotnet/corefx#42241)

* Fix inefficient string manipulations in RegularExpressions tests

* CR feedback

* Consistent style

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

4 years agoImprove test failure msg (dotnet/corefx#42247)
Dan Moseley [Thu, 31 Oct 2019 01:54:28 +0000 (18:54 -0700)]
Improve test failure msg (dotnet/corefx#42247)

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

4 years agoClean up Uri.UnescapeDataString (dotnet/corefx#42225)
Stephen Toub [Thu, 31 Oct 2019 00:00:25 +0000 (20:00 -0400)]
Clean up Uri.UnescapeDataString (dotnet/corefx#42225)

- Use string.IndexOf rather than an open-coded, unsafe loop.
- Avoid an unnecessary SequenceEquals at the end: we're only at this point if a `%` was found highlighting that something escaped was found.
- Use stack memory for smaller inputs if possible, to avoid unnecessary ArrayPool interaction
- Remove an unnecessary argument to a helper function.
- Fix ValueStringBuilder.Grow to only copy the contained data.

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

4 years agoDelete PlatformHelper class (dotnet/corefx#42230)
Stephen Toub [Wed, 30 Oct 2019 23:59:22 +0000 (19:59 -0400)]
Delete PlatformHelper class (dotnet/corefx#42230)

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

4 years agoMerge pull request dotnet/corefx#42242 from wfurt/outerloop_42231
David Shulman [Wed, 30 Oct 2019 23:01:16 +0000 (16:01 -0700)]
Merge pull request dotnet/corefx#42242 from wfurt/outerloop_42231

Move CertificateValidationRemoteServer_EndToEnd_Ok to outerloop

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

4 years agomove CertificateValidationRemoteServer_EndToEnd_Ok to outerloop
wfurt [Wed, 30 Oct 2019 22:32:39 +0000 (15:32 -0700)]
move CertificateValidationRemoteServer_EndToEnd_Ok to outerloop

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

4 years agoFix deserialize issue with a large Stream containing a BOM (dotnet/corefx#42206)
Steve Harter [Wed, 30 Oct 2019 22:00:33 +0000 (17:00 -0500)]
Fix deserialize issue with a large Stream containing a BOM (dotnet/corefx#42206)

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

4 years agoFix System.Net.WebUtility.HtmlDecode issue (dotnet/corefx#42227)
Eirik Tsarpalis [Wed, 30 Oct 2019 19:05:45 +0000 (19:05 +0000)]
Fix System.Net.WebUtility.HtmlDecode issue (dotnet/corefx#42227)

Fix WebUtility.HtmlDecode bug

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

4 years agoAdd tests for custom JavaScriptEncoder to cover the virtual code paths in TextEncoder...
Ahson Khan [Wed, 30 Oct 2019 18:05:12 +0000 (11:05 -0700)]
Add tests for custom JavaScriptEncoder to cover the virtual code paths in TextEncoder, and address previous feedback. (dotnet/corefx#42064)

* Move using directive within ifdef to make it clear when its used.

* Add more tests for custom text encoder case.

* Fix typo in comment gaurd -> guard

* Fix up the using directives that got removed during merge conflict
resolution.

* Address feedback - fix 0x7F case, rename vectors to be self-documenting.

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

4 years agoAdd file creation method that takes an ACL (dotnet/corefx#42099)
Carlos Sanchez Lopez [Tue, 29 Oct 2019 22:48:49 +0000 (15:48 -0700)]
Add file creation method that takes an ACL (dotnet/corefx#42099)

Approved API Proposal: dotnet/corefx#41614
Related change for directory creation method that takes an ACL: dotnet/corefx#41834 -merged and ported to 3.1 Prev2

Description
We have extension methods in System.IO.FileSystem.AclExtensions that let the user get and set ACLs for existing files, but we do not have methods that create files with predefined ACLs.
.NET ACL (Access Control List) support is Windows specific. This change will reside inside the System.IO.FileSystem.AccessControl assembly.

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

Potential security hole as files can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
Stability issues with background processes (file filters) can prevent modifying ACLs right after creation (typically surfaces as a security exception).
This change addresses those problems by adding a new extension method that allows creating a file and ensuring the provided ACLs are set during creation.
This change is expected to be backported to 3.1.

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

4 years agoHandle binary formatted payloads with ResX mangled generic type names (dotnet/corefx...
Eric StJohn [Tue, 29 Oct 2019 22:01:50 +0000 (15:01 -0700)]
Handle binary formatted payloads with ResX mangled generic type names (dotnet/corefx#42102)

* Handle binary formatted payloads with ResX mangled generic type names

ResXSerializationBinder on desktop corrupted type names for generic parameters
in the binary formatted payload.  It would also undo this in the reader,
but we don't benefit from that in .NETCore since we don't deserialize
during build: we just copy the preserialized payload into the resources.

To handle this, we use a serialization binder to un-mangle the type names
in a way similar to ResXSerializationBinder.  We do it slightly differently
so that we only do it when needed, since relying on the binder to resolve
the type bypasses the type cache in BinaryFormatter.

* Respond to feedback.

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

4 years agoFix typo in sourcelink targets import (dotnet/corefx#42198)
Viktor Hofer [Tue, 29 Oct 2019 18:32:28 +0000 (19:32 +0100)]
Fix typo in sourcelink targets import (dotnet/corefx#42198)

Fixes https://github.com/dotnet/corefx/issues/42196

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

4 years agoAvoid duplicated message in WebException (dotnet/corefx#42195)
Stephen Toub [Tue, 29 Oct 2019 17:52:12 +0000 (13:52 -0400)]
Avoid duplicated message in WebException (dotnet/corefx#42195)

In a bunch of places, including in HttpClient, when a new exception instance is created to wrap an inner exception, the inner exception's message is then used as the message for the wrapping exception.  WebRequest.CreateCompatibleException is taking such an HttpRequestException and concatenating the outer and inner exception's messages, which means it's often duplicating the exact same message twice.

Since we're including the exception as the inner exception, there's no need for such duplication... we can just follow suit and use the outer exception's message without concatenation.

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

4 years agoUse docker-compose for running stress tests (dotnet/corefx#42186)
Eirik Tsarpalis [Tue, 29 Oct 2019 16:46:09 +0000 (16:46 +0000)]
Use docker-compose for running stress tests (dotnet/corefx#42186)

HttpStress: add docker-compose scenario

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