platform/upstream/dotnet/runtime.git
2 years agoFix default log color behavior when console is redirected (#70504)
Maryam Ariyan [Mon, 20 Jun 2022 17:08:47 +0000 (13:08 -0400)]
Fix default log color behavior when console is redirected (#70504)

2 years agoFix arm64 funclet frame type 5 (#70922)
Bruce Forstall [Mon, 20 Jun 2022 16:55:17 +0000 (09:55 -0700)]
Fix arm64 funclet frame type 5 (#70922)

* Fix arm64 funclet frame type 5

* Add code to stress arm64 funclet frame type 5

This can be forced using `COMPlus_JitSaveFpLrWithCalleeSavedRegisters=3`,
or will be enabled under stress.

* Add a regression test

* Fix funclet frame type 5 alignment calculation

* Fix a couple bugs; improve documentation

1. Improve the frame shape pictures, especially for arm64 funclet frames. Include the
MonitorAcquired element and OSR pad.
2. Fix bug for `SP_to_PSP_slot_delta` for funclet frame type 4 for OSR: don't include osrPad.
3. Fix bug with funclet frame type 5 for `SP_to_FPLR_save_delta` using wrong aligned func size;
would be incorrect if one and two SP adjustment full frame aligned sizes are different (e.g.,
if two SP adjustment required two alignment slots and one SP adjustment thus required none).

2 years agoMinor refactoring for `UpgradeToRegexGeneratorAnalyzer` (#70767)
Youssef Victor [Mon, 20 Jun 2022 14:50:37 +0000 (16:50 +0200)]
Minor refactoring for `UpgradeToRegexGeneratorAnalyzer` (#70767)

2 years agoCollections contain stale object IDs (#70924)
Aaron Robinson [Mon, 20 Jun 2022 14:48:37 +0000 (07:48 -0700)]
Collections contain stale object IDs (#70924)

It looks like the collections contain stale
ObjectID values. These collection should
be purged between GCs.

2 years agoUpstream coreclr and pal changes to support powerpc (ppc64le) architecture (#69105)
Vikas Gupta [Mon, 20 Jun 2022 12:28:47 +0000 (17:58 +0530)]
Upstream coreclr and pal changes to support powerpc (ppc64le) architecture  (#69105)

* coreclr pal layer chanegs.

* Updated the system arch for power architecture.

* Fixed the failing PAL SXS exception_handling test case

* replaced gint with gint64 to avoid overflow and this has fixed the segmentation fault issue.

* coreclr pal layer chanegs.

* Fixed the failing PAL SXS exception_handling test case

* coreclr pal layer chanegs.

* Updated the system arch for power architecture.

* Fixed the failing PAL SXS exception_handling test case

* replaced gint with gint64 to avoid overflow and this has fixed the segmentation fault issue.

* coreclr pal layer chanegs.

* Fixed the failing PAL SXS exception_handling test case

* Removing intsafe.h file as main does not have this file now.(Already removed in commit 27195f670937c7e21ab68a806396f9d17c57231a)

Co-authored-by: Alhad Deshpande <Alhad.Deshpande1@ibm.com>
2 years agoStop wrapping SIMD nodes in OBJs (#70888)
SingleAccretion [Mon, 20 Jun 2022 12:07:53 +0000 (15:07 +0300)]
Stop wrapping SIMD nodes in OBJs (#70888)

2 years ago[QUIC] Removes abstract providers and mock from S.N.Quic (#70421)
Marie Píchová [Mon, 20 Jun 2022 10:44:29 +0000 (12:44 +0200)]
[QUIC] Removes abstract providers and mock from S.N.Quic (#70421)

* Removed abstract providers and mock from S.N.Quic

* Removed provider and replaced with statics on Listener and Connection

* Added assert

2 years agoFix nullable annotations on MailAddress.TryCreate (#70943)
Stephen Toub [Mon, 20 Jun 2022 10:16:00 +0000 (06:16 -0400)]
Fix nullable annotations on MailAddress.TryCreate (#70943)

2 years agoEnable IDE0031 (Use null propagation) (#70965)
Stephen Toub [Mon, 20 Jun 2022 09:47:48 +0000 (05:47 -0400)]
Enable IDE0031 (Use null propagation) (#70965)

2 years ago[main] Update dependencies from dotnet/arcade (#70662)
dotnet-maestro[bot] [Mon, 20 Jun 2022 08:00:57 +0000 (10:00 +0200)]
[main] Update dependencies from dotnet/arcade (#70662)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFixes #64159 - JsonSerializerContext source generation fails with keyword identifiers...
Steve Dunn [Mon, 20 Jun 2022 07:38:23 +0000 (08:38 +0100)]
Fixes #64159 - JsonSerializerContext source generation fails with keyword identifiers (#66876)

* Fixes #64159 - initial implementation

* Tidy up, and add test for ignored reserved-keyword-named property

* PR feedback - use same approach as logging generator

* PR feedback

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs

Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
* PR feedback - rename ExactNameSpecifiedInSourceCode

* PR feedback - use extracted (and renamed) local variable

* Remove commented code

* Added `IsVerbatimName` as extension method

* Support fields with verbatim names (@)

* Use alternative method for checking for verbatim names

* Uses `SyntaxFacts` to determine if escaping is needed

* Remove extension method

* Modified source generator test to include a verbatim field

* Minor typo

Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
2 years agoAdd support for randomized guard stack cookies (#70806)
Michal Strehovský [Mon, 20 Jun 2022 07:27:51 +0000 (16:27 +0900)]
Add support for randomized guard stack cookies (#70806)

The compiler was generating GS cookies, but the cookie was always an ASCII encoding of "Hi, mom!".

Make the cookie properly per-process randomized.

The randomization algorithm is same as in the CoreCLR VM.

Fixes #70071.

2 years agoDisable W^X on macOS under Rosetta emulation (#70912)
Jan Vorlicek [Mon, 20 Jun 2022 07:05:45 +0000 (09:05 +0200)]
Disable W^X on macOS under Rosetta emulation (#70912)

* Disable W^X on macOS under Rosetta emulation

Apple has informed us that double mapping doesn't work properly
on Rosetta emulation. This change disables W^X if Rosetta is detected.

* Reflect PR feedback

2 years agoFix illumos-x64 build (#70956)
Adeel Mujahid [Mon, 20 Jun 2022 01:54:42 +0000 (04:54 +0300)]
Fix illumos-x64 build (#70956)

2 years agoMake SuperPMI more explicit about JIT in error messages (#70938)
Bruce Forstall [Mon, 20 Jun 2022 01:52:49 +0000 (18:52 -0700)]
Make SuperPMI more explicit about JIT in error messages (#70938)

This makes it easier to figure out which JIT failed in asmdiffs scenarios.

e.g.,
```
[10:40:50] ERROR: Method 3673 of size 3107 failed to load and compile correctly by JIT2 (C:\gh\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit_universal_arm64_x64.dll).
[10:40:50] ERROR: Method 3673 of size 3107 failed to load and compile correctly by JIT1 (C:\gh\runtime2\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit_universal_arm64_x64.dll).
```

2 years agoEnable `TYP_STRUCT` `LCL_VAR/LCL_FLD` call args on Windows x64 (#70777)
SingleAccretion [Sun, 19 Jun 2022 20:44:36 +0000 (23:44 +0300)]
Enable `TYP_STRUCT` `LCL_VAR/LCL_FLD` call args on Windows x64 (#70777)

* Fix forward sub

* Enable folding in local morph

* Morph: TYP_STRUCT LCL_FLD

2 years agoDo not reuse implicit byrefs for by-value args (#70955)
SingleAccretion [Sun, 19 Jun 2022 20:36:06 +0000 (23:36 +0300)]
Do not reuse implicit byrefs for by-value args (#70955)

* Do not reuse implicit byrefs for by-value args

* Add a test

2 years agoEnable IDE0030 (Use coalesce expression) (#70948)
Stephen Toub [Sun, 19 Jun 2022 13:08:59 +0000 (09:08 -0400)]
Enable IDE0030 (Use coalesce expression) (#70948)

2 years agoAllow ValueListBuilder to work with empty scratch spans (#70917)
Stephen Toub [Sun, 19 Jun 2022 11:55:32 +0000 (07:55 -0400)]
Allow ValueListBuilder to work with empty scratch spans (#70917)

2 years agoUpdate C# compiler (#70947)
Stephen Toub [Sun, 19 Jun 2022 11:52:45 +0000 (07:52 -0400)]
Update C# compiler (#70947)

Brings in support for required members

2 years agoOptimization for full range checks (#70145) (#70222)
Sychev Vadim [Sun, 19 Jun 2022 10:30:09 +0000 (13:30 +0300)]
Optimization for full range checks (#70145) (#70222)

2 years agoEnable IDE0065 (Misplaced using directive) (#70919)
Stephen Toub [Sun, 19 Jun 2022 04:44:31 +0000 (00:44 -0400)]
Enable IDE0065 (Misplaced using directive) (#70919)

2 years agoEnable IDE0100 (Remove redundant equality) (#70896)
Stephen Toub [Sun, 19 Jun 2022 04:43:37 +0000 (00:43 -0400)]
Enable IDE0100 (Remove redundant equality) (#70896)

2 years agoEnable IDE0071 (Simplify interpolation) (#70918)
Stephen Toub [Sun, 19 Jun 2022 04:41:30 +0000 (00:41 -0400)]
Enable IDE0071 (Simplify interpolation) (#70918)

2 years agoEventLogException is missing the original win32 error code (#70629)
Badre BSAILA [Sun, 19 Jun 2022 04:20:37 +0000 (06:20 +0200)]
EventLogException is missing the original win32 error code (#70629)

2 years agosuperpmi.py: Add `-jitoption` for asmdiffs (#70939)
Bruce Forstall [Sat, 18 Jun 2022 19:53:53 +0000 (12:53 -0700)]
superpmi.py: Add `-jitoption` for asmdiffs (#70939)

The new `-jitoption` option passes the argument options to both baseline and diff
compilers. This is a convenience option: there already is `-base_jit_option` and
`-diff_jit_option` to specify passing options to either baseline or diff.

The name of the option is the same as that used for `replay`.

2 years agoRemove some dead code / branches (#70146)
Stephen Toub [Sat, 18 Jun 2022 12:21:09 +0000 (08:21 -0400)]
Remove some dead code / branches (#70146)

* Remove some dead code / branches

Some signal amidst the noise in an lgtm.com report.

* Address PR feedback

2 years agoEnable lib tests that used to fail with GC issues (#70831)
Lakshan Fernando [Sat, 18 Jun 2022 11:49:24 +0000 (04:49 -0700)]
Enable lib tests that used to fail with GC issues (#70831)

* enable lib tests that used to fail with GC issues

* excluding linq parallel test since that doesn't build

* Threading.Thread tests have issues

* Excluding new test failures

2 years agoUse u8 in a few more places (#70894)
Stephen Toub [Sat, 18 Jun 2022 10:48:26 +0000 (06:48 -0400)]
Use u8 in a few more places (#70894)

* Use u8 in a few more places

* A few more u8s

2 years agoHarden for null byrefs (#70317)
Aaron Robinson [Sat, 18 Jun 2022 04:31:25 +0000 (21:31 -0700)]
Harden for null byrefs (#70317)

* Remove enum_flag_Unrestored usage in boxing stubs.

* Add AND instruction (21h) to x86 decoder.

* Update mono for null ref in interpreter paths.

* Disable test on llvmfullaot and wasm

* Handle null destination for intrinsics.

2 years ago[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet...
dotnet-maestro[bot] [Sat, 18 Jun 2022 03:53:03 +0000 (23:53 -0400)]
[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet/runtime-assets dotnet/emsdk dotnet/roslyn-analyzers (#70476)

* Update dependencies from https://github.com/dotnet/runtime-assets build 20220608.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22308.1

* Update dependencies from https://github.com/dotnet/emsdk build 20220608.2

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22308.2

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22305.1 -> To Version 1.0.0-prerelease.22310.1

* Revert "Update dependencies from https://github.com/dotnet/emsdk build 20220608.2"

This reverts commit bbb4e156ddbad8a2cb7b604246214272085b6622.

* Update dependencies from https://github.com/dotnet/icu build 20220609.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-preview.6.22306.1 -> To Version 7.0.0-preview.6.22309.1

* Update dependencies from https://github.com/dotnet/emsdk build 20220608.2

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22308.2

* Update dependencies from https://github.com/dotnet/runtime-assets build 20220610.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22310.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20220610.1

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 7.0.0-preview1.22302.1 -> To Version 7.0.0-preview1.22310.1

* Update dependencies from https://github.com/dotnet/runtime build 20220612.5

Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , System.Text.Json
 From Version 7.0.0-preview.6.22305.4 -> To Version 7.0.0-preview.6.22312.5

* Update dependencies from https://github.com/dotnet/icu build 20220613.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-preview.6.22306.1 -> To Version 7.0.0-preview.6.22313.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22310.1 -> To Version 1.0.0-prerelease.22313.1

* Update dependencies from https://github.com/dotnet/runtime-assets build 20220613.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22313.1

* Update dependencies from https://github.com/dotnet/emsdk build 20220613.1

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22313.1

* [wasm] Wasm.Build.Tests: Disable strict version checks for emcc

Due to the way we have to update `dotnet/emsdk`, and get the update PRs
in `runtime`, the emsdk version can be mismatched. For example, if
`dotnet/emsdk` has already updated to `3.1.12`, but `dotnet/runtime` is
still on `3.1.7`. This is an expected scenario while working on updating
to a newer emscripten.

The version mismatch will still show up, but as a warning now.

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22310.1 -> To Version 1.0.0-prerelease.22314.1

* [wasm] Wasm.Build.Tests: Update Skiasharp reference

The skiasharp dependent tests fail with:
`error : undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv`.

Update the reference to the latest package which added a binary compiled
for `3.1.7`.

* [wasm] Workaround a test failure in WBT

Currently, there is a mismatch between emsdk versions with the workload
emscripten packs using `3.1.12`, and the runtime being built with
`3.1.7`. And that is causing
`Wasm.Build.Tests.NativeLibraryTests.ProjectUsingSkiaSharp` to fail with:

```
EXEC : error : undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : Link with `-sLLD_REPORT_UNDEFINED` to get more information on undefined symbols [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0` [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : error : undefined symbol: _ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : __ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : error : Aborting compilation due to previous errors [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
emcc : error : '/datadisks/disk1/work/B1420981/w/ACC90933/e/dotnet-workload/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Node.linux-x64/7.0.0-preview.6.22313.1/tools/bin/node /datadisks/disk1/work/B1420981/w/ACC90933/e/dotnet-workload/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Sdk.linux-x64/7.0.0-preview.6.22313.1/tools/emscripten/src/compiler.js /datadisks/disk1/work/B1420981/t/tmp44tn7y2d.json' failed (returned 1) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
```

This commit adds a temporary workaround to ignore the undefined symbols
for this specific test. And this should be removed when runtime is
updated to `3.1.12` .

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoAppend the function pointer type (#70923)
Aaron Robinson [Sat, 18 Jun 2022 03:05:47 +0000 (20:05 -0700)]
Append the function pointer type (#70923)

The issue here was the recursion into PrettyPrintSigWorkerInternal
that would reset the buffer. Now, we pass in a new buffer and append
it when we return.

2 years agoUse ArgumentNullException.ThrowIfNull in a few more places (#70897)
Stephen Toub [Sat, 18 Jun 2022 00:36:47 +0000 (20:36 -0400)]
Use ArgumentNullException.ThrowIfNull in a few more places (#70897)

2 years agoAdd support for delegate GDV and method-based vtable GDV (#68703)
Jakob Botsch Nielsen [Fri, 17 Jun 2022 23:58:01 +0000 (01:58 +0200)]
Add support for delegate GDV and method-based vtable GDV (#68703)

Add support for instrumenting delegate calls and vtable calls into method handle histograms. Use these histograms to do GDV for delegate calls and also support method-based GDV for vtable calls.

For instrumentation we now support class probes at interface call sites, method probes at delegate call sites and both class probes and method probes at vtable call sites. For vtable calls, when turned on, instrumentation produces both histograms as PGO data so that the JIT can later make the choice about what is the best form of guard to use at that site.

For guarding, there are some things to take into account. Delegate calls currently (practically) always point to precode, so this PR is just guarding on getFunctionFixedEntryPoint which returns the precode address, and this is generally quite cheap (same cost as class-based GDV). That's the case for delegates pointing to instance methods anyway, this PR does not support static methods yet -- those will be more expensive.

For vtable calls the runtime will backpatch the slots when tiering, so the JIT guards the address retrieved from the vtable against an indirection of the slot, which is slightly more expensive than a class-based guard.

Currently the instrumentation is enabled conditionally with COMPlus_JitDelegateProfiling=1 (for delegates) and COMPlus_JitVTableProfiling=1 (for vtable calls). Currently delegate profiling is turned on by default while vtable profiling is off by default.

2 years agoReplace the remaining uses of Marshal.PtrToStructure in core networking (#70900)
Jan Kotas [Fri, 17 Jun 2022 23:51:17 +0000 (16:51 -0700)]
Replace the remaining uses of Marshal.PtrToStructure in core networking (#70900)

* Rename ICMP interop to match Windows SDK names

2 years agoFix ICorDebugFunction2::GetVersionNumber for arm32. (#69901)
Mikhail Kurinnoi [Fri, 17 Jun 2022 23:02:28 +0000 (02:02 +0300)]
Fix ICorDebugFunction2::GetVersionNumber for arm32. (#69901)

2 years agoRemove #define Sleep (#70868)
Aaron Robinson [Fri, 17 Jun 2022 22:38:07 +0000 (15:38 -0700)]
Remove #define Sleep (#70868)

* Remove #define Sleep

2 years agoFix bug in Tar preventing extraction of hardlinks or entries starting with `.\` ...
Carlos Sanchez [Fri, 17 Jun 2022 21:02:07 +0000 (14:02 -0700)]
Fix bug in Tar preventing extraction of hardlinks or entries starting with `.\` (#70853)

* Add PlatformDetection.SupportsHardLinkCreation property.

* Fix how paths are combined/joined and sanitized on extraction, to ensure paths with redundant segments get properly handled.

* Add tests that verify archives with entries whose paths start with .\, including the root folder itself.

* Re-enable the hardlink test, condition it to not run if platform does not support extraction of hardlinks.

* Remove unnecessary test - This same code is already being tested by TarReader_ExtractToFile_Tests.ExtractEntriesWithSlashDotPrefix

* Reuse test code that retrieves memory stream.

* Bump test data package version

* Add missing typeof(PlatformDetection) in ConditionalFact

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
2 years ago[wasm] Add support for per-project customization of helix work items (#70461)
Ankit Jain [Fri, 17 Jun 2022 20:24:28 +0000 (16:24 -0400)]
[wasm] Add support for per-project customization of helix work items (#70461)

* [wasm] Add support for per-project customization of helix work items

Currently, for sending tests to helix:
1. the project binaries are zipped, as part of the project build
2. then separate helix targets files build that adds helix items for
   those zip files.
    - for wasm, we test with multiple 'scenarios' - like v8, browser, and
    nodejs.
    - so, 3 helix work items are submitted per zip file

- If a test project needs to have any customizations, for example, for
  testing crypto with a managed implementation, and subtlecrypto, which
  would require:
  - passing different arguments to xharness, in case of managed, and
    subtlecrypto
  - and this should be done only for the browser case
  - Currently, this would need this would need to be done in
  `sendtohelix-wasm.targets` special casing for the test project, and
  scenario.

- We add support for importing `$(ProjectName).helix.targets`, and
  calling a special target in that to add helix items, as needed.

- This targets file can be set in the test project like:
```xml
<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>
```
  - it will get deployed next to the zip file, and picked up automatically

```xml
<Project>
  <PropertyGroup>
    <_CryptoProjectName>System.Security.Cryptography.Tests</_CryptoProjectName>
    <System_Security_Cryptography_Tests_TargetName Condition="'$(Scenario))' == 'WasmTestOnBrowser'">System_Security_Cryptography_Tests_Targ
et</System_Security_Cryptography_Tests_TargetName>
  </PropertyGroup>

  <Target Name="System_Security_Cryptography_Tests_Target">
    <ItemGroup>
      <HelixWorkItem Include="$(Scenario)-managed-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
      </HelixWorkItem>

      <HelixWorkItem Include="$(Scenario)-subtlecrypto-System.Security.Cryptography.Tests">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>

        <PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands>
        <PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands>
      </HelixWorkItem>
    </ItemGroup>
  </Target>
```

- The targets file *must* have these:
    - a property named like `System_Security_Cryptography_Tests_TargetName`, for a
      test project named `System.Security.Cryptography.Tests`
    - if this property is not set, then the default behavior of adding
      work items will run
    - The target should add any items it needs to to `@(HelixWorkItem)`.
      - Examples of adding these can be seen in `sendtohelix*` project files

- Remember that all these properties, and targets get imported into the
  msbuild *global* namespace, so make sure to use unique names to avoid
  conflicts with other test projects.

Future work: this commit only enables it for wasm/library tests, but it should
be easy to extract it out, but needs some testing.

* [wasm] Helix: test with, and without subtle crypto

* disable non-wasm builds

* address review feedback

* Address review feedback

* Fix typo

* Revert "disable non-wasm builds"

This reverts commit 7ef99e81f82200189dd3f61eeaf00d6ca4ced6d4.

* Update src/libraries/System.Security.Cryptography/tests/wasm.helix.targets

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Address review feedback

* remove debug spew

* Change the way helix extension targets are discovered.

The new approach:

To run a custom project specific target for adding/editing @(HelixWorkItem):

- In the project add:
    `<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>`

    - This file gets copied next to the test archive as $(MSBuildProjectName).helix.targets

- In this `wasm.helix.targets` file, add to $(HelixExtensionTargets) to run your custom target

```xml
  <PropertyGroup Condition="'$(IsRunningLibraryTests)' == 'true' and '$(Scenario)' == 'WasmTestOnBrowser'">
    <HelixExtensionTargets>$(HelixExtensionTargets);_AddHelixCrypoItems</HelixExtensionTargets>
```

- The extension target will be called after the default items are added
  to `@(HelixWorkItem)`.
- Useful properties to condition on: $(Scenario), $(IsRunningLibraryTests)
- And add to, change, or remove from @(HelixWorkItem)

Example:
```xml
  <Target Name="_AddHelixCrypoItems">
    <ItemGroup>
      <!-- remove the existing item -->
      <HelixWorkItem Remove="@(HelixWorkItem)" Condition="'%(OriginalFileName)' == '$(_CryptoProjectName)'" />

        <!-- add two new ones - managed, and subtylecrypto -->
      <HelixWorkItem Include="$(WorkItemPrefix)managed-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
        <OriginalFileName>$(_CryptoProjectName)</OriginalFileName>
      </HelixWorkItem>

      <HelixWorkItem Include="$(WorkItemPrefix)subtlecrypto-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
        <OriginalFileName>$(_CryptoProjectName)</OriginalFileName>

        <PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=%WasmXHarnessArgs% --web-server-use-cop&quot;</PreCommands>
        <PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=$WasmXHarnessArgs --web-server-use-cop&quot;</PreCommands>
      </HelixWorkItem>

      <_CryptoHelixItem Include="@(HelixWorkItem)"
                        Condition="$([System.String]::new('%(HelixWorkItem.Identity)').EndsWith('-$(_CryptoProjectName)'))" />
    </ItemGroup>

    <Error Text="Something went wrong. Expected to have only two work items for $(_CryptoProjectName). But got @(_CryptoHelixItem)"
           Condition="@(_CryptoHelixItem->Count()) != 2" />
  </Target>
```

* cleanup

* Move WBT specific stuff into the target too. This will make it simpler to move it off into a targets file later

* fix build

* fix libtests

* fix wbt

* [wasm] Bump helix timeout to 90mins for debugger tests on windows

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2 years agoAdd event to capture min/max threads (#70063)
Eduardo Velarde [Fri, 17 Jun 2022 17:56:23 +0000 (10:56 -0700)]
Add event to capture min/max threads (#70063)

Event ThreadPoolMinMaxThreads added.

Parameters are:
            ushort MinWorkerThreads
            ushort MaxWorkerThreads
            ushort MinIOCompletionThreads
            ushort MaxIOCompletionThreads
            ushort ClrInstanceID

It is fired in the ThreadPool constructor and in the SetMinThreads/SetMaxThreads functions.

2 years agoFix for timer scheduling happening on the incorrect thread when wasm threading is...
Katelyn Gadd [Fri, 17 Jun 2022 17:30:12 +0000 (10:30 -0700)]
Fix for timer scheduling happening on the incorrect thread when wasm threading is enabled (#70863)

2 years agoReplace a few instances of PtrToStructure with more efficient marshalling (#70866)
Jan Kotas [Fri, 17 Jun 2022 15:43:13 +0000 (08:43 -0700)]
Replace a few instances of PtrToStructure with more efficient marshalling (#70866)

2 years agoUnpin locals, attempt 2 (#70655)
Joni Aromaa [Fri, 17 Jun 2022 15:00:45 +0000 (18:00 +0300)]
Unpin locals, attempt 2 (#70655)

Contributes to #40553

2 years agoUse hash/hmac one shots in NTLM (#70857)
Kevin Jones [Fri, 17 Jun 2022 14:19:07 +0000 (10:19 -0400)]
Use hash/hmac one shots in NTLM (#70857)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFix failure building two libraries tests (#70881)
Michal Strehovský [Fri, 17 Jun 2022 12:17:51 +0000 (21:17 +0900)]
Fix failure building two libraries tests (#70881)

Microsoft.CSharp was hitting an issue due to a vararg constructor. We don't support varargs. They shouldn't make it into the dependency graph. We are already checking in many places. We were erroneously thinking a vararg constructor with no mandatory arguments is a default constructor.

Runtime.InteropServices were crashing because we got a MulticastDelegate type into a codepath that expects a MulticastDelegate descendant.

2 years agoEnable IDE0020 (Use pattern matching) (#70523)
Stephen Toub [Fri, 17 Jun 2022 12:11:32 +0000 (08:11 -0400)]
Enable IDE0020 (Use pattern matching) (#70523)

* Enable IDE0020 (Use pattern matching)

* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
* Update variable naming

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
2 years agoAvoid crashing on unresolved dependencies (#70871)
Michal Strehovský [Fri, 17 Jun 2022 11:50:44 +0000 (20:50 +0900)]
Avoid crashing on unresolved dependencies (#70871)

Fixes #70815.

2 years agoGenerate method bodies for delegate Invoke methods (#70883)
Michal Strehovský [Fri, 17 Jun 2022 11:49:48 +0000 (20:49 +0900)]
Generate method bodies for delegate Invoke methods (#70883)

There is a dataflow warning suppression in System.Linq.Expressions that assumes we'll always have an invocable method body for delegate Invoke method. We need one in IL. We don't in native code.

Emulate what IL Linker does and generate a method body. This is a size regression.

Suppression: https://github.com/dotnet/runtime/blob/3b2883b097a773715ca84056885e0ca1488da36e/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L906-L912

Fixes #70880.

2 years agoImprove TLS1.3 detection in registry for QUIC (#70730)
Radek Zikmund [Fri, 17 Jun 2022 09:56:33 +0000 (11:56 +0200)]
Improve TLS1.3 detection in registry for QUIC (#70730)

* Improve TLS1.3 detection in registry for QUIC

* Split client and server detection

* Code review feedback

2 years agoUse new byte[] span optimization in a few more places (#70665)
Stephen Toub [Fri, 17 Jun 2022 09:26:20 +0000 (05:26 -0400)]
Use new byte[] span optimization in a few more places (#70665)

* Use new byte[] span optimization in a few more places

Separated out of larger change to use CreateSpan (these don't rely on that).

* Address PR feedback

2 years agoEnable IDE0054 (Use compound assignment) (#70564)
Stephen Toub [Fri, 17 Jun 2022 09:26:03 +0000 (05:26 -0400)]
Enable IDE0054 (Use compound assignment) (#70564)

* Enable IDE0054 (Use compound assignment)

* Update src/libraries/System.Data.Common/src/System/Data/Common/StringStorage.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
2 years agoAssign proper VNs to "shared constant" CSE defs (#70852)
SingleAccretion [Fri, 17 Jun 2022 09:23:08 +0000 (12:23 +0300)]
Assign proper VNs to "shared constant" CSE defs (#70852)

* Assign proper VNs to shared CSE defs

They must be those of the original expression, not the "base" constant CSE creates.

* Add a test

2 years agoARM64 - Optimize `i % 2` (#70599)
Will Smith [Fri, 17 Jun 2022 03:57:37 +0000 (20:57 -0700)]
ARM64 - Optimize `i % 2` (#70599)

2 years agoSmall performance cleanups in S.S.Cryptography
Kevin Jones [Fri, 17 Jun 2022 03:07:11 +0000 (23:07 -0400)]
Small performance cleanups in S.S.Cryptography

2 years agoFix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)
Jan Kotas [Fri, 17 Jun 2022 02:02:09 +0000 (19:02 -0700)]
Fix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)

InterlockedCompareExchangeT has to be called on a raw Object* to make the GC stress infrastructure happy.

2 years agoRestore ArchivingUtils.AttemptSetLastWriteTime (#70617)
Carlos Sanchez [Fri, 17 Jun 2022 01:57:07 +0000 (18:57 -0700)]
Restore ArchivingUtils.AttemptSetLastWriteTime (#70617)

2 years agoDelete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)
Jan Kotas [Fri, 17 Jun 2022 01:51:54 +0000 (18:51 -0700)]
Delete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)

This option has many issues. Anybody trying to experiment with static linking can add `<LinkerArg Include="-static" />` into the local file.

2 years agoUse `Array.Empty()` in `System.Reflection.Metadata`. (#70862)
Theodore Tsirpanis [Fri, 17 Jun 2022 01:46:59 +0000 (04:46 +0300)]
Use `Array.Empty()` in `System.Reflection.Metadata`. (#70862)

It is now available in all frameworks it targets.

2 years agoJIT: break loop canonicalization into two stages (#70809)
Andy Ayers [Fri, 17 Jun 2022 01:15:26 +0000 (18:15 -0700)]
JIT: break loop canonicalization into two stages (#70809)

For a given loop, we need to separate out the true backedge, any
non-loop backedges, and any inner loop backedges so that they all
target distinct blocks.

Otherwise, we may violate assumptions that the loop entry dominates
all blocks in the loop and that all backedges that reach top come
from within the loop.

This seems simplest to do with two rounds of canonicalization, one
that moves the non-loop edges, and another that moves the true backedge.

Fixes #70802.

2 years agoFixing the handling of Positive NaN in Math.Min for float/double (#70795)
Tanner Gooding [Fri, 17 Jun 2022 00:47:08 +0000 (17:47 -0700)]
Fixing the handling of Positive NaN in Math.Min for float/double (#70795)

* Adding tests validating Positive NaN for Max, MaxMagnitude, Min, and MinMagnitude

* Fixing the handling of Positive NaN in Math.Min for float/double

* Fixing the Max/Min code comments to use greater and lesser

* Adding a code comment clarifying the sign toggling behavior

2 years ago[coop] fix coop suspend timeout cue card (#70828)
Aleksey Kliger (λgeek) [Thu, 16 Jun 2022 23:35:51 +0000 (19:35 -0400)]
[coop] fix coop suspend timeout cue card (#70828)

the BLOCKING_SUSPEND_REQUESTED state is treated as suspend in full
coop mode (the thread keeps running, but by definition it's not
allowed to access managed resources and it will self-suspend if it
tries to enter GC Unsafe mode by calling a runtime API or managed
code).
It is bad in hybrid suspend mode (the thread should be preemptively
suspended, but we timed out before the signal handler had a chance to
run).

The corresponding suspension logic in the code is:

https://github.com/dotnet/runtime/blob/3fc61ebb562afc327a8fc6de5c82d76e86bf6f5d/src/mono/mono/utils/mono-threads.c#L1149-L1158

2 years agoCatch (more) mismatched args in `fgMorphArgs` (#70846)
SingleAccretion [Thu, 16 Jun 2022 22:45:33 +0000 (01:45 +0300)]
Catch (more) mismatched args in `fgMorphArgs` (#70846)

* Catch (more) mismatched args in "fgMorphArgs"

* Add a test

2 years agoFix a few Stream-related issues in System.Net.Http (#70731)
Stephen Toub [Thu, 16 Jun 2022 22:20:28 +0000 (18:20 -0400)]
Fix a few Stream-related issues in System.Net.Http (#70731)

* Fix a few Stream-related issues in System.Net.Http

* Put back WriteTimeout

* Fix tests

2 years agoFix corerun for assemblies with mismatched filename (#70800)
Jan Kotas [Thu, 16 Jun 2022 21:51:46 +0000 (14:51 -0700)]
Fix corerun for assemblies with mismatched filename (#70800)

corerun gracefully handled filename not matching the assembly name. Handling of this case regressed in #68186. This change is fixing the regression.

Fixes #68455

2 years agoUse IndexOf{Any} in a few more places (#70176)
Stephen Toub [Thu, 16 Jun 2022 21:20:12 +0000 (17:20 -0400)]
Use IndexOf{Any} in a few more places (#70176)

* Use IndexOf{Any} in a few more places

* Address PR feedback

2 years ago[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)
Ilona Tomkowicz [Thu, 16 Jun 2022 21:19:35 +0000 (23:19 +0200)]
[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)

Fixes #53021.

Enabled tests from #53021 - they are passing now because issue reported by @radekdoulik got fixed: https://github.com/emscripten-core/emscripten/issues/14299.

2 years agoDisable long running test (#70843)
Fan Yang [Thu, 16 Jun 2022 21:14:12 +0000 (17:14 -0400)]
Disable long running test (#70843)

2 years agoEnable IDE1005 (Delegate invocation can be simplified) (#70522)
Stephen Toub [Thu, 16 Jun 2022 20:57:36 +0000 (16:57 -0400)]
Enable IDE1005 (Delegate invocation can be simplified) (#70522)

2 years ago[wasm] Disable WBT test failing on windows (#70808)
Ankit Jain [Thu, 16 Jun 2022 20:33:58 +0000 (16:33 -0400)]
[wasm] Disable WBT test failing on windows (#70808)

Issue: https://github.com/dotnet/runtime/issues/70675

2 years agoNarrow cast fix (#70518)
Will Smith [Thu, 16 Jun 2022 19:10:53 +0000 (12:10 -0700)]
Narrow cast fix (#70518)

* Added genActualTypeSize. Remove narrow cast if the actual type sizes are the same

* Trying to fix build

* Fixing build

* Removed genActualTypeSize. Using genActualType instead

* Added helper function

* Comments

* Moving back to morph

* Removing part of the test

* Added fgOptimizeCastOnAssignment

* Fixing build

* Removing extra bits

* Removed fgIsSafeToRemoveIntToIntCastOnAssignment, inlining the implementation, adding extra logic when actual types are not the same

2 years agoTighten checks in `areArgumentsContiguous` (#70829)
SingleAccretion [Thu, 16 Jun 2022 19:10:08 +0000 (22:10 +0300)]
Tighten checks in `areArgumentsContiguous` (#70829)

* Tighten checks in "areArgumentsContiguous"

* Add a test

2 years agoJIT: Optimize range checks for X >> CNS and for short/byte indices (#67141)
Egor Bogatov [Thu, 16 Jun 2022 18:34:25 +0000 (20:34 +0200)]
JIT: Optimize range checks for X >> CNS and for short/byte indices  (#67141)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoAdd limited support for LocalCertificateSelectionCallback for QUIC (#70716)
Radek Zikmund [Thu, 16 Jun 2022 18:22:50 +0000 (20:22 +0200)]
Add limited support for LocalCertificateSelectionCallback for QUIC (#70716)

* Inline state transition helpers

Fixes #55437

* Add high level comments for HandleEventReceive and ReadAsync

* [QUIC] Call `LocalCertificateSelectionCallback` to get client certificate

* Code review feedback

2 years agoDelete redundant aliases for primitive types (#70805)
Jan Kotas [Thu, 16 Jun 2022 18:07:56 +0000 (11:07 -0700)]
Delete redundant aliases for primitive types (#70805)

2 years agoSimplify `Environment.IsWindows8OrAbove`. (#70818)
Theodore Tsirpanis [Thu, 16 Jun 2022 18:06:52 +0000 (21:06 +0300)]
Simplify `Environment.IsWindows8OrAbove`. (#70818)

* Simplify Environment.IsWindows8OrAbove.
Since .NET 5, the regular Windows version detecton code always returns the correct version.

* Remove two unused interop files.

2 years agoAdd two new stages to prepare for our new custom type marshalling design. (#70598)
Jeremy Koritzinsky [Thu, 16 Jun 2022 17:37:25 +0000 (10:37 -0700)]
Add two new stages to prepare for our new custom type marshalling design. (#70598)

2 years agoAdd icon to dotnet.exe on Windows (#70578)
Elinor Fung [Thu, 16 Jun 2022 16:49:57 +0000 (09:49 -0700)]
Add icon to dotnet.exe on Windows (#70578)

2 years agoUpdate dogfooding instructions (#70833)
Jan Kotas [Thu, 16 Jun 2022 15:49:18 +0000 (08:49 -0700)]
Update dogfooding instructions (#70833)

- Delete note about multilevel lookup. It is not relevant anymore.
- Fix nightly feed url to net7
- Replace .NET Core with just .NET

2 years agoUse LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)
Stephen Toub [Thu, 16 Jun 2022 15:14:27 +0000 (11:14 -0400)]
Use LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)

There's not particularly good reason to open-code the loop here.

2 years agoJIT: relax fwd sub restriction on changing class handle (#70587)
Andy Ayers [Thu, 16 Jun 2022 15:11:43 +0000 (08:11 -0700)]
JIT: relax fwd sub restriction on changing class handle (#70587)

For HW SIMD types, at least.

Fixes #64879.

2 years agoFix regression in runtime-jit-experimental (#70797)
Aman Khalid [Thu, 16 Jun 2022 15:09:08 +0000 (08:09 -0700)]
Fix regression in runtime-jit-experimental (#70797)

The newly-introduced `emitRemoveJumpToNextInst` optimization caused
a regression when hot/cold-splitting, where jumps from the last hot
instruction to the first cold instruction were erroneously removed.
This is fixed by disabling the `isRemovableJmpCandidate` flag for
branches between hot/cold sections.

On an unrelated note, a JIT dump message has been added to indicate
stress-splitting is occurring.

2 years agoFix emitDispJumpList for Arm64 (#70542)
Kunal Pathak [Thu, 16 Jun 2022 14:57:24 +0000 (07:57 -0700)]
Fix emitDispJumpList for Arm64 (#70542)

* fix jitdump

* Fix arm build

* Another format

2 years agoTest additional NativeAOT Lib testing (#70212)
Lakshan Fernando [Thu, 16 Jun 2022 14:51:40 +0000 (07:51 -0700)]
Test additional NativeAOT Lib testing (#70212)

* Test additional NativeAOT Lib testing

* more libraries to un nativeaot rolling build

* FB

* FB2

* only write results file if specified in args

* excluding failing tests

* oops, missed pull before a forced push

* excluding some recently added tests that fail

* fix typo with end element

* FB

2 years agoEnable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)
Jan Vorlicek [Thu, 16 Jun 2022 10:41:45 +0000 (12:41 +0200)]
Enable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)

This change makes ThreadAbort work when CET is enabled. Instead of
thread redirection, it uses the new user mode APC mechanism to get a
thread to a handler and then throws the ThreadAbortException from there
if the thread was interrupted at a safe location.

I have verified it works using mdbg tests and also by manual testing in
the Visual Studio 2022 using a test app that creates an instance of
classes with properties containing infinite loop, wait on a lock, wait
on a handle, infinite loop inside of a lock and infinite loop in
finally.
For the testing, I've enabled this separately from the CET so that the
missing support for CET in the debugger code doesn't cause troubles.

So we could enable this without CET enabled too, but I'd prefer doing
that separately.

2 years agoAdd end-to-end test for NTLM/Negotiate authentication against fake server (#70630)
Filip Navara [Thu, 16 Jun 2022 06:45:07 +0000 (08:45 +0200)]
Add end-to-end test for NTLM/Negotiate authentication against fake server (#70630)

* Add end-to-end test for NTLM/Negotiate authentication against fake server

* Simplify the test since HttpClientHandler is always SocketsHttpHandler for the test environment

* Fix test condition

* Remove extra comment

2 years agoAdd SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)
Tlakaelel Axayakatl Ceja [Thu, 16 Jun 2022 03:26:52 +0000 (20:26 -0700)]
Add SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)

2 years ago[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)
Thays Grazia [Thu, 16 Jun 2022 03:15:03 +0000 (00:15 -0300)]
[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)

2 years agoAvoid infinite loop in case of heap corruption (#70759)
Andrew Au [Thu, 16 Jun 2022 03:03:52 +0000 (20:03 -0700)]
Avoid infinite loop in case of heap corruption (#70759)

Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
2 years agoJIT: rework optCanonicalizeLoop (#70792)
Andy Ayers [Thu, 16 Jun 2022 01:17:26 +0000 (18:17 -0700)]
JIT: rework optCanonicalizeLoop (#70792)

Rework loop canonicalization in anticipation of extending it to handle
non-loop edges like those seen in #70802 (details in #70569).

The code to fix up flow out of `h` was not needed and has been removed.
We now assert upstream that no such fix up will be needed.

2 years agoFind&replace FastInterlock* with Interlocked* (#70784)
Jan Kotas [Wed, 15 Jun 2022 23:22:25 +0000 (16:22 -0700)]
Find&replace FastInterlock* with Interlocked* (#70784)

FastInterlock* operations were #defined as aliases to regular Interlock* operations. Deleted the FastInterlock* aliases and replaced usage with Interlocked* operations.

2 years agoUpgrade SDK to Preview 5 (#70117)
Andy Gocke [Wed, 15 Jun 2022 22:21:53 +0000 (15:21 -0700)]
Upgrade SDK to Preview 5 (#70117)

Upgrade to released Preview 5 build

2 years agoMake ConnectWithRevocation_StapledOcsp more resilient to being slow
Jeremy Barton [Wed, 15 Jun 2022 22:07:12 +0000 (15:07 -0700)]
Make ConnectWithRevocation_StapledOcsp more resilient to being slow

2 years agoRemove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)
Filip Navara [Wed, 15 Jun 2022 21:36:10 +0000 (23:36 +0200)]
Remove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)

The support for building with GSS_KRB5_CRED_NO_CI_FLAGS_X was broken for quite some time. Attempts to reenable it failed due to bug in the krb5 GSSAPI implementation resulting in invalid memory accesses.

2 years agoEnable IlcTrimMetadata by default (#70201)
Michal Strehovský [Wed, 15 Jun 2022 20:46:25 +0000 (05:46 +0900)]
Enable IlcTrimMetadata by default (#70201)

Enables more aggressive metadata stripping by default. In this mode, the AOT compiler only generates reflection metadata for artifacts that were deemed reflection-visible by either dataflow analysis, or user inputs. Previously we would consider everything that got generated reflection-visible.

* Change the defaults within the compiler (making the conservative mode opt-in).
* Add tests for scenarios in https://github.com/dotnet/runtimelab/issues/656 (resolves dotnet/runtimelab#656).
* Update tests
* Do more marking where it was necessary

2 years agoUpdate .net version for asp.net spmi collection script (#70778)
Andy Ayers [Wed, 15 Jun 2022 20:42:35 +0000 (13:42 -0700)]
Update .net version for asp.net spmi collection script (#70778)

2 years agoJIT: Faster long->int overflow checks (#69865)
Egor Bogatov [Wed, 15 Jun 2022 19:53:41 +0000 (21:53 +0200)]
JIT: Faster long->int overflow checks (#69865)

2 years agoJIT: Enable addressing modes for gc types (#70749)
Egor Bogatov [Wed, 15 Jun 2022 19:24:26 +0000 (21:24 +0200)]
JIT: Enable addressing modes for gc types (#70749)

2 years agoPredicate for valid Tracker Reference is inverted (#70709)
Aaron Robinson [Wed, 15 Jun 2022 18:16:22 +0000 (11:16 -0700)]
Predicate for valid Tracker Reference is inverted (#70709)

* Predicate for valid Tracker Reference is inverted

* Fix test to not inline wrapper creation function.

2 years agoHandle HW exceptions on Windows without redirection (#70428)
Jan Vorlicek [Wed, 15 Jun 2022 17:30:07 +0000 (19:30 +0200)]
Handle HW exceptions on Windows without redirection (#70428)

This change modifies the way hardware exceptions are propagated from the
vectored exception handler. Until now, runtime was returning from the
vectored exception handler with instruction pointer in the context set
to an asm helper. That redirected the thread to that helper and we have
raised an exception from its call chain.
While working on CET support, it was found that propagating exceptions
from the vectored exception handler directly works just fine. So this
change makes it work that way for all Windows targets.

2 years agoEnable redirection on arm64 (#70769)
Vladimir Sadov [Wed, 15 Jun 2022 16:59:22 +0000 (09:59 -0700)]
Enable redirection on arm64 (#70769)