platform/upstream/dotnet/runtime.git
3 years agoUse newest PGO data for Linux and windows-x86 (#51656)
Andy Gocke [Sun, 25 Apr 2021 01:18:20 +0000 (18:18 -0700)]
Use newest PGO data for Linux and windows-x86 (#51656)

This data was previously held back because we weren't producing
builds with Linux or windows-x86 but now we are. The Linux builds
now produce only a single profdata file, coreclr.profdata, which
should contain all the profile information for all the libraries in the
runtime.

3 years agoAdd alias for -arch on Linux scripts (#51816)
Andrii Kurdiumov [Sat, 24 Apr 2021 22:56:22 +0000 (04:56 +0600)]
Add alias for -arch on Linux scripts (#51816)

-a alias supported by build.ps1

3 years agoJIT: minor cleanups to the guarded devirtualization transform. (#51769)
Andy Ayers [Sat, 24 Apr 2021 16:50:40 +0000 (09:50 -0700)]
JIT: minor cleanups to the guarded devirtualization transform. (#51769)

Some small changes in anticipation of an upcoming bigger change.
Should give a tiny boost to throughput and is (nearly) no diff.

Don't bother creating a new block for the GDV test, it can sit at
the end of the original block.

Bash the original ret expr instead of leaving it referring to a temp
local and/or nop.

3 years agodebugging.md - fixed incorrect paths (#51577)
Andrei Faber [Sat, 24 Apr 2021 13:36:34 +0000 (08:36 -0500)]
debugging.md - fixed incorrect paths (#51577)

3 years agoAdd DynamicallyAccessedMemberTypes.Interfaces enum value (#51755)
Vitek Karas [Sat, 24 Apr 2021 07:39:23 +0000 (09:39 +0200)]
Add DynamicallyAccessedMemberTypes.Interfaces enum value (#51755)

Implements new API approved in https://github.com/dotnet/runtime/issues/51487.

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years ago[mono] Allow llvm->interp transitions on calls to Nullable.Box. (#51773)
Zoltan Varga [Sat, 24 Apr 2021 05:46:54 +0000 (01:46 -0400)]
[mono] Allow llvm->interp transitions on calls to Nullable.Box. (#51773)

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

3 years agoimprove wasm aot symbolification when striping isn't enabled (#49526)
Larry Ewing [Sat, 24 Apr 2021 04:00:14 +0000 (23:00 -0500)]
improve wasm aot symbolification when striping isn't enabled (#49526)

3 years ago[mono] Emit a null check in the ldind opcodes. (#51747)
Zoltan Varga [Sat, 24 Apr 2021 01:48:03 +0000 (21:48 -0400)]
[mono] Emit a null check in the ldind opcodes. (#51747)

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

3 years agoDon't recompute preds lists during loop cloning (#51757)
Bruce Forstall [Sat, 24 Apr 2021 01:08:13 +0000 (18:08 -0700)]
Don't recompute preds lists during loop cloning (#51757)

Instead, add and modify the appropriate preds when the mechanical
cloning is performed. This will preserve existing profile data
on the edges.

Contributes to #49030

No x86/x64 SPMI asm diffs.

3 years agoDisable regression test 49826 failing after a library refactoring (#51759)
Tomáš Rylek [Sat, 24 Apr 2021 00:59:57 +0000 (02:59 +0200)]
Disable regression test 49826 failing after a library refactoring (#51759)

3 years agoFix method context number seen by the jit with parallel SPMI (#51753)
Andy Ayers [Sat, 24 Apr 2021 00:26:52 +0000 (17:26 -0700)]
Fix method context number seen by the jit with parallel SPMI (#51753)

The jit can see the SPMI method context number by querying the
jit host for `SuperPMIMethodContextNumber`. Update the way this
value is computed, so it gives the same answer when running SPMI
in parallel that it does when running serially.

3 years agoStop using DomainAssemblyCache for unmanaged image cache used by p/invokes (#51704)
Elinor Fung [Fri, 23 Apr 2021 23:39:31 +0000 (16:39 -0700)]
Stop using DomainAssemblyCache for unmanaged image cache used by p/invokes (#51704)

3 years agoComWrappers fixes from NET 5 memory leak (#51661)
Aaron Robinson [Fri, 23 Apr 2021 23:34:07 +0000 (16:34 -0700)]
ComWrappers fixes from NET 5 memory leak (#51661)

* Port over .NET 5 fix.

* Make .NET 5 fix more efficient on .NET 6.
Add tests for the controlled QueryInterface failure.

* Improve logging for external object wrapper creation.
Validate the returned value for ReleaseFromReferenceTracker API.

3 years agoOnly allow a single write to any fn_ptr during portable binding. (#51657)
Jeremy Barton [Fri, 23 Apr 2021 23:01:38 +0000 (16:01 -0700)]
Only allow a single write to any fn_ptr during portable binding. (#51657)

* Only allow a single write to any fn_ptr during portable binding.

* Make temp_ptr read volatile

Co-authored-by: Juan Sebastian Hoyos Ayala <juhoyosa@microsoft.com>
3 years agoUpdate analyzer versions (#51696)
Stephen Toub [Fri, 23 Apr 2021 21:20:21 +0000 (17:20 -0400)]
Update analyzer versions (#51696)

3 years ago[wasm] Fix running of tests on windows (#51743)
Radek Doulik [Fri, 23 Apr 2021 20:54:50 +0000 (22:54 +0200)]
[wasm] Fix running of tests on windows (#51743)

3 years agoImplement CryptoConfig.CreateFromName() for wasm (#51750)
Alexander Köplinger [Fri, 23 Apr 2021 19:57:02 +0000 (21:57 +0200)]
Implement CryptoConfig.CreateFromName() for wasm (#51750)

Hardcodes the mapping for the SHA* hashes supported on WebAssembly from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=net-5.0#remarks

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

3 years agoAdd area-EnC-mono (#51749)
Aleksey Kliger (λgeek) [Fri, 23 Apr 2021 19:56:13 +0000 (15:56 -0400)]
Add area-EnC-mono (#51749)

3 years agoOptimize UTF-16 validation code (#51671)
Levi Broderick [Fri, 23 Apr 2021 19:29:08 +0000 (12:29 -0700)]
Optimize UTF-16 validation code (#51671)

3 years ago[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets...
dotnet-maestro[bot] [Fri, 23 Apr 2021 19:27:48 +0000 (21:27 +0200)]
[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets (#51707)

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

System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 6.0.0-beta.21219.1 -> To Version 6.0.0-beta.21220.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21220.1 -> To Version 1.0.0-prerelease.21222.3

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageValidation , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21219.2 -> To Version 6.0.0-beta.21221.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21220.1 -> To Version 1.0.0-prerelease.21223.1

* Revert downgrade of Microsoft.DotNet.Build.Tasks.Packaging

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
3 years agoClean up some flow graph functions (#51645)
Bruce Forstall [Fri, 23 Apr 2021 18:59:34 +0000 (11:59 -0700)]
Clean up some flow graph functions (#51645)

Convert a lot of function header comments to the current standard.
Write more documentation for many functions.
Remove a couple unused functions.

3 years agoStop harvesting old frameworks in some libraries (#51689)
Viktor Hofer [Fri, 23 Apr 2021 18:32:39 +0000 (20:32 +0200)]
Stop harvesting old frameworks in some libraries (#51689)

* Stop harvesting old frameworks in some libraries

The removed configurations (few netstandard1.x, portable*, netcore50)
of the touched packages aren't built anymore. Instead
the already built matching binaries from the latest available packages
are redistributed when packaging these libraries.

Dropping these assets as the minimum supported set of platforms are ones
that support netstandard2.0. For .NET Framework, there's still a net461
configuration present to avoid binding redirect issues.

Contributes to #47530

3 years agoUpdate Mono CODEOWNERS (#51748)
imhameed [Fri, 23 Apr 2021 18:02:59 +0000 (11:02 -0700)]
Update Mono CODEOWNERS (#51748)

3 years ago[wasm] Add build tests for no-op rebuilds (#51720)
Ankit Jain [Fri, 23 Apr 2021 17:45:23 +0000 (13:45 -0400)]
[wasm] Add build tests for no-op rebuilds (#51720)

.. this will catch problems like https://github.com/dotnet/runtime/pull/51703
which caused rebuild errors:

```
   1>wasm-ld : error : duplicate symbol: mono_aot_module_System_Runtime_info [/Users/radical/dev/r3/src/mono/sample/wasm/console/Wasm.Console.Sample.csproj]
         >>> defined in /Users/radical/dev/r3/artifacts/obj/mono/Wasm.Console.Sample/wasm/Release/browser-wasm/wasm/System.Runtime.dll.bc
         >>> defined in /Users/radical/dev/r3/artifacts/obj/mono/Wasm.Console.Sample/wasm/Release/browser-wasm/wasm/System.Runtime.dll.bc
```

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210422.2 (#51735)
dotnet-maestro[bot] [Fri, 23 Apr 2021 17:09:28 +0000 (17:09 +0000)]
Update dependencies from https://github.com/mono/linker build 20210422.2 (#51735)

[main] Update dependencies from mono/linker

3 years agoediting-and-debugging.md - fixed incorrect file name (#51741)
Andrei Faber [Fri, 23 Apr 2021 16:53:40 +0000 (11:53 -0500)]
editing-and-debugging.md - fixed incorrect file name (#51741)

3 years ago[mono] Disable counters and logdest on wasm (#51525)
Ryan Lucia [Fri, 23 Apr 2021 16:35:36 +0000 (12:35 -0400)]
[mono] Disable counters and logdest on wasm (#51525)

3 years agoFix a Windows-only test for cultures not using . as decimal seperator (#51733)
Jakob Botsch Nielsen [Fri, 23 Apr 2021 16:06:27 +0000 (18:06 +0200)]
Fix a Windows-only test for cultures not using . as decimal seperator (#51733)

3 years agoIAsyncEnumerable deserializer should tolerate custom queue converters (#51702)
Eirik Tsarpalis [Fri, 23 Apr 2021 14:30:31 +0000 (15:30 +0100)]
IAsyncEnumerable deserializer should tolerate custom queue converters (#51702)

* IAsyncEnumerable deserializer should tolerate custom queue converters

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.Stream.cs

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
* address feedback

* update ILLink suppressions

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
3 years ago[ios] Use managed implementation of Pbkdf2 (#51714)
Filip Navara [Fri, 23 Apr 2021 13:27:44 +0000 (15:27 +0200)]
[ios] Use managed implementation of Pbkdf2 (#51714)

Mirror Android, the native APIs don't exist on iOS.

Contributes to #47910.

3 years ago[mono] Work around arm64 MacCatalyst unavailable JITing API (#51669)
Aleksey Kliger (λgeek) [Fri, 23 Apr 2021 13:08:50 +0000 (09:08 -0400)]
[mono] Work around arm64 MacCatalyst unavailable JITing API (#51669)

* To [JIT on Apple Silicon](https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon) the application must call `pthread_jit_write_protect_np (0)` before writing to a code page and then `pthread_jit_write_protect_np (1)` before executing JITed code.

* Catalyst apps are Mac apps that get to use iOS frameworks (as well as some mac frameworks).  The API access is guarded by `__API_AVAILABLE` and `__API_UNAVAILABLE` macros in Apple framework headers.  If an API is not explicitly marked for catalyst, clang will follow the `ios` availability.

Unfortunately, `pthread_jit_write_protect_np` is marked like this:

```c
__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos)
void pthread_jit_write_protect_np(int enabled);
```

So a Catalyst app running on arm64 cannot call it.  It will get a compile-time error.
```
src/mono/mono/utils/mono-codeman.c:669:3: error: 'pthread_jit_write_protect_np' is unavailable: not available on macCatalyst
                  pthread_jit_write_protect_np (0);
                  ^
  /Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/pthread.h:561:6: note: 'pthread_jit_write_protect_np' has been explicitly marked unavailable here
  void pthread_jit_write_protect_np(int enabled);
       ^
```

---

Turns out the symbol `pthread_jit_write_protect_np` is actually present in the Catalyst framework libraries, and it does the right thing.

This PR works around the unfortunate `pthread.h` declaration by not using it.

We create a new .c file that included our own declaration
```c
void pthread_jit_write_protect_np(int enabled);
```

And then a new `mono_jit_write_protect` function that calls the pthread function.

---

Another option would be to use something like
```
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
...
#pragma clang diagnostic pop
```
around the offending callsites.  But neither ignoring `-Wpartial-availability` nor `-Wunguarded-availability-new` seem to have any effect on the compilation error.

---

Caveat: It's not yet clear whether this is ok to do in a retail (App Store) app.

---

* [mono] define HOST_MACCAT not HOST_MACCATALYST for Mac Catalyst

The C code already has HOST_MACCAT ifdefs.  HOST_MACCATALYST isn't used.

3 years agoDac changes for regions (#50092)
Peter Sollich [Fri, 23 Apr 2021 11:16:00 +0000 (13:16 +0200)]
Dac changes for regions (#50092)

There are two sets of changes here:

- Make DacHeapWalker work for empty regions - I had observed a crash with the empty regions injected with STRESS_REGIONS.
- Make GetGCHeapStaticData robust against globals saved_sweep_ephemeral_seg and saved_sweep_ephemeral_start being null.

The changes should not cause issues for a coreclr NOT running with regions.

3 years agoImprove some of our recent obsoletions (#51721)
Jeff Handley [Fri, 23 Apr 2021 11:01:37 +0000 (04:01 -0700)]
Improve some of our recent obsoletions (#51721)

* Replace usage of NET50_OBSOLETIONS with NET5_0_OR_GREATER

* Correct GitHub handle

* Use a diagnostic id for the RuntimeEnvironment obsoletions from #50666

* Use fully-qualified attribute name in ref source updates from #49411

* Use a diagnostic id for the JsonSerializerOptions.IgnoreNullValues obsoletion from #41141

3 years agoChange a byte[] in KnownColorTable to be ReadOnlySpan<byte> (#51719)
Stephen Toub [Fri, 23 Apr 2021 10:59:23 +0000 (06:59 -0400)]
Change a byte[] in KnownColorTable to be ReadOnlySpan<byte> (#51719)

3 years agoFix test (#51729)
devsko [Fri, 23 Apr 2021 10:45:45 +0000 (12:45 +0200)]
Fix test (#51729)

3 years agoAdded tests for LoggerMessage.Define with skipEnabledCheck (#50773)
Günther Foidl [Fri, 23 Apr 2021 09:28:20 +0000 (11:28 +0200)]
Added tests for LoggerMessage.Define with skipEnabledCheck (#50773)

3 years ago[mono] Remove support for "file://" URIs when loading assemblies (#51727)
Ryan Lucia [Fri, 23 Apr 2021 07:04:12 +0000 (03:04 -0400)]
[mono] Remove support for "file://" URIs when loading assemblies (#51727)

This functionality was removed as part of .NET Core, see https://github.com/dotnet/docs/issues/19944 for more info

3 years agolateapexearlyspeed-issue-40848 Check open generic type arity mismatch… (#51167)
LateApexEarlySpeed [Fri, 23 Apr 2021 06:56:37 +0000 (14:56 +0800)]
lateapexearlyspeed-issue-40848 Check open generic type arity mismatch… (#51167)

3 years ago[AppleAppBuilder] misc Catalyst fixes (#51668)
Aleksey Kliger (λgeek) [Fri, 23 Apr 2021 06:08:38 +0000 (02:08 -0400)]
[AppleAppBuilder] misc Catalyst fixes (#51668)

3 years agoInclude FontName in Font.GetHashCode (#47674)
Satish Yadav [Fri, 23 Apr 2021 01:56:35 +0000 (07:26 +0530)]
Include FontName in Font.GetHashCode (#47674)

* Update Font.cs

* Added test for GetHashCode pr #46816

* Added SkipOnTargetFramework as GetHashCode doesn't include font name in .NET Framework and changed FontFamily to SansSarif as per PR #47674. Fixes #44343. Original PR #46816.

* Update FontTests.cs

* Fix test, skip font if name is equal

Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
3 years agoUpdate jit for new likely class records (#51664)
Andy Ayers [Fri, 23 Apr 2021 00:46:31 +0000 (17:46 -0700)]
Update jit for new likely class records (#51664)

Co-authored-by: David Wrighton <davidwr@microsoft.com>
3 years agoFix symbolic link tests (#51712)
Andy Gocke [Fri, 23 Apr 2021 00:41:26 +0000 (17:41 -0700)]
Fix symbolic link tests (#51712)

* Fix symbolic link tests

Use IDisposable and `File.Delete` to ensure that symlinks get created
and cleaned up properly on all platforms. If all symlinks aren't
deleted, the later test cleanup phases have problems deleting them.

Fixes #51502

* Test still failing on Mac, skip until I can investigate

3 years agoFix building the repo on ARM64 (#51706)
Anton Lapounov [Thu, 22 Apr 2021 22:44:19 +0000 (15:44 -0700)]
Fix building the repo on ARM64 (#51706)

3 years agoWebRequest/ServicePoint/WebClient Obsoletion Follow-Up (#51550)
Jeff Handley [Thu, 22 Apr 2021 22:41:40 +0000 (15:41 -0700)]
WebRequest/ServicePoint/WebClient Obsoletion Follow-Up (#51550)

* WebRequest/ServicePoint/WebClient Obsoletion Follow-Up

* Suppress SYSLIB0014 at the project level for System.Net.Requests

3 years agoImprove documentation for obsoletion/analyzer diagnostics (#51595)
Jeff Handley [Thu, 22 Apr 2021 20:57:52 +0000 (13:57 -0700)]
Improve documentation for obsoletion/analyzer diagnostics (#51595)

* Improve documentation for obsoletion/analyzer diagnostics

* Clarity for SYSLIB0### and SYSLIB1### sequences

* Add info about the SYSLIB documentation pages

* Add pointer to the docs within Obsoletions.cs

3 years agoOverwrite the old rsp (#51703)
Larry Ewing [Thu, 22 Apr 2021 20:36:41 +0000 (15:36 -0500)]
Overwrite the old rsp (#51703)

3 years ago[wasm][tests] Fix path to System.Text.Json.Tests for excluding from .. (#51670)
Ankit Jain [Thu, 22 Apr 2021 20:07:56 +0000 (16:07 -0400)]
[wasm][tests] Fix path to System.Text.Json.Tests for excluding from .. (#51670)

- makes EAT build green again

3 years agoAdd Blazor Pizza app SOD test (#51659)
Drew Scoggins [Thu, 22 Apr 2021 18:30:33 +0000 (11:30 -0700)]
Add Blazor Pizza app SOD test (#51659)

* Add Pizza App for WASM SOD

* Fix missing paren

* Fix quoting

3 years agoSOCKS4/4a/5 proxy support in SocketsHttpHandler (#48883)
Huo Yaoyuan [Thu, 22 Apr 2021 17:21:07 +0000 (01:21 +0800)]
SOCKS4/4a/5 proxy support in SocketsHttpHandler (#48883)

* Separate method for proxy scheme validation.

* Pass socks connection kind.

* Unauthorized socks5 connection.

* Username and password auth.

* Fix response address.

* Fix proxyUri value and assertion.

* Use HttpConnectionKind for SOCKS.

* Handle more connection kind assertions.

* SOCKS4/4a support.

* Move version selection into SocksHelper.

* Call sync version of read write.

* Cancellation by disposing stream.

* Dispose cancellation registration.

* IP addressing for SOCKS5.

* IP addressing for SOCKS4.

* Wrap write method.

* Cancellation and optimization.

* Optimize.

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
* Clarify logic.

* Remove ssl assertion.

* SocksException.

* Make SocksException derive from IOException.

* Use binary primitives to write port in BE.

* Socks loopback test.

* Expand test matrix.

* Try to solve certificate issue.

* Pass handler to httpclient.

* Update ConnectToTcpHostAsync.

* Remove custom self-signed cert use from Socks test

* Fix LoopbackSocksServer's parsing of Socks4a domain name

* Only set RequestVersionExact for H2C

Setting it in general breaks H2 => H1.1 downgrade on platforms without ALPN

* Add auth test.

* Add IP in test matrix.

* Only override host when required.

* Don't attempt NT Auth for Socks proxies

* Skip HTTP2 ssl test on platforms without ALPN support

* Use NetworkCredential directly

* Pass AddressFamily to sync Dns resolution too

* Consistently check encoded string lengths

* Fix Socks5 user/pass auth

* Add IPv6 test for socks5

* Exception nits

* Add exceptional tests.

* Fix exceptional test.

* Fix NRT compilation

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
* Server shouldn't wait for request in exceptional test.

* Add exception message to test.

* Update auth failure handling.

* SOCKS4 and 5 uses different auth model, requires different error message.

* Revert accidental indent change.

* Expand test matrix to include Sync HTTP1

* Read received bytes before returning error response in Socks4 loopback

* Use named bool arguments

* Improve exception messages

* !IsEmpty => Length != 0

* Improve exception messages 2

* Avoid enforing Socks4 VN value

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
3 years agoCleanup XmlReader (#51561)
kronic [Thu, 22 Apr 2021 16:41:02 +0000 (19:41 +0300)]
Cleanup XmlReader (#51561)

* remove repetitions ';'

* Cleanup XmlReader

* Cleanup XmlReaderAsync

* review feedback

* review feedback

Co-authored-by: kronic <kronic@softland.ru>
3 years agoFix another hang on shutdown (#51681)
David Fowler [Thu, 22 Apr 2021 16:19:36 +0000 (09:19 -0700)]
Fix another hang on shutdown (#51681)

* Fix another hang on shutdown
- If SIGINT/Ctrl+C fires don't block shutdown waiting for dispose. This mechanism was intended to be a way to let application code unwind completely before exiting the process but we can cancel the the CancelKeyPress today, which means we don't need to wait for dispose to be called.
- This is a change in behavior but I can't figure out a case where ProcessExit would fire and you'd want it to wait on a dispose call *after* SIGINT/CTRL+C has fired.

3 years agofix quic cert validation with OpenSSL (#51015)
Tomas Weinfurt [Thu, 22 Apr 2021 15:59:09 +0000 (08:59 -0700)]
fix quic cert validation with OpenSSL (#51015)

* fix quic cert validation with OpenSSL

* feedback from review

* update certificate conditions

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210422.1 (#51690)
dotnet-maestro[bot] [Thu, 22 Apr 2021 14:44:36 +0000 (14:44 +0000)]
Update dependencies from https://github.com/mono/linker build 20210422.1 (#51690)

[main] Update dependencies from mono/linker

3 years ago[interp] Correctly keep track of stack height when inlining (#51684)
Vlad Brezae [Thu, 22 Apr 2021 14:24:41 +0000 (17:24 +0300)]
[interp] Correctly keep track of stack height when inlining (#51684)

We didn't update the stack pointer after a return opcode.

3 years agoRemove harvesting of System.Composition* (#51617)
Viktor Hofer [Thu, 22 Apr 2021 13:47:32 +0000 (15:47 +0200)]
Remove harvesting of System.Composition* (#51617)

The netstandard1.0 and portable* configurations of the
System.Composition.* packages aren't built anymore. Instead
the already built matching binary from the latest available package
version is redistributed when packaging these libraries.

Dropping the netstandard1.0 asset and the portable* one as the
minimum supported set of platforms are ones that support netstandard2.0.
For .NET Framework, there's still a net461 configuration to avoid
binding redirect issues.

Contributes to #47530

3 years agoImmutableDictionary.AddRange: throw if any item has a null Key. (#51438)
Nathan Moreau [Thu, 22 Apr 2021 12:52:14 +0000 (14:52 +0200)]
ImmutableDictionary.AddRange: throw if any item has a null Key. (#51438)

The behavior of AddRange(items) should be the same as
foreach(var item in items) Add(item); Add(item) throws if item.Key == null,
so AddRange should it as well.

Fix #50865.

3 years agoHTTP/3 fixed some tests (#51493)
Marie Píchová [Thu, 22 Apr 2021 11:11:46 +0000 (13:11 +0200)]
HTTP/3 fixed some tests (#51493)

* Fixed HTTP/3 test crashes.

* Removed H3 test cases from version selection test.

Since H3 is using QUIC/UDP it's not possible to use Ssl over TCP socket ALPN to determine the final request version. It either has to be pre-negotiated or upgraded via Alt-Svc.

3 years agoRemove harvesting of M.E.DependencyModel (#51582)
Viktor Hofer [Thu, 22 Apr 2021 10:40:51 +0000 (12:40 +0200)]
Remove harvesting of M.E.DependencyModel (#51582)

* Remove harvesting of M.E.DependencyModel

The netstandard1.6 configuration of Microsoft.Extensions.DependencyModel
isn't built anymore. Instead the already built matching binary from the
latest available package version is redistributed when packaging the
DependencyModel library.

Also dropping the netstandard1.3 asset and the net451 one as the
minimum supported set of platforms are ones that support netstandard2.0.

In addition to the harvesting removal, cleaning up the src project which
had an unnecessary condition and property set.

Contributes to https://github.com/dotnet/runtime/issues/47530

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210421.3 (#51683)
dotnet-maestro[bot] [Thu, 22 Apr 2021 10:10:10 +0000 (10:10 +0000)]
Update dependencies from https://github.com/mono/linker build 20210421.3 (#51683)

[main] Update dependencies from mono/linker

3 years ago[main] Update dependencies from mono/linker (#51558)
dotnet-maestro[bot] [Thu, 22 Apr 2021 07:26:07 +0000 (09:26 +0200)]
[main] Update dependencies from mono/linker (#51558)

* Update dependencies from https://github.com/mono/linker build 20210419.2

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21217.1 -> To Version 6.0.100-preview.2.21219.2

* Update dependencies from https://github.com/mono/linker build 20210421.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21217.1 -> To Version 6.0.100-preview.2.21221.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoFix a build error when USE_REGIONS is turned on (#51660)
Andrew Au [Thu, 22 Apr 2021 06:16:49 +0000 (23:16 -0700)]
Fix a build error when USE_REGIONS is turned on (#51660)

3 years ago[wasm] Correctly set PATH for node, and python (#51509)
Ankit Jain [Thu, 22 Apr 2021 04:43:06 +0000 (00:43 -0400)]
[wasm] Correctly set PATH for node, and python (#51509)

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoFix Type.GetFields() after EnC/Hot reload update (#51649)
Mike McLaughlin [Thu, 22 Apr 2021 04:37:19 +0000 (21:37 -0700)]
Fix Type.GetFields() after EnC/Hot reload update (#51649)

Fix Type.GetFields() after EnC/Hot reload update

Switch to the EncApproxFieldDescIterator in the GetFields() FCall.

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

Fix debug build assert in ApplyUpdate

Added MethodDesc::ResetCodeEntryPointForEnC() that reset the entry point without
the asserts that caused the problem.

Introduced in the fix for https://github.com/dotnet/runtime/issues/50445

3 years agoAdd Get/SetLastPInvokeError and Get/SetLastSystemError APIs (#51505)
Elinor Fung [Thu, 22 Apr 2021 01:33:11 +0000 (18:33 -0700)]
Add Get/SetLastPInvokeError and Get/SetLastSystemError APIs (#51505)

3 years agoShift Most of Wasm AOT test build to helix (#48226)
Steve Pfister [Thu, 22 Apr 2021 00:58:25 +0000 (20:58 -0400)]
Shift Most of Wasm AOT test build to helix (#48226)

Since AOT'ing each test suite takes between 3-9 min, we need to shift the burden over to helix.

## This is done by:
1. building the test assemblies on the build machine
   - the wasm part of the build is not executed on the build machine,
      because it has the AOT build part
2. Zip up the test assembly+friends, *and* any bits required to run the wasm
    app build for that on helix (eg. emsdk, wasm app targets, cross compiler etc)
3. Send all this to helix, and use a custom `aot-build.proj`
     - which recreates all the build inputs for the `WasmBuildApp` target
        using the paths for the assets on helix
     - then we can run `WasmBuildApp` for the build, resulting in a wasm app
       bundle.
4. Run the tests!

- We already have the bits required for building wasm apps on helix, supported
for `Wasm.Build.Tests`, which we can use here too.

## Trimming:

- Since, AOT can be so expensive, we use `EnableAggressiveTrimming=true`(EAT), but
   that means that we could have issues due to trimming.
- And it can sometimes be unclear whether the build/test failures are due to trimming
     or AOT.

- Because these builds+test runs are different from other builds, owing to the
   "build partially on helix" step, a normal EAT build would not be the same as
- to help with testing this, we add two lanes to `runtime-staging`:
   - `*_Mono_AOT`: builds AOT+EAT on helix
   - `*_Mono_EAT`: builds EAT, on helix
      - this is required because we want to run almost the same kinda
         build: 1. build test assembly; *2. send to helix; 3. build wasm app;* 4. run tests

- This should effectively mean that we can see which errors might be due to EAT, and
   which are clearly because of EAT+AOT.

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Marek Safar <marek.safar@gmail.com>
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
3 years agoAdd Put/Post methods to HttpClientJsonExtensions that take type metadata (#51609)
Layomi Akinrinade [Thu, 22 Apr 2021 00:42:24 +0000 (17:42 -0700)]
Add Put/Post methods to HttpClientJsonExtensions that take type metadata (#51609)

* Add Put/Get methods to HttpClientJsonExtensions that take type metadata

* Make JsonContentOfT derive directly from HttpContent

* Fix linker error

* Rename Helper to JsonHelpers

3 years ago[wasm] Use response files for `emcc` invocations (#51530)
Ankit Jain [Wed, 21 Apr 2021 23:46:16 +0000 (19:46 -0400)]
[wasm] Use response files for `emcc` invocations (#51530)

* [wasm] Use response files for `emcc` invocations

This adds response file for the linker command line, which will be the
longest one. And it uses a known name for the response file.

In future, once we have dependency checking, we can use such response
files for that too.

Fixes #51437 .

* [wasm] Emit emcc arguments, one per line in the rsp file

Having the arguments one per line, also means that we don't have to
quote the file paths. And it is more readable.

* [wasm] Revert to quote file paths even in response file for emcc

Suggested by Pranavkm:
```
.. their format does require whitespaces to be quoted:
https://github.com/emscripten-core/emscripten/blob/main/tools/response_file.py#L16-L53.
```

3 years agoImprove arguments handling in build-runtime.cmd (#51639)
Anton Lapounov [Wed, 21 Apr 2021 23:34:42 +0000 (16:34 -0700)]
Improve arguments handling in build-runtime.cmd (#51639)

3 years agoAdd internal Array.Clear method (#51548)
Levi Broderick [Wed, 21 Apr 2021 22:38:03 +0000 (15:38 -0700)]
Add internal Array.Clear method (#51548)

3 years agoAdd and update `///` comments to help consumers of these APIs (#51629)
David Pine [Wed, 21 Apr 2021 21:30:39 +0000 (16:30 -0500)]
Add and update `///` comments to help consumers of these APIs (#51629)

* Added some API comments to help consumers have a better understanding of the order of operations, added unit tests, fixed redundancy in comment

* Update test to call UseEnv more than once directly

3 years agoRemove outdated mention of "COMObject.cpp" (#51644)
Alex-ABWorld [Wed, 21 Apr 2021 21:24:23 +0000 (22:24 +0100)]
Remove outdated mention of "COMObject.cpp" (#51644)

3 years agoSimplify some CallConv logic (#51596)
Aaron Robinson [Wed, 21 Apr 2021 20:37:21 +0000 (13:37 -0700)]
Simplify some CallConv logic (#51596)

* Simplify some CallConv logic

Reuse the CallConvBuilder class in more places
Unify CharSet logic for UnmanagedFunctionPointer and DllImport

* Add needed cast.

* Explicitly handle the 0 case for the CorNativeLinkType enum.

* Comment update.

* Review feedback.

* Update dllimport.cpp

Style feedback.

3 years agoAllow region_allocator to allocate from the right (#50973)
Andrew Au [Wed, 21 Apr 2021 20:32:41 +0000 (13:32 -0700)]
Allow region_allocator to allocate from the right (#50973)

3 years ago[mono] Add HAVE_PTHREAD_JIT_WRITE_PROTECT_NP to cmake config.h.in (#51610)
Aleksey Kliger (λgeek) [Wed, 21 Apr 2021 19:48:27 +0000 (15:48 -0400)]
[mono] Add HAVE_PTHREAD_JIT_WRITE_PROTECT_NP to cmake config.h.in (#51610)

* [mono] Add HAVE_PTHREAD_JIT_WRITE_PROTECT_NP to cmake config.h.in

Otherwise mono_codeman_enable_write is a no-op

Should fix jiting on Apple ARM64

* [cmake] Use check_symbol_exists(pthread_jit_write_protect_np)

   check_function_exists doesn't look at the headers, only at linking, so it can't detect functions marked unavailable in Apple headers.

Fixes #49042

3 years agoDisable failing runtime tests on Android x64 (#51514)
Fan Yang [Wed, 21 Apr 2021 19:36:19 +0000 (15:36 -0400)]
Disable failing runtime tests on Android x64 (#51514)

3 years agoFix encoding non-static QPack HTTP status (#51614)
James Newton-King [Wed, 21 Apr 2021 18:36:16 +0000 (06:36 +1200)]
Fix encoding non-static QPack HTTP status (#51614)

3 years ago[wasm][aot] Stop hardcoding artifacts from the runtime pack (#51628)
Larry Ewing [Wed, 21 Apr 2021 18:32:04 +0000 (13:32 -0500)]
[wasm][aot] Stop hardcoding artifacts from the runtime pack (#51628)

3 years agoDon't have gtAuxiliaryJitType and gtOtherReg share a union (#51627)
Tanner Gooding [Wed, 21 Apr 2021 18:29:06 +0000 (11:29 -0700)]
Don't have gtAuxiliaryJitType and gtOtherReg share a union (#51627)

* Don't have gtAuxiliaryJitType and gtOtherReg share a union

* Applying formatting patch

3 years agoFix thread-safety of TypeDescriptor.Refresh enumerating hashtable (#51621)
Stephen Toub [Wed, 21 Apr 2021 18:04:26 +0000 (14:04 -0400)]
Fix thread-safety of TypeDescriptor.Refresh enumerating hashtable (#51621)

3 years agoRemove stale property (#51615)
Viktor Hofer [Wed, 21 Apr 2021 17:30:34 +0000 (19:30 +0200)]
Remove stale property (#51615)

The by the SDK default included netframework reference assembly are used instead of the old microsoft.netframework.targetingpack. Removing the stale property.

3 years agoMerge Start into ctor and Close into Dispose for QuicListener (#51512)
Natalia Kondratyeva [Wed, 21 Apr 2021 16:49:32 +0000 (18:49 +0200)]
Merge Start into ctor and Close into Dispose for QuicListener (#51512)

Fixes #2262

3 years agoAdd wasm runtime debugging docs. (#51623)
Zoltan Varga [Wed, 21 Apr 2021 15:04:48 +0000 (11:04 -0400)]
Add wasm runtime debugging docs. (#51623)

3 years agoLazy init of ThreadWaitInfo in Thread.Mono.cs to prevent crash on external attached...
Johan Lorensson [Wed, 21 Apr 2021 07:22:32 +0000 (09:22 +0200)]
Lazy init of ThreadWaitInfo in Thread.Mono.cs to prevent crash on external attached threads. (#51483)

* Init ThreadWaitInfo to prevent crash on external attached threads.

Commit https://github.com/dotnet/runtime/commit/457f58cd30082c9de0be9ca62e64fa179c37dab3
added a new managed object into Mono's managed thread object, _waitInfo.

This new object was initialized in Thread managed constructor, problem
with that is for all threads that gets their thread object created in
native code, create_thread_object, that code did the same thing as
constructor before commit, since managed constructor called down into
native code calling the same native method as create_thread_object meaning
a thread object created from managed or native would be initialized
identical.

After above commit this is no longer true, meaning that all managed thread
objects created in native code (like attached external threads) won't
get _waitInfo initialized and that leads to a crash when OnThreadExiting
gets called from Finalizer thread.

Fix is to make sure _waitInfo get initialize regardless of thread object
gets created from managed or native code.

This fix implements a lazy init as part of property access, I tested a
native version of the fix, calling back into managed to init managed
parts of thread when tread gets created in native, but turns out that
such a fix gets a little complicated, since some of the threads are
created early when it's not possible to run managed code, so that in turn
needed additional changes into the init order, that in turn has bigger
impact and could cause other unwanted side effects.

Fixing it in managed using lazy/on demand init is simpler/cleaner approach
but might come with a small performance hit for callers of WaitInfo property
(will add volatile read and conditional branch), but looking at callers
of the property, they appear in functions with rather high "cost",
like Sleep, NewMutex, Wait, SignalAndWait, Interrupt and
RelinquishOwnership.

3 years agoAdd internal Array.NativeLength property (#51589)
Levi Broderick [Wed, 21 Apr 2021 07:13:48 +0000 (00:13 -0700)]
Add internal Array.NativeLength property (#51589)

3 years agoNuget package for ILCompiler.Reflection.ReadyToRun (#48182)
Andrew Au [Wed, 21 Apr 2021 04:31:53 +0000 (21:31 -0700)]
Nuget package for ILCompiler.Reflection.ReadyToRun (#48182)

Nuget package for ILCompiler.Reflection.ReadyToRun

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
3 years agoSimplify non-generic ArrayEnumerator (#51351)
Jan Kotas [Wed, 21 Apr 2021 03:57:02 +0000 (20:57 -0700)]
Simplify non-generic ArrayEnumerator (#51351)

* Simplify non-generic ArrayEnumerator

* Implement GetFlattenedIndex for Mono

3 years agoJIT: revise inlinee scale computations (#51593)
Andy Ayers [Wed, 21 Apr 2021 03:31:34 +0000 (20:31 -0700)]
JIT: revise inlinee scale computations (#51593)

Rework the inlinee profile scale computations so that all scaling happens
during the profile incorporation phase, rather than sometimes deferring
the scaling until inlining. Because of this we no longer need to record
the scale on the inline info.

Toss out profile data if all counts are zero.

Update the edge profile solver to handle a special case where no return block
was executed, but edges within the method had counts. In such cases the entry
block count can end up zero and blocking proper scaling computations. For this
case, try and deduce a plausible count in this case from nearby blocks and edges.

Fix the edge weight computations to tolerate inconsistent data rather than
to assert.

3 years agoFix LatencyRoundtrips test failures (#51603)
Jan Kotas [Wed, 21 Apr 2021 03:05:05 +0000 (20:05 -0700)]
Fix LatencyRoundtrips test failures (#51603)

Disable the tests for values are not guaranteed to roundtrip depending on the GC settings. We have more extensive test coverage for the latency modes under runtime tests.

3 years agoUse Apple's CCRandomGenerateBytes in GetCryptographicallySecureRandomBytes. (#51526)
Kevin Jones [Wed, 21 Apr 2021 01:22:16 +0000 (21:22 -0400)]
Use Apple's CCRandomGenerateBytes in GetCryptographicallySecureRandomBytes. (#51526)

The Apple API offers significant performance improvements (an order of a magnitude) over
reading from /dev/urandom.

3 years agoAdd MCS jitflags support for the new GetLikelyClass PGO record type (#51578)
Andy Ayers [Wed, 21 Apr 2021 00:19:38 +0000 (17:19 -0700)]
Add MCS jitflags support for the new GetLikelyClass PGO record type (#51578)

Records of this type are created when class profile histograms in dynamic PGO
data are summarized by the static PGO tooling.

These records can appear in both prejit and jit schemas when the static PGO data is
passed back to the jit.

3 years agoFix issue #48696 (#51520)
David Pine [Wed, 21 Apr 2021 00:01:24 +0000 (19:01 -0500)]
Fix issue #48696 (#51520)

There appeared to be two issues, where the config.GetReloadToken().RegisterChangeCallback was registered after the updates were made.

3 years ago[wasm] Allocate a variable for all ref typed vregs and mark them as volatile. (#51580)
Zoltan Varga [Tue, 20 Apr 2021 23:59:43 +0000 (19:59 -0400)]
[wasm] Allocate a variable for all ref typed vregs and mark them as volatile. (#51580)

This forces the llvm backend to allocate a stack location for them, so they
get GC tracking.

3 years ago[wasm] Set runtime pack directory to the nuget path, if not set (#51347)
Ankit Jain [Tue, 20 Apr 2021 23:33:50 +0000 (19:33 -0400)]
[wasm] Set runtime pack directory to the nuget path, if not set (#51347)

* [wasm] Set runtime pack directory to the nuget path, if not set

* Update src/mono/wasm/build/WasmApp.targets

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years ago[JSON source gen 3/3] Add new methods to JsonSerializer and System.Net.Http.Json...
Layomi Akinrinade [Tue, 20 Apr 2021 22:45:26 +0000 (15:45 -0700)]
[JSON source gen 3/3] Add new methods to JsonSerializer and System.Net.Http.Json APIs that take type metadata (#51528)

* Add new methods to JsonSerializer and System.Net.Http.Json APIs that take type metadata

* Address review feedback

3 years agoSimplify logic for IncludePlatformAttributes (#51575)
Jeff Handley [Tue, 20 Apr 2021 22:30:36 +0000 (15:30 -0700)]
Simplify logic for IncludePlatformAttributes (#51575)

3 years agoAvoid conv.i opcodes in hot paths in CoreLib (#51190)
Levi Broderick [Tue, 20 Apr 2021 22:10:34 +0000 (15:10 -0700)]
Avoid conv.i opcodes in hot paths in CoreLib (#51190)

3 years ago[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharne...
dotnet-maestro[bot] [Tue, 20 Apr 2021 21:43:33 +0000 (21:43 +0000)]
[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project dotnet/runtime-assets (#51488)

[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project dotnet/runtime-assets

3 years agoDisable source generators from binplacing (#51539)
Eric StJohn [Tue, 20 Apr 2021 20:32:40 +0000 (13:32 -0700)]
Disable source generators from binplacing (#51539)

* Disable source generators from binplacing

* Ensure APICompat doesn't run for non-Source projects

3 years agoAdd link to my deep .NET GC Internals series (#51551)
Konrad Kokosa [Tue, 20 Apr 2021 20:09:55 +0000 (22:09 +0200)]
Add link to my deep .NET GC Internals series (#51551)

It's 14 hours of lectures about how .NET GC is implemented.

3 years agoAdd standard mibc to build pack (#51531)
David Wrighton [Tue, 20 Apr 2021 20:03:35 +0000 (13:03 -0700)]
Add standard mibc to build pack (#51531)