platform/upstream/dotnet/runtime.git
4 years agoRename the 'WebAssembly' OS to 'Browser' and the RID to 'brows… (#35323)
Zoltan Varga [Thu, 23 Apr 2020 10:05:13 +0000 (06:05 -0400)]
Rename the 'WebAssembly' OS to 'Browser' and the RID to 'brows… (#35323)

4 years agoenable Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy test (#34444)
Jan Jahoda [Thu, 23 Apr 2020 09:15:59 +0000 (11:15 +0200)]
enable Proxy_UseEnvironmentVariableToSetSystemProxy_RequestGoesThruProxy test (#34444)

* Disable test on windows and enable on other platforms

* enable test

* Add diag logs

* enhance logging

* Add body logging

* Add more logs

* Add logs to loopback server

* add trace

* Disallow run test on WinHttpHandler and remove logs

* Clean up

* rename variable

4 years agoJIT: revise how the jit tracks use of generics context (#34827)
Andy Ayers [Thu, 23 Apr 2020 08:05:57 +0000 (01:05 -0700)]
JIT: revise how the jit tracks use of generics context (#34827)

The generics context is reported by the jit specially whenever it feeds into
runtime lookups, as expansion of those lookups can expose pointers into runtime
data structures, and we don't want those data structures to be collected if
jitted code is still using them.

Sometimes uses of the context are optimized away, and reporting costs
code size and GC space, so we don't want to report the context unless there
is an actual use.

This change revises how the jit keeps track of context use -- instead of trying
to incrementally ref count uses of the generics context, we now just leverage
existing passes which do local accounting.

Initial motivation for this came from #34641 where the context use was
over-reported, but investigation showed we also some times under-report as
the context var could be cloned without changing the ref count.

So this change fixes both under and over reporting.

Closes #34641.

4 years agoRe-enable Windows 7 and Windows8.1 helix queues (#35211)
Santiago Fernandez Madero [Thu, 23 Apr 2020 07:35:04 +0000 (00:35 -0700)]
Re-enable Windows 7 and Windows8.1 helix queues (#35211)

4 years agoJson-Parse: Parse with `RapidJson::kParseStopWhenDoneFlag` on all architectures ...
Swaroop Sridhar [Thu, 23 Apr 2020 06:47:05 +0000 (23:47 -0700)]
Json-Parse: Parse with `RapidJson::kParseStopWhenDoneFlag` on all architectures (#35073)

RapidJson's `kParseStopWhenDoneFlag` indicates that parsing should stop once the root element is parsed, and should not throw an error for any further content.

This flag is useful when the input stream doesn't always have a null-terminator --
ex: an input `bytestream` (rather than a `stringstream`), files embeded within the single file bundle.
The limitation of using this flag is that any actual random text after the root element is silently ignored.

Currently, RapidJson is invoked with `kParseStopWhenDoneFlag` on Windows, but not on Unix.
This caused `kParseErrorDocumentRootNotSingular` failure on Unix when parsing json files from single-file bundles.

This change fixes this problem by passing `kParseStopWhenDoneFlag` on all platforms.
This also makes the host behavior consistent across platforms.

4 years agoSystem.Diagnostics Tracing APIs (#35220)
Tarek Mahmoud Sayed [Thu, 23 Apr 2020 03:57:13 +0000 (20:57 -0700)]
System.Diagnostics Tracing APIs (#35220)

* System.Diagnostics Tracing APIs

* address the feedback

4 years agoOptimize VectorX.Clamp according to proposed change (#34896)
AlFas [Thu, 23 Apr 2020 00:53:07 +0000 (03:53 +0300)]
Optimize VectorX.Clamp according to proposed change (#34896)

* Optimize Vector4.Clamp according to proposed change

* Apply clamp optimizations to all vector types

4 years agomore code cleanup (#35276)
Maoni Stephens [Thu, 23 Apr 2020 00:42:51 +0000 (17:42 -0700)]
more code cleanup (#35276)

mostly for gc_low/gc_high usage.

there is one functional change which is there's an incorrect assert in plan_phase which is not true when mark_list is used

4 years ago[mono] Bundle all tests to *.app for iOS as part of -subset Libs.Tests (#35283)
Egor Bogatov [Wed, 22 Apr 2020 21:07:00 +0000 (00:07 +0300)]
[mono] Bundle all tests to *.app for iOS as part of -subset Libs.Tests (#35283)

* Build *.app for iOS as part of Libs.Tests subset

* Add `-test` support

* Reduce *.app size (from 45 to 32 mb)

4 years agoMdhwang/reduce mobile checks (#35105)
Mitchell Hwang [Wed, 22 Apr 2020 21:00:47 +0000 (17:00 -0400)]
Mdhwang/reduce mobile checks (#35105)

* [eng] Add TargetsMobile Property to Subsets.props

* Replace TargetOS mobile conditions with TargetsMobile Property

* [libraries] Remove leftover condition`

Co-authored-by: Mitchell Hwang <mihw@microsoft.com>
4 years agoImplemented cmd version of excludemonofailures parameter. (#35292)
Nathan Ricci [Wed, 22 Apr 2020 20:06:26 +0000 (16:06 -0400)]
Implemented cmd version of excludemonofailures parameter. (#35292)

4 years agoFix SuperPmi MCS tool (#35290)
Carol Eidt [Wed, 22 Apr 2020 19:25:39 +0000 (12:25 -0700)]
Fix SuperPmi MCS tool (#35290)

It currently errors out if it finds a method without `CORINFO_FLG_STATIC`, `CORINFO_FLG_DONT_INLINE` or `CORINFO_FLG_CONSTRUCTOR`. Also, it only prints the first attribute it encounters.
It's unclear to me how this ever worked, but in any case it isn't useful to fail to generate a map or IL dump.

4 years agoGCPOLL and Natural loop fixes (#34837)
Brian Sullivan [Wed, 22 Apr 2020 18:42:22 +0000 (11:42 -0700)]
GCPOLL and Natural loop fixes (#34837)

* Fixes for GCPoll and COMPLUS_GCPollType=3

* This is a combination of 2 commits.

Fix for a rare case where fgReorderBlocks splits the blocks for a natural loop

* Address Code review feedback from Aaron

4 years ago[Arm64] Implement ASIMD Extract Insert ExtractVector64 ExtractVector128 (#35030)
Egor Chesakov [Wed, 22 Apr 2020 18:01:23 +0000 (11:01 -0700)]
[Arm64] Implement ASIMD Extract Insert ExtractVector64 ExtractVector128 (#35030)

* Implements Extract, Insert, ExtractVector64 and ExtractVector128 intrinsics.

* Implements a way to generate a fallback mechanism for intrinsics accepting an immediate operand when the operand is not constant.

* Renames NoContainment flag to SupportsContainment on Arm64 (presumably, there should be fewer intrinsics supporting containment analysis so it makes more sense to have NoContainment as default)

* Removes ival column from hwintrinsiclistarm64.h table and the corresponding field in HWIntrinsicInfo struct.

4 years agoRemove the explicit IEquatable implementation from the IntPtr/UIntPtr reference API...
Tanner Gooding [Wed, 22 Apr 2020 17:21:52 +0000 (10:21 -0700)]
Remove the explicit IEquatable implementation from the IntPtr/UIntPtr reference API (#35256)

4 years agoFix store/load float LCL_FIELD with unaligned offsets on arm32. (#34990)
Sergey Andreenko [Wed, 22 Apr 2020 16:56:27 +0000 (09:56 -0700)]
Fix store/load float LCL_FIELD with unaligned offsets on arm32. (#34990)

* Fix arm32 access to unaligned float fields.

* Add an additional test for the issue.

* Reenable the test.

* We don't need to require 8 bytes alignment for double, 4 is enough.

* Add comments.

* Move `buildInternalRegisterUses` after we define all of them.

* Extract `IsOffsetMisaligned`.

* Fix for the `IND float(ADD byref(LCL_VAR byref, CNT_INT 1))`.

4 years agoPing timeout in SendPingWithIPAddress test increased to 10 seconds (#35286)
Alexander Nikolaev [Wed, 22 Apr 2020 16:07:42 +0000 (18:07 +0200)]
Ping timeout in SendPingWithIPAddress test increased to 10 seconds (#35286)

Ping timeout in SendPingWithIPAddress test increased to 10 seconds to prevent failures.

4 years agoStop passing in auto-discovered xunit traits (#35237)
Viktor Hofer [Wed, 22 Apr 2020 12:43:31 +0000 (14:43 +0200)]
Stop passing in auto-discovered xunit traits (#35237)

* Stop passing in auto-discovered xunit traits

With https://github.com/dotnet/arcade/pull/5314, framework and platform
traits don't need to be passed in manually anymore. Also removing the
obsolete vstest.runner.json as it isn't needed for VSTest.

4 years agoMerge pull request #35275 from kjpou1/doc/requirements/mono
Kenneth Pouncey [Wed, 22 Apr 2020 10:32:46 +0000 (12:32 +0200)]
Merge pull request #35275 from kjpou1/doc/requirements/mono

[docs] Helpful links when building the first time.

4 years ago[master] Update dependencies from Microsoft/vstest dotnet/xharness (#35198)
dotnet-maestro[bot] [Wed, 22 Apr 2020 10:19:33 +0000 (10:19 +0000)]
[master] Update dependencies from Microsoft/vstest dotnet/xharness (#35198)

* Update dependencies from https://github.com/microsoft/vstest build 20200420-01

- Microsoft.NET.Test.Sdk: 16.7.0-preview-20200416-02 -> 16.7.0-preview-20200420-01

* Update dependencies from https://github.com/microsoft/vstest build 20200421-02

- Microsoft.NET.Test.Sdk: 16.7.0-preview-20200416-02 -> 16.7.0-preview-20200421-02

* Update dependencies from https://github.com/dotnet/xharness build 20200421.1

- Microsoft.DotNet.XHarness.Tests.Runners: 1.0.0-prerelease.20220.2 -> 1.0.0-prerelease.20221.1

* Update dependencies from https://github.com/dotnet/xharness build 20200421.3

- Microsoft.DotNet.XHarness.Tests.Runners: 1.0.0-prerelease.20220.2 -> 1.0.0-prerelease.20221.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
4 years agoFix a warning. (#35272)
monojenkins [Wed, 22 Apr 2020 10:03:54 +0000 (06:03 -0400)]
Fix a warning. (#35272)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years ago[wasm][debugger] Fix enumerating for `this` on valuetypes (#35267)
monojenkins [Wed, 22 Apr 2020 09:09:26 +0000 (05:09 -0400)]
[wasm][debugger] Fix enumerating for `this` on valuetypes (#35267)

- This also fixes the same thing for `evaluateOnCallFrame`
- And, showing type arguments in generic method names

Co-authored-by: radical <radical@users.noreply.github.com>
4 years ago[amd64] Fix tailcall with arguments passed on stack (#34814)
Vlad Brezae [Wed, 22 Apr 2020 08:49:25 +0000 (11:49 +0300)]
[amd64] Fix tailcall with arguments passed on stack (#34814)

On all platforms, OP_TAILCALL copies the arguments (that are passed on the stack) from the param area in the current frame, to the param area in the caller frame, meaning that it expects the arguments to be passed normally on the stack. However, on amd64, mono_arch_emit_call was storing these arguments directly in the param area of the caller (EMIT_NEW_ARGSTORE), instead of the param area of the current frame. OP_TAILCALL would then override the already set stack parameters with random data from the uninitialized param area of the current frame.

4 years agoMerge pull request #35173 from am11/feature/solaris/coreclr-port-without-libunwind...
Jan Vorlicek [Wed, 22 Apr 2020 08:38:06 +0000 (10:38 +0200)]
Merge pull request #35173 from am11/feature/solaris/coreclr-port-without-libunwind-changes

Port CoreCLR to SunOS

4 years agoJIT: add suppressed zero inits if we transform tail recursive call to… (#35148)
Andy Ayers [Wed, 22 Apr 2020 07:47:31 +0000 (00:47 -0700)]
JIT: add suppressed zero inits if we transform tail recursive call to… (#35148)

Track whether the jit has suppressed in-body zero initialization for any locals
because at the time it appeared prolog initialization would be sufficient. If
the jit subsequently decides to change a tail recursive call into a loop, use
this information to add back the missing zero initializations.

Added a test case.

Addresses #33529.

4 years ago[docs] Helpful links when building the first time.
Kenneth Pouncey [Wed, 22 Apr 2020 05:23:46 +0000 (07:23 +0200)]
[docs] Helpful links when building the first time.

- Add requirements link to the mono build README.md
- Add a link to the requirements document when missing openssl.

4 years agoEnable CI to run CoreCLR tests on Mono (#34054)
Nathan Ricci [Wed, 22 Apr 2020 04:18:31 +0000 (00:18 -0400)]
Enable CI to run CoreCLR tests on Mono (#34054)

Run the runtime tests on mono in ci.

Co-authored-by: Joseph Shields <directhex@apebox.org>
4 years agoExpose BinaryReader / BinaryWriter 7-bit encoding methods publicly (#35170)
Levi Broderick [Wed, 22 Apr 2020 03:44:47 +0000 (20:44 -0700)]
Expose BinaryReader / BinaryWriter 7-bit encoding methods publicly (#35170)

4 years agoAdd Checked configuration to crossgen2 project (#35266)
Simon Nattress [Wed, 22 Apr 2020 03:31:23 +0000 (20:31 -0700)]
Add Checked configuration to crossgen2 project (#35266)

The runtime is often built Checked during development for faster code that's still fairly debuggable. Add a Checked build option to Crossgen2's projects which lets runtime developers build / debug in VS and consume an existing Checked JIT.

4 years agoMore clrconfig cleanup (#35261)
Andrew Au [Wed, 22 Apr 2020 02:43:08 +0000 (19:43 -0700)]
More clrconfig cleanup (#35261)

* More clrconfig cleanup

* Fixed a build error

4 years agoStop passing GC types in IL tests. (#35207)
Aaron Robinson [Wed, 22 Apr 2020 01:56:13 +0000 (18:56 -0700)]
Stop passing GC types in IL tests. (#35207)

4 years agoEnable the installer for mono Linux_x64 (#35127)
Steve Pfister [Tue, 21 Apr 2020 19:35:58 +0000 (15:35 -0400)]
Enable the installer for mono Linux_x64 (#35127)

Since mono distributes only runtime packs, this change removes steps that assume the
shared framework exists along with installers.

Fixes https://github.com/dotnet/runtime/issues/35082

4 years agoConsolidate Microsoft.NETCore.App property usage (#35116)
Mitchell Hwang [Tue, 21 Apr 2020 19:34:35 +0000 (15:34 -0400)]
Consolidate Microsoft.NETCore.App property usage (#35116)

* [eng] Add SharedFrameworkName Microsoft.NETCore.App property

* [src] Remove extra SharedFrameworkName declarations

Co-authored-by: Mitchell Hwang <mihw@microsoft.com>
4 years agoRemove DisallowNull annotation in JsonConverter.Write() (#35022)
Steve Harter [Tue, 21 Apr 2020 18:44:48 +0000 (13:44 -0500)]
Remove DisallowNull annotation in JsonConverter.Write() (#35022)

4 years agoMerge pull request #35253 from dotnet/leecow-patch
Lee Coward [Tue, 21 Apr 2020 18:42:24 +0000 (11:42 -0700)]
Merge pull request #35253 from dotnet/leecow-patch

Update 5.0 snap yaml

4 years agoadd 5.0 snap yamls
Lee Coward [Tue, 21 Apr 2020 18:32:19 +0000 (11:32 -0700)]
add 5.0 snap yamls

4 years agoMerge branch 'master' of https://github.com/dotnet/runtime into leecow-patch
Lee Coward [Tue, 21 Apr 2020 18:30:02 +0000 (11:30 -0700)]
Merge branch 'master' of https://github.com/dotnet/runtime into leecow-patch

4 years agoFix dactablegen's search for MSDia and remove DIADll from the tree (#35086)
Juan Hoyos [Tue, 21 Apr 2020 17:46:15 +0000 (10:46 -0700)]
Fix dactablegen's search for MSDia and remove DIADll from the tree (#35086)

* Copy msdia140 to binary path to ensure correct bitness
* Remove DIALib binary from the tree

4 years agoEmit type layout check fixups (#34927)
Simon Nattress [Tue, 21 Apr 2020 17:42:16 +0000 (10:42 -0700)]
Emit type layout check fixups (#34927)

* Emit type layout check fixups

When a ready-to-run compiled method uses value types from other version bubbles, emit a precode fixup to check at runtime that the type is still compatible (same size, alignment, GC layout).

Bring over `GCPointerMap*.cs` from CoreRT repo to get the compute the GC layout bytes that match what the runtime expects in the layout blob.

Simplify the behavior of the Crossgen test scripting. If tests opt out of crossgen by setting `<CrossGenTest>false</CrossGenTest>`, skip emitting the crossgen commands into the test run script. Also, stop setting the `RunCrossGen` and `RunCrossGen2` environment variables in the test script based on compile-time settings. These get set by runtest.py anyway. This set of tweaks allow for crossgen tests which we don't want to run the default crossgen commands on, and allow choosing either crossgen or crossgen2 as part of test execution.

4 years ago[GC] Fix the bounds of desired size equalization loop . (#35226)
Vladimir Sadov [Tue, 21 Apr 2020 17:13:52 +0000 (10:13 -0700)]
[GC] Fix the bounds of desired size equalization loop . (#35226)

* Fix the bounds of desired size equalization loop .

* Use <= in the right place.

4 years agoupdate branding to preview5 (#35215)
Anirudh Agnihotry [Tue, 21 Apr 2020 16:44:01 +0000 (09:44 -0700)]
update branding to preview5 (#35215)

4 years agoAdd API docs for HashAlgorithmName.{Try}FromOid.
Kevin Jones [Tue, 21 Apr 2020 16:27:30 +0000 (12:27 -0400)]
Add API docs for HashAlgorithmName.{Try}FromOid.

4 years agoAdd new IntPtr/UIntPtr API surface (#307)
John [Tue, 21 Apr 2020 16:23:33 +0000 (17:23 +0100)]
Add new IntPtr/UIntPtr API surface (#307)

* Add new IntPtr surface

* Add new UIntPtr API surface

* Add sequential layout to match [U]Int32

* Add interfaces and sequential layout

* Add interfaces

* Add namespaces

* Add namespaces

* Update UIntPtr.cs

* Update IntPtr.cs

* Change style

* make non versionable, elide copy

* fix style, elide copy, make non versionable

* Fix syntax error

* Fix style issues

* Fix style issues

* Update IntPtr.cs

* Update UIntPtr.cs

* Update ref assembly

* Allow comparison of intptr/uintptr in Array

* Fixed ELEMENT_TYPE cases, added tests based on Int32/UInt32 tests

* Fixes

* Update Array.cs

* Update Array.cs

* Update Array.cs

* Update ArrayTests.cs

* Update ArrayTests.cs

* Update UIntPtrTests.cs

* Update ArrayTests.cs

* fix instance methods??

* fixes

* Fixwa

* fix tests

* Add non versionables

* fix compare methods

* Fix comparison error

* fix boundary

* fix compares

* fix maxvals

* remove xunit buggy data

* silly var name error

* Update src/libraries/System.Private.CoreLib/src/Resources/Strings.resx

Co-Authored-By: Tanner Gooding <tagoo@outlook.com>
* Fix ToString

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
4 years agoAdd API docs for HashAlgorithmName.{Try}FromOid.
Kevin Jones [Tue, 21 Apr 2020 16:07:09 +0000 (12:07 -0400)]
Add API docs for HashAlgorithmName.{Try}FromOid.

4 years agoMerge branch 'master' into feature/solaris/coreclr-port-without-libunwind-changes
Adeel Mujahid [Tue, 21 Apr 2020 15:00:20 +0000 (18:00 +0300)]
Merge branch 'master' into feature/solaris/coreclr-port-without-libunwind-changes

4 years ago[mono] Fix iOS sample (#35241)
Egor Bogatov [Tue, 21 Apr 2020 14:29:25 +0000 (17:29 +0300)]
[mono] Fix iOS sample (#35241)

4 years agoAvoid unnecessary ToLower calls in RegexCompiler generated code (#35185)
Stephen Toub [Tue, 21 Apr 2020 13:37:38 +0000 (09:37 -0400)]
Avoid unnecessary ToLower calls in RegexCompiler generated code (#35185)

* Avoid unnecessary ToLower calls in RegexCompiler generated code

We can skip calling ToLower{Invariant} if the only character that could possibly lower-case to the character we're comparing against is that character itself.  This then also lets us employ optimizations like using IndexOf when searching for `\n` as part of expressions like `.*`.

* Fix a comment

* Add test to validate UnicodeCategory assumptions

4 years agoMerge pull request #34997 from janvorli/implement-native-getmoduleindex
Jan Vorlicek [Tue, 21 Apr 2020 12:14:44 +0000 (14:14 +0200)]
Merge pull request #34997 from janvorli/implement-native-getmoduleindex

Implement native GetModuleIndex

4 years ago[mono] Add LLVM support for iOS test runner; use runtime packs (#35106)
Egor Bogatov [Tue, 21 Apr 2020 10:07:28 +0000 (13:07 +0300)]
[mono] Add LLVM support for iOS test runner; use runtime packs (#35106)

4 years ago[CBOR] Implement support for tagged types (#34767)
Eirik Tsarpalis [Tue, 21 Apr 2020 09:06:34 +0000 (10:06 +0100)]
[CBOR] Implement support for tagged types (#34767)

* [CBOR] Implement support for dateTime types

* fix test errors

* refine RFC3339 dateTime formatting logic

* add invalid date string tests

* Implement BigInteger support

* initial decimal support implementation

* use stack allocated buffers instead of thread local buffers

* add test cases for negative unix time dates

* add WriteNegativeIntegerEncoding tests

* implement checkpointing logic and apply to SkipValue() method

* implement checkpointing for tagged type readers

* store reader checkpoints in the stack

* add tests for rollback logic in tagged type readers

* add tested that utilizes nested reader state rollbacks

* use culture invariant decimal parsing in tests

* add WriteUnixTimeSeconds(double) method

* split unix time and string time readers into separate methods

* add WriteUnixTestSeconds invalid input test

* add support and tests for indefinite-length buffers in tagged types

* add PeekTag() tests

* add Read/WriteInt32() convenience methods

* add pervasive buffer postcondition checks on negative reader tests; fix related bug.

* add comment on DateTime parsing

* Rename CborReader.Peek() to CborReader.PeekState()

* Use correct overload for int32 handling

* add caching to CborReader.PeekState()

* Use "simple" instead of "special" for cbor major type

* add Write/ReadUInt32() convenience methods

* add uint32 negative tests

4 years agoImprove RegexCompiler's ToLower perf (#35203)
Stephen Toub [Tue, 21 Apr 2020 01:09:00 +0000 (21:09 -0400)]
Improve RegexCompiler's ToLower perf (#35203)

* Pool LocalBuilders in RegexCompiler

Currently GenerateGo/FindFirstChar create a few _tempLocal1, _tempLocal2, etc. LocalBuilders that various parts of the methods may use.  The developer then need to keep track of which of these locals is currently being used such that we maximize the re-use of them while not accidentally overlapping their use.  And the names end up being non-descriptive, so in some cases additional names are added for convenience.

The primary purpose of the PR is cleanup.  It adds a pool of LocalBuilders that lets them be rented just where they're needed, such that we only create locals when necessary, can give them appropriate names, etc.  However, it also makes it a lot easier for helpers to create temporary locals (e.g. as was done in EmitMatchCharacterClass) which then makes it easier to add additional optimizations.

* Avoid CultureInfo.TextInfo virtual calls in RegexCompiler

To support RegexOptions.IgnoreCase, RegexCompiler ends up generating a call to `char.ToLower(c, _culture)` for every character compared.  That `ToLower` call in turn needs to access `_culture.TextInfo`, and then call its `ToLower(char)` virtual method.  We can instead get the `TextInfo` once and call its `ToLower` method directly, saving a virtual call on every character being compared.

Note that we were already doing this (for .NET 5) in RegexInterpreter, but hadn't done it in RegexCompiler because of complications around locals management.  The previous commit fixed that and made this possible.

* Update src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs

4 years agoAdd microsoft-extensions to area owners (#35186)
Dan Moseley [Mon, 20 Apr 2020 23:03:09 +0000 (16:03 -0700)]
Add microsoft-extensions to area owners (#35186)

* Add extensions

* Add missing data rows

* Add area-CodeGen-LLVM-mono

Co-authored-by: Marek Safar <marek.safar@gmail.com>
4 years agoGuard against chaching of dangling global parent class of module (#35150)
Juan Hoyos [Mon, 20 Apr 2020 22:47:45 +0000 (15:47 -0700)]
Guard against chaching of dangling global parent class of module (#35150)

4 years agoAddress some edge cases in EncoderNLS.GetBytes draining logic (#35182)
Levi Broderick [Mon, 20 Apr 2020 22:41:24 +0000 (15:41 -0700)]
Address some edge cases in EncoderNLS.GetBytes draining logic (#35182)

4 years agoAdd test for native COM client consuming managed COM server with Events. (#35151)
Aaron Robinson [Mon, 20 Apr 2020 22:31:06 +0000 (15:31 -0700)]
Add test for native COM client consuming managed COM server with Events. (#35151)

4 years agoUse pinned arrays in Sockets (#34175)
Vladimir Sadov [Mon, 20 Apr 2020 19:14:44 +0000 (12:14 -0700)]
Use pinned arrays in Sockets (#34175)

* Use pinned arrays in SocketAsyncEventArgs

* Missed one case of defensive pinning.

4 years agoImprove char.ToUpperInvariant / ToLowerInvariant perf (#35194)
Levi Broderick [Mon, 20 Apr 2020 19:06:01 +0000 (12:06 -0700)]
Improve char.ToUpperInvariant / ToLowerInvariant perf (#35194)

4 years agoAddress PR feedback
Adeel [Mon, 20 Apr 2020 17:55:16 +0000 (17:55 +0000)]
Address PR feedback

4 years agoRemove passing tests from exclude list (#35139)
Fan Yang [Mon, 20 Apr 2020 17:49:40 +0000 (13:49 -0400)]
Remove passing tests from exclude list (#35139)

4 years ago[tests] Disable sgen-bridge.exe on Windows x64 FullAOT+LLVM (#35201)
monojenkins [Mon, 20 Apr 2020 17:44:30 +0000 (13:44 -0400)]
[tests] Disable sgen-bridge.exe on Windows x64 FullAOT+LLVM (#35201)

See https://github.com/mono/mono/issues/19603

Co-authored-by: akoeplinger <akoeplinger@users.noreply.github.com>
4 years agoOverride IsByRefLike on S.R.E.*Builder classes (#34846)
Marcus Turewicz [Mon, 20 Apr 2020 17:03:29 +0000 (03:03 +1000)]
Override IsByRefLike on S.R.E.*Builder classes (#34846)

* Override IsByRefLike on S.R.E.*Builder classes

Fixes #8828

* Adds tests

* Update System.Reflection.Emit.Tests.csproj

* Bumping CI

* Update mono as well

4 years ago[wasm][debugger] Implement `Runtime.callFunctionOn`, and support array expansion...
monojenkins [Mon, 20 Apr 2020 16:55:49 +0000 (12:55 -0400)]
[wasm][debugger] Implement `Runtime.callFunctionOn`, and support array expansion (#35156)

- This was prompted by vscode/vs requiring this for array expansion.
- It runs a given js function string, on a given object id.
- We handle the case for dotnet object ids.

Implementation:

- We build a proxy object that reflects the details of the real dotnet object/array
- And run the js function on that proxy object

- Then if `returnByValue` was requested, the result is returned as-is
- Else we cache that object, with a new special object id (`dotnet:cfo_res:..`),
  and return that id in the response.

- Subsequently, we would get `Runtime.getProperties` request on this new object id
- And a `Runtime.releaseObject` request, to free that function result.

- All this is handled currently

Tests:

- A few tests were added which invoke `callFunctionOn`, on JS objects, and checks the result
  - And the same checks are performed on equivalent dotnet objects, with the same js function
  - This should help stay in sync with what we think `callFunctionOn` should work as

  - These tests have an additional parameter - `roundtrip`, which calls a simple function
`function () { return this; }`
    .. on a dotnet object, and gets the result object id. If `roundtrip == true`, then it
    runs that same function on the result object, and gets a new result object id. And the
    tests run their checks on that.

    - this helps to check that outside of the proxy, the result object behaves same as any
      other dotnet object.

- Also, most of the tests were modified to support an additional mode (`use_cfo`).
  - With this, whenever a test wants to run `Runtime.getProperties on an object, we pass that
    object through the earlier "identity" function, and then run `getProperties` on that
    resultant object.

  - This helps to take advantage most of the existing tests, and use them for `callFunctionOn`
    testing too, by ensuring that the results of CFO returns results same as any other object.

Fixes mono/mono#19229, mono/mono#19531

Co-authored-by: radical <radical@users.noreply.github.com>
4 years agoAdd Reverse Diagnostics Server (#33307)
John Salem [Mon, 20 Apr 2020 16:12:21 +0000 (09:12 -0700)]
Add Reverse Diagnostics Server (#33307)

* Add Advertise IPC Command
* Update diagnostics server to use both reverse and traditional modes
* Change DOTNET_DiagnosticsServerAddress to DOTNET_DiagnosticsMonitorAddress and only use for reverse connection
* Add IpcStreamFactory abstraction
* IpcStreamFactory::Poll is now more similar to the poll API from Linux
* IpcPollHandle struct is used to abstract listening for client and server connections
* use overlapped io for all io on windows
* Add ConnectionState abstraction
* Implement timeout read/write

4 years agoSingle-File Bundler: Add a FileSize test (#35149)
Swaroop Sridhar [Mon, 20 Apr 2020 15:29:38 +0000 (08:29 -0700)]
Single-File Bundler: Add a FileSize test (#35149)

Add a bundler consistency tests that verifies that the size of each embedded file
(recorded in the bundle manifest) matches its original size of the file on disk.

4 years agoAdd ability to turn on just the portable executable verifier. (#35102)
monojenkins [Mon, 20 Apr 2020 14:39:32 +0000 (10:39 -0400)]
Add ability to turn on just the portable executable verifier. (#35102)

Helps fix issue: https://issuetracker.unity3d.com/issues/unity-crashes-when-opening-the-project

We were hitting a crash were a corrupted dll would get loaded and then hit an assert later on when something tried to use it. The verifier suite would correctly identify the dll as corrupt but it was impossible to turn on just the PE verification. I've added a new PE only mode above "off" to allow for just the PE verifier to be used instead of the larger verification suite.

Co-authored-by: UnityAlex <UnityAlex@users.noreply.github.com>
4 years agoHttp2LoopbackConnection properly handles stream termination (#35100)
Alexander Nikolaev [Mon, 20 Apr 2020 13:32:54 +0000 (15:32 +0200)]
Http2LoopbackConnection properly handles stream termination (#35100)

PR adds an optional stream termination handling to `Http2LoopbackConnection.ReadBodyAsync` and fixes `HttpClient` construction missing the `SocketHttpHandler` created in the test.

Fixes #31220

4 years agoRemove MicrosoftFileFormatsVersion from eng/Versions.props
Jan Vorlicek [Thu, 16 Apr 2020 08:07:09 +0000 (01:07 -0700)]
Remove MicrosoftFileFormatsVersion from eng/Versions.props

4 years agoRemove notions of the buildtools and the GetModuleIndex
Jan Vorlicek [Wed, 15 Apr 2020 21:16:58 +0000 (23:16 +0200)]
Remove notions of the buildtools and the GetModuleIndex

4 years agoAdd Mono-specific check for uninitialized default ALC on Resolving event (#35192)
Ryan Lucia [Mon, 20 Apr 2020 11:55:53 +0000 (07:55 -0400)]
Add Mono-specific check for uninitialized default ALC on Resolving event (#35192)

Unlike the other resolvers, this one *can* exist on the default ALC, so we have to add the null check like in GetAssemblyLoadContext.

Move the now-unused ResolveUsingResolvingEvent method back to the CoreCLR-specific file.

4 years agoCastTable perf tweaks. (#34427)
Vladimir Sadov [Mon, 20 Apr 2020 02:49:14 +0000 (19:49 -0700)]
CastTable perf tweaks. (#34427)

* No null check in Get.

* bypass AuxData

4 years ago[mono] Fix multidimensional array construction when using programmer-specified lower...
monojenkins [Sun, 19 Apr 2020 23:34:08 +0000 (19:34 -0400)]
[mono] Fix multidimensional array construction when using programmer-specified lower bounds. (#35091)

* [mono] Fix multidimensional array construction when using programmer-specified lower bounds.

mono_array_full_new_checked and mono_array_full_new (which is marked as
a MONO_API function) both take two pointers to buffers containing
lengths and lower bounds. mono_array_new_n_icall can split the incoming
parameter list in two before forwarding the results to
mono_array_full_new_checked, so mono_array_full_new_checked was
receiving two buffers containing interleaved lower bounds and lengths.

ECMA-335 states that array constructors that specify both lower bounds
and lengths interleave these values. Deinterleave these
in method_to_ir.

Add some tests to iltests.il that verify that multidimensional arrays
with custom lower bounds work.

Fixes https://github.com/dotnet/runtime/issues/34377.
Fixes https://github.com/dotnet/runtime/issues/34378.
Fixes https://github.com/dotnet/runtime/issues/34381.

* Deinterleave lower bounds and array lengths in the interpreter.

Also make the condition in which the deinterleaving code path is taken
more precise. Perhaps this branch should be marked as unlikely.

* Fix a typo.

Co-authored-by: imhameed <imhameed@users.noreply.github.com>
4 years agoUpdate shared-generics.md to use `Method<>` instead of `Func<>` (#35181)
nietras [Sun, 19 Apr 2020 21:23:26 +0000 (23:23 +0200)]
Update shared-generics.md to use `Method<>` instead of `Func<>` (#35181)

To avoid confusion with `Func<>` delegate and object. At least to me it create a bit of unnecessary confusion. Whether this should be `Method` or just `F` can be discussed. However, `Method` makes it clear the discussion is about a generic **method** instantiation.

4 years agofixing building of projects in VS (#35146)
Anirudh Agnihotry [Sun, 19 Apr 2020 17:09:42 +0000 (10:09 -0700)]
fixing building of projects in VS (#35146)

4 years agoMake MappingType more usable (#35168)
Andrew Au [Sun, 19 Apr 2020 17:03:57 +0000 (10:03 -0700)]
Make MappingType more usable (#35168)

4 years ago[meta] Mono ALC embedding primer (#34601)
Ryan Lucia [Sun, 19 Apr 2020 08:13:57 +0000 (04:13 -0400)]
[meta] Mono ALC embedding primer (#34601)

* [meta] Expose managed ALC fields to the runtime

* [meta] Add mono_assembly_load_full_alc to unstable

* [loader] Add preload hook V3 for netcore embedding API

* [loader] Add append parameter to preload hook V3 installation

* [meta] Fix ALC usage to be netcore-only

* Move Sequential attribute to Mono ALC declaration

* Feedback

4 years agoPort CoreCLR to SunOS
Adeel [Sun, 19 Apr 2020 05:10:45 +0000 (05:10 +0000)]
Port CoreCLR to SunOS

4 years agofix ping on OSX when running as root (#35070)
Tomas Weinfurt [Sat, 18 Apr 2020 19:42:54 +0000 (12:42 -0700)]
fix ping on OSX when running as root (#35070)

* fix ping on OSX when running as root

* feedback from review

* limit disabling DualMode to OSX

* fix osx

Co-authored-by: Tomas Weinfurt <furt@Shining.local>
4 years agoadd FreeBSD build (#34521)
Tomas Weinfurt [Sat, 18 Apr 2020 18:50:00 +0000 (11:50 -0700)]
add FreeBSD build (#34521)

* try to add FreeBSD to the build

* s/FreeBSD/FReeBSD_x64

* more fixes to pass -os FreeBSD

* add missing :

* more fixes and feedback from review

* pull in new container

* fix corelib-nativecorelib-tools-packages as well

* add crossrootfsDir

* pass crossrootfsDir

* fix installr

* fix compilation on freebsd

* fix test build on freebsd

* update to match new layout

* fix native tests

* CrossBuild?

* rootfsDir debug

* merge with linux to get container support

* fix proc_maps

* fix up buildCommandSourcesDirectory

* remove debug

* more fixup for buildCommandSourcesDirectory

* use TargetOS instead of os

* remove old section

* rever changes to get_loaded_library_from_proc_maps

* fix compilation with missing getline

* add official build

* use arch

* remove special pool for freebsd

* roll-back runtime-official.yml

Co-authored-by: Tomas Weinfurt <furt@Shining.local>
Co-authored-by: Tomas Weinfurt <furt@tocherni-t490s.middleeast.corp.microsoft.com>
4 years agoEnable JIT/Regression/JitBlue/DevDiv_578214/DevDiv_578214 for mono. (#35120)
imhameed [Sat, 18 Apr 2020 18:08:20 +0000 (11:08 -0700)]
Enable JIT/Regression/JitBlue/DevDiv_578214/DevDiv_578214 for mono. (#35120)

4 years agoUpdate dependencies from https://github.com/microsoft/vstest build 20200416-02 (...
dotnet-maestro[bot] [Sat, 18 Apr 2020 17:45:12 +0000 (19:45 +0200)]
Update dependencies from https://github.com/microsoft/vstest build 20200416-02 (#35155)

- Microsoft.NET.Test.Sdk: 16.7.0-preview-20200408-06 -> 16.7.0-preview-20200416-02

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoMake GCToEEInterface::Get*ConfigValue check the runtimeconfig.json (#34797)
Andrew Au [Sat, 18 Apr 2020 17:21:27 +0000 (10:21 -0700)]
Make GCToEEInterface::Get*ConfigValue check the runtimeconfig.json (#34797)

4 years agoImplement native GetModuleIndex
Jan Vorlicek [Wed, 15 Apr 2020 11:19:41 +0000 (13:19 +0200)]
Implement native GetModuleIndex

This change replaces managed GetModuleIndex tool by shell scripts using
native tools.

4 years agoEnclose paths with quotes in testPackages.proj (#34791)
Carlos Sanchez Lopez [Sat, 18 Apr 2020 08:03:10 +0000 (01:03 -0700)]
Enclose paths with quotes in testPackages.proj (#34791)

* Enclose paths with quotes in testPackages.proj

4 years agoRemove verbose test output logging (#35104)
Viktor Hofer [Sat, 18 Apr 2020 08:01:50 +0000 (10:01 +0200)]
Remove verbose test output logging (#35104)

Fixes https://github.com/dotnet/runtime/issues/33926.

As we ContinueOnError and error by reading from the ExitCode property we can set IgnoreExitCode in the msbuild Exec invocation to avoid the following verbose output: `error MSB4132: The "Exec" task returned false but did not log an error.`

4 years agoFixes nits identified in https://github.com/dotnet/runtime/pull/34980 (#35121)
Steve Pfister [Sat, 18 Apr 2020 07:48:30 +0000 (03:48 -0400)]
Fixes nits identified in https://github.com/dotnet/runtime/pull/34980 (#35121)

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
4 years agoFixing several of the Sse/Sse2.Compare* intrinsics to account for NaN inputs (#34204)
Tanner Gooding [Sat, 18 Apr 2020 04:39:17 +0000 (21:39 -0700)]
Fixing several of the Sse/Sse2.Compare* intrinsics to account for NaN inputs (#34204)

* Adding a regression test to validate the Sse.CompareGreaterThan and related behaviors

* Fixing several of the Sse/Sse2.Compare* intrinsics to account for NaN inputs

* Applying format patch

* Switch to using compOpportunisticallyDependsOn

* Use the named intrinsic comparison macros rather than magic numbers

* Applying formatting patch

* Define the _CMP hwintrinsic macros since they aren't available by default on Unix

* Simplifying the special importation logic for Sse/Sse2 compare GreaterThan functions

* Applying formatting patch

* Add a comment explaining the naming of the _CMP_* macros used by the x86 HWIntrinsics

* Switch to mirroring the FloatComparisonMode enum rather than using the _CMP_* macros

* Apply formatting patch

* Don't use XML style doc comments for the FloatComparisonMode mirror on the C++ side

* Ensure the base type is set before it is checked

* Applying formatting patch

4 years agoRemove erroneous curlies in Xml resource (#33890)
mrj001 [Sat, 18 Apr 2020 03:55:36 +0000 (21:55 -0600)]
Remove erroneous curlies in Xml resource  (#33890)

* Added test for Issue 30218, use of resource Sch_MinLengthGtBaseMinLength

* Reworded error message to remove the invalid formatters.

Issue #30218

* Updated check of message from the exception to be more amenable to potential internationalization.

* Reworded resource Sch_MaxLengthGtBaseMaxLength and added unit test for same.

* Simplified test code per feedback from Dan Moseley, PR#33890.

* Tests to increase code coverage.   The ones that are failing trigger resource string Sch_MaxMinLengthBaseLength to be used as the Exception message.

* Removed invalid formatters from the resource string Sch_MaxMinLengthBaseLength.  Failing tests from the previous commit now pass.

* Added test for the Exception using string resource Sch_LengthGtBaseLength as its message.  This covers a source line and branch not previously covered.  This test fails due to the invalid formatters.

* Reworded string resource Sch_LengthGtBaseLength to remove the invalid formatters.

* Added unit tests for uses of string resource Sch_FacetBaseFixed.

* Made test for the message containing "fixed" more specific.

* Reworded string resource Sch_FacetBaseFixed to remove the invalid formatter.

* Added unit test to cover usage of string resource Sch_InvalidAllMax.  A second usage of this string resource is not covered as it is in a class marked Obsolete.

* Reworded string resource Sch_InvalidAllMax to remove the invalid formatter.

* Added unit test for String Resource Sch_InvalidAllElementMax - invalid formatter.

* Reworded string resource Sch_InvalidAllElementMax to remove the invalid formatter.

* Added unit test which causes an XmlSchemaException using string resource Sch_InvalidExemplar as its message.

* Reworded Sch_InvalidExemplar to remove the invalid formatter.  Also, added the name of the element which cannot be used as the substitution group affiliation.

* Added unit test that causes an XmlSchemaException to be thrown using string resource Sch_GroupBaseRestNotEmptiable as its message.

* Removed the curly braces so there are no longer any invalid formatters.

* Added unit tests that cause an XmlSchemaException to be thrown using string resource Sch_AllRefMinMax as its message.

* Changed string resource Sch_AllRefMinMax to remove the invalid formatters.

* reworded Sch_MinLengthGtBaseMinLength and Sch_MaxLengthGtBaseMaxLength similarly to Sch_LengthGtBaseLength

* Corrected error "greater than" to "less than".

* Changed name of test to more accurately  reflect its purpose.

* Changed casing of MinLength and MaxLength to match their XML facets.  Removed redundant ToLower call and comment.

* Removed all Regex used to find invalid formatters.

* renamed MaxMinLengthBaseLength_TestData to indicate that this is testing the successful case.

* Removed suppression of exception so that we will see the exception if one is thrown.

* Removed comments as there are issues tracking these.

* Fixed comment larger -> lower.

* Removed XML comments on test methods.

* Removal of XML comment that was missed.

4 years agoFix all runtime IL generation paths from passing GC types to unmanaged function calls...
Aaron Robinson [Sat, 18 Apr 2020 03:50:39 +0000 (20:50 -0700)]
Fix all runtime IL generation paths from passing GC types to unmanaged function calls. (#35026)

* Native COM clients have not been running since we switched over to SDK projects.

* Stop IL generators from passing GC types to unmanaged function calls.
Update crossgen2 IL stub generators.
Update Dynamic runtime stub generator.
Add assert for GC types in unmanaged function calls.

4 years agoRename ReadyToRun.SuperIlc to just R2RTest to save typing (#35110)
Tomáš Rylek [Sat, 18 Apr 2020 03:37:54 +0000 (05:37 +0200)]
Rename ReadyToRun.SuperIlc to just R2RTest to save typing (#35110)

* Rename ReadyToRun.SuperIlc to just R2RTest to save typing

* Apply the SuperIlc -> R2RTest rename to crossgen determinism test

4 years agoFix collectible AssemblyLoadContext shutdown race (#35131)
Jan Vorlicek [Sat, 18 Apr 2020 03:34:37 +0000 (05:34 +0200)]
Fix collectible AssemblyLoadContext shutdown race (#35131)

When the last reference to a collectible AssemblyLoadContext goes away,
its finalizer is called on the finalizer thread. It ends up calling the
native CLRPrivBinderAssemblyLoadContext::PrepareForLoadContextRelease
method which replaces a long weak GC handle to the managed
AssemblyLoadContext stored in the CLRPrivBinderAssemblyLoadContext by a
strong GC handle to the same AssemblyLoadContext and closes the original
weak handle.
The problem is that another thread may have read the weak handle pointer
and then try to use it to call into the resolving methods on the managed
AssemblyLoadContext. If that thread tries to resolve the related handle
after the finalizer thread has closed it, it fails as the handle doesn't
exist anymore. It could even get a completely different object if the
handle got reused in between. Or even worse, if the handle got reused by
another AssemblyLoadContext, the handle would resolve, but to the
different AssemblyLoadContext.

This change fixes the problem by keeping the weak handle open and
closing it after the AssemblyLoadContext shutdown completes (there are
no more assemblies that were loaded into that context and no instances
of types from those assemblies). The strong handle now serves only to
keep the managed AssemblyLoadContext alive.

4 years agoSpanize interop in System.Net.NetworkInformation (#35098)
Jan Kotas [Sat, 18 Apr 2020 01:21:57 +0000 (18:21 -0700)]
Spanize interop in System.Net.NetworkInformation (#35098)

Faster and safer

4 years agoUse ReadOnlySpan<byte> instead of byte arrays in CAPI helpers (#35125)
Kevin Jones [Fri, 17 Apr 2020 23:44:45 +0000 (19:44 -0400)]
Use ReadOnlySpan<byte> instead of byte arrays in CAPI helpers (#35125)

4 years ago[wasm][debugger] Show pointer type+address (#34934)
monojenkins [Fri, 17 Apr 2020 20:16:08 +0000 (16:16 -0400)]
[wasm][debugger] Show pointer type+address (#34934)

Co-authored-by: radical <radical@users.noreply.github.com>
4 years agoprofiler tests depend on jit events (#34919)
David Mason [Fri, 17 Apr 2020 20:00:39 +0000 (13:00 -0700)]
profiler tests depend on jit events  (#34919)

* profiler tests depend on jit events so disable R2R images via profiler eventmask

* fix RequestReJITWithInliners for R2R modules

* Update tests to work correctly when crossgenned

* fix issue where test was treating an HRESULT as a FunctionID

* fix alpine failures. you can dlopen a relative path in glib, but apparently with musl you have to have the full path. So look at /proc/self/maps to find the full path to the loaded coreclr

* re-enable profiler tests now that they are passing

* Code review feedback

* Update rejit.cpp

4 years agoEnable cross OS DBI build (#35021)
Steve MacLean [Fri, 17 Apr 2020 19:58:26 +0000 (15:58 -0400)]
Enable cross OS DBI build (#35021)

* Enable cross OS DBI build

* Fix .gitignore

* Fix Cross OS DBI compilation issues

* Review feedback

* Cleanup dummy/twowaypipe.cpp

4 years agoAdd wasm for browser RID (#34940)
Marek Safar [Fri, 17 Apr 2020 19:33:49 +0000 (21:33 +0200)]
Add wasm for browser RID (#34940)

4 years agoDisable IPGlobalProperties_TcpActiveConnections_Succeed test on Mono/Windows (#35113)
Jan Kotas [Fri, 17 Apr 2020 18:37:32 +0000 (11:37 -0700)]
Disable IPGlobalProperties_TcpActiveConnections_Succeed test on Mono/Windows (#35113)

Fixes #35111

4 years agoUpdate VS minimum dependency (#35114)
Viktor Hofer [Fri, 17 Apr 2020 18:00:49 +0000 (20:00 +0200)]
Update VS minimum dependency (#35114)

With the net5.0 TFM change and the nuget static graph restore, we require VS >= 16.6 Preview2.

4 years agoAdds support for generating Mono named NETCore.App Runtime Packs (#34980)
Steve Pfister [Fri, 17 Apr 2020 17:46:30 +0000 (13:46 -0400)]
Adds support for generating Mono named NETCore.App Runtime Packs (#34980)

Starting with osx, we will produce a uniquely named runtime pack with Mono.  The intent is to give the sdk an easier way to identify the mono runtime.

We will now publish Microsoft.NETCore.App.Mono.Runtime.<rid>.nupg

4 years agoThrow DirectoryNotFoundException on Image.Save with bad directory (#34998)
Brooke Philpott [Fri, 17 Apr 2020 17:00:58 +0000 (13:00 -0400)]
Throw DirectoryNotFoundException on Image.Save with bad directory (#34998)

* Provide better exception when saving to non-existent directory

When saving an image to a non-existent directory, throw a DirectoryNotFoundException
vs a System.Runtime.InteropServices.ExternalException.

Fix #31367

* Change exception message to be more intuitive

Use: The directory {0} of the filename {1} does not exist.
instead of: The target directory {0} of the targetPath {1} does not exist.

Fix #31367

* Fix test on unix by using built path.

We were using a hardcoded path with backslashes. That didn't match the built path for the Assert.

* Make Test conditional as it requires GDI+

* Put directory check closer to where it's used to ensure that we
capture it from all Save variations.

* Remove trailing whitespace

* Update test to ensure it doesn't run on the .NET Framework

* Change CheckIfDirectoryExists to ThrowIfDirectoryDoesntExist
to match naming conventions for throw-style methods.

Fix #31367

* Fixes typo in test name

Fix #31367