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

3 years agoUse adjusted parent layout size to handle a non-zero-sized class inheriting from...
Jeremy Koritzinsky [Tue, 20 Apr 2021 18:41:04 +0000 (11:41 -0700)]
Use adjusted parent layout size to handle a non-zero-sized class inheriting from a zero-sized class that inherits from another zero-sized class. (#50861)

3 years agoRemove FileStream long pinning, and simplify synchronization (#51462)
Stephen Toub [Tue, 20 Apr 2021 18:27:54 +0000 (14:27 -0400)]
Remove FileStream long pinning, and simplify synchronization (#51462)

* Remove pinning in BufferedFileStreamStrategy

* Simplify code/synchronization in ValueTaskSource

3 years agoAdd metadata update handler to System.ComponentModel.TypeConverter (#51466)
Stephen Toub [Tue, 20 Apr 2021 18:27:14 +0000 (14:27 -0400)]
Add metadata update handler to System.ComponentModel.TypeConverter (#51466)

* Add metadata update handler to System.ComponentModel.TypeConverter

* Update src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs

3 years agoFix GCSettings.LatencyMode test TODO (#51547)
Jan Kotas [Tue, 20 Apr 2021 18:09:27 +0000 (11:09 -0700)]
Fix GCSettings.LatencyMode test TODO (#51547)

3 years agoIncrease SslStream Frameoverhead estimation for newer TLS protocols (#51320)
Ben Adams [Tue, 20 Apr 2021 17:48:11 +0000 (18:48 +0100)]
Increase SslStream Frameoverhead estimation for newer TLS protocols (#51320)

3 years agofix zero byte Send on linux (#51473)
Geoff Kizer [Tue, 20 Apr 2021 16:30:38 +0000 (09:30 -0700)]
fix zero byte Send on linux (#51473)

* fix zero byte send on linux and update tests

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoUse EVP_PKEY for RSA public key operations
Jeremy Barton [Tue, 20 Apr 2021 16:26:50 +0000 (09:26 -0700)]
Use EVP_PKEY for RSA public key operations

Also change the storage model to SafeEvpPKeyHandle,
only import and export use legacy SafeRsaHandle.

3 years agoMono runtime component infrastructure including EventPipe/DiagnosticsServer as a...
Johan Lorensson [Tue, 20 Apr 2021 15:01:33 +0000 (17:01 +0200)]
Mono runtime component infrastructure including EventPipe/DiagnosticsServer as a Mono runtime component. (#50837)

Implementation of Mono runtime component infrastructure, https://github.com/dotnet/runtime/blob/main/docs/design/mono/components.md.

This commit also includes a port of Mono EventPipe/DiagnosticsServer library over to new runtime component infrastructure.

Before all packaging/deploy have been fixed for platforms that will switch over to hosting components as shared libraries, all components will be build and linked using the static linkage scenario outline in document above. Once package and deploy is resolved for dynamic linking scenarios, we will switch this for corresponding platforms in follow up commits.

3 years agoFix EventSource trimmer warning (#51237)
Lakshan Fernando [Tue, 20 Apr 2021 12:07:36 +0000 (05:07 -0700)]
Fix EventSource trimmer warning (#51237)

* eh fix

* test change that inadvertently got checked in earlier

* Suppresses the trimmer warning on TypeAnalysis ctor

* Incorporating FB

* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Fix DynamicDependency as per PR feedback

* an earlier change got reverted

* fixed proj file netcore app condition check

* fixed NETCORE_ENGINEERING_TELEMETRY build failures

* fixeing another NETCORE_ENGINEERING_TELEMETRY build failures

* Adding RequiresUnreferencedCode to TypeAnalysis ctor instead of suppressing the warning to get FB, not fully fixed

* PR FB and suppressing warnings for safe calls

* propagated the warning all the way up

* CI build break fix for one file

* excluding NativeRTEventSrc from being build in a project

* Missed couple of supppressions on NativeRTEventSrc

* build break fixes

* Trimmer warning fix related to EventSource manifest creation

* incorporate fb

* fix build break in some configs

* comment feedback

* build break

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoMark System.Console APIs as unsupported on Android (#50931)
Maxim Lipnin [Tue, 20 Apr 2021 10:14:32 +0000 (13:14 +0300)]
Mark System.Console APIs as unsupported on Android (#50931)

Annotated public System.Console APIs throwing PNSE on Android.

Part of #47911.

3 years agoRefactor build to use SupportedOSPlatforms instead of IsWindowsSpecific (#51450)
Jeff Handley [Tue, 20 Apr 2021 04:52:12 +0000 (21:52 -0700)]
Refactor build to use SupportedOSPlatforms instead of IsWindowsSpecific (#51450)

3 years agoPut Marshal.GetHINSTANCE under ifdef for Windows instead of COM (#51523)
Elinor Fung [Tue, 20 Apr 2021 02:57:28 +0000 (19:57 -0700)]
Put Marshal.GetHINSTANCE under ifdef for  Windows instead of COM (#51523)

3 years agoFix SPMI handling of PGO schemas with class profiles (#51521)
Andy Ayers [Tue, 20 Apr 2021 02:53:40 +0000 (19:53 -0700)]
Fix SPMI handling of PGO schemas with class profiles (#51521)

SPMI wasn't capturing enough data for PGO schemas that had class profiles,
leading to replay failures.

3 years agoEnable superpmi collection for libraries tests (#51507)
Kunal Pathak [Tue, 20 Apr 2021 01:34:06 +0000 (18:34 -0700)]
Enable superpmi collection for libraries tests (#51507)

* Run SPMI collection on libraries-tests

* Only run for libraries-tests and change GUID

* fix error

* fix the collection name

* fix the timeoutInMinutes

* Download libraries test artifacts

* try to fix the libs+tests artifacts name

* Use artifacts name as is

* Fix the libraries test artifacts name

* Use librares_test.zip

* Modify the filter to unzip all *Tests.dll files

* Revert "Modify the filter to unzip all *Tests.dll files"

This reverts commit b62f7132ec084453495a92a3e336688585366908.

* Try to unzip libraries_zipped

* overwriteExistingFiles=true

* Fix the asset extension

- Also exclude files present in core_root

* fix artifacts name

* remove extra .

* Ignore permission error

* Copy common test files in CORE_ROOT

- And do not copy not *.Tests.dll" for PMI

* Perform collection for all libraries_tests assets

* Add UnicodeEncodeError EH

* Add PermissionError for copy2

* Copy all the test assests to core_root

* Make input_directory readonly

* make ch_mod recursive

* Add option of error_limit to superpmi.py

* Pass -failureLimit flag to parallel mode

* Revert "Only run for libraries-tests and change GUID"

This reverts commit 7f4cdda9cf4f49fc21a354f616a67554f65cd6ea.

3 years agoUpdating Vector<T> to support nint and nuint (#50832)
Tanner Gooding [Tue, 20 Apr 2021 00:55:09 +0000 (17:55 -0700)]
Updating Vector<T> to support nint and nuint (#50832)

* Refactoring GenTreeJitIntrinsic to expose SimdSize and SimdBaseType via methods

* Updating the JIT to pass through the CORINFO_TYPE for hardware intrinsics

* Adding support for Vector<nint> and Vector<nuint> to managed code

* Updating the vector tests to cover nint and nuint

* Recognize Vector<nint> and Vector<nuint> in the JIT

* Updating Vector64/128/256<T> NotSupportedTest metadata to include type name

* Updating the Vector64/128/256<T> tests to have NotSupported validation for nint/nuint

* Splitting ThrowHelper.ThrowForUnsupportedVectorBaseType into separate functions for Numerics vs Intrinsics

* Updating Utf16Utility.Validation to directly use Vector<nuint>

* Don't use the auxiliary type to hold a SIMD type, since it can be trivially pulled from the operand instead

* Split the mono handling for ThrowForUnsupportedVectorBaseType into ThrowForUnsupportedNumericsVectorBaseType and ThrowForUnsupportedIntrinsicsVectorBaseType

* Add basic handling for MONO_TYPE_I and MONO_TYPE_U to simd-intrinsics.c

* Ensure simd-intrinsics.c in Mono handles `MONO_TYPE_I` and `MONO_TYPE_U` on relevant code paths

* Ensure we don't assert when encountering synthesized Vector128<nint> handles

* Applying formatting patch

* Fix the handling for Crc32 and Crc32C on ARM64

* Updating Mono mini-amd64 to handle MONO_TYPE_I and MONO_TYPE_U for SIMD operations

* Handle OP_XCOMPARE.CMP_GE_UN for MONO_TYPE_U

* Handle MONO_TYPE_I and MONO_TYPE_U for Vector types in mini-llvm

3 years agoAddress remaining warnings from DataContractSerialization (#51200)
Jose Perez Rodriguez [Mon, 19 Apr 2021 22:59:38 +0000 (15:59 -0700)]
Address remaining warnings from DataContractSerialization (#51200)

* Address remaining warnings from DataContractSerialization

* Refactor MemberTypes declaration

* Remove Unused UnconditionalSuppressMessages

* Addressing some PR Feedback

* Suppress MakeGenericMethod calls in AccessorBuilder

* Suppressing error in NullPrimitiveDataContract constructor

* Suppress other MakeGenericMethod linker warnings

* Address remaining feedback and move trimmer string to DataContract

* Addressing some nits

* Fix typo and remove unnecesary usings

3 years agoHTTP/3: Fix variable length encoding (#51486)
James Newton-King [Mon, 19 Apr 2021 21:30:51 +0000 (09:30 +1200)]
HTTP/3: Fix variable length encoding (#51486)

3 years agoFix issue #51468 (#51469)
Valentin Grigorev [Mon, 19 Apr 2021 21:28:08 +0000 (00:28 +0300)]
Fix issue #51468 (#51469)

Co-authored-by: Valentin Grigorev <valentin.grigorev@jetbrains.com>
3 years agoAdd quotes around method.Name for crossgen2 replay instruction. (#51453)
Sergey Andreenko [Mon, 19 Apr 2021 20:34:19 +0000 (13:34 -0700)]
Add quotes around method.Name for crossgen2 replay instruction. (#51453)

3 years agoCbor docs - Fix SA1121: Use built-in type alias (#51516)
Carlos Sanchez [Mon, 19 Apr 2021 20:11:19 +0000 (13:11 -0700)]
Cbor docs - Fix SA1121: Use built-in type alias (#51516)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
3 years agoCleanup memory on error in consoleargs.cpp (#50289)
Omair Majid [Mon, 19 Apr 2021 20:08:34 +0000 (16:08 -0400)]
Cleanup memory on error in consoleargs.cpp (#50289)

3 years agoAdd ConfigureHostOptions extension method on IHostBuilder (#51410)
David Pine [Mon, 19 Apr 2021 19:00:01 +0000 (14:00 -0500)]
Add ConfigureHostOptions extension method on IHostBuilder (#51410)

- Add two `ConfigureHostOptions` extension methods
  - Two overloads exist, per [Maryam's comment](https://github.com/dotnet/runtime/pull/49502/files#r596466330)
- Add corresponding unit tests to ensure these new methods function correctly

Fixes #48743

3 years agoFix contract violation when reporting tailcall stub loader (#51485)
Jakob Botsch Nielsen [Mon, 19 Apr 2021 18:59:20 +0000 (20:59 +0200)]
Fix contract violation when reporting tailcall stub loader (#51485)

Fix #51476

3 years agoRefactor interop usage in DirectoryServices (#51325)
Matt Thalman [Mon, 19 Apr 2021 18:53:52 +0000 (13:53 -0500)]
Refactor interop usage in DirectoryServices (#51325)

3 years agoFix ./build.sh --portableBuild false
Omair Majid [Mon, 19 Apr 2021 18:38:01 +0000 (14:38 -0400)]
Fix ./build.sh --portableBuild false

Non-portable builds are used by source-build and also use for
testing/debugging things, like trying out upcoming versions of OpenSSL.

3 years agoFix armel cross build error (#51479)
Dong-Heon Jung [Mon, 19 Apr 2021 18:37:25 +0000 (03:37 +0900)]
Fix armel cross build error (#51479)

- Failed by https://github.com/dotnet/runtime/pull/51349

3 years agoBackport of CBOR documentation (#49506)
Eirik Tsarpalis [Mon, 19 Apr 2021 17:46:43 +0000 (18:46 +0100)]
Backport of CBOR documentation (#49506)

* initial backport of CBOR documentation

* apply manual fixups to documentation

* Update src/libraries/System.Formats.Cbor/src/System/Formats/Cbor/Reader/CborReader.Map.cs

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
* Update src/libraries/System.Formats.Cbor/src/System/Formats/Cbor/Writer/CborWriter.Map.cs

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
3 years agoBump installer tests timeout to 90m (#51494)
Viktor Hofer [Mon, 19 Apr 2021 17:36:03 +0000 (19:36 +0200)]
Bump installer tests timeout to 90m (#51494)

They timed out in https://dev.azure.com/dnceng/public/_build/results?buildId=1095082&view=logs&jobId=d900f740-c9a5-5bf8-c5f6-bf1e5b71239a&j=d900f740-c9a5-5bf8-c5f6-bf1e5b71239a&t=8d9f84ed-f820-5356-7f05-f798e3a00bae.

3 years agoFix TimeOnly format O (#51484)
devsko [Mon, 19 Apr 2021 17:25:32 +0000 (19:25 +0200)]
Fix TimeOnly format O (#51484)

3 years agoUpdate HostTests.cs (#51495)
David Pine [Mon, 19 Apr 2021 17:23:36 +0000 (12:23 -0500)]
Update HostTests.cs (#51495)

3 years agoUse same TimeZoneInfo implementation on iOS/tvOS as on browser (#51457)
Filip Navara [Mon, 19 Apr 2021 17:08:53 +0000 (19:08 +0200)]
Use same TimeZoneInfo implementation on iOS/tvOS as on browser (#51457)

Ref: https://github.com/xamarin/xamarin-macios/pull/11175#issuecomment-821969933, https://unicode-org.atlassian.net/browse/ICU-21591

There seems to be a bug in ICU that leads to deadlock when the time zone data are stripped. Since dotnet/icu uses the same stripping of data on all the platforms the time zone data are also not present on iOS/tvOS or any platform that consumes it. So even if the deadlock itself is resolved at some point it makes sense to use the same implementation for all the platforms that rely on the filtered app-local ICU data.

I also enabled to code path on MacCatalyst to keep it consistent with iOS. I am open to change that. Android may need to be treated the same way too.

3 years agoCreate standalone class for CallConv parsing. (#51441)
Aaron Robinson [Mon, 19 Apr 2021 16:52:27 +0000 (09:52 -0700)]
Create standalone class for CallConv parsing. (#51441)

* Create standalone class for CallConv parsing.

3 years ago[QUIC] Add ShutdownCompleted method and fix receive and shutdown behavior in tests...
Natalia Kondratyeva [Mon, 19 Apr 2021 16:26:55 +0000 (18:26 +0200)]
[QUIC] Add ShutdownCompleted method and fix receive and shutdown behavior in tests (#50930)

This PR fixed QuicStreamTests.BasicTest and QuicStreamTests.MultipleReadsAndWrites.

Contributes to #49157

3 years ago.vsconfig update for .NET 4.8 (#51464)
GilesDMiddleton [Mon, 19 Apr 2021 14:42:33 +0000 (15:42 +0100)]
.vsconfig update for .NET 4.8 (#51464)

.vsconfig was missing the missing
the .NET 4.8 Targetting pack option.

Fix #51455

3 years agoFix System.Runtime tests for single file runner (#50996)
Michal Strehovský [Mon, 19 Apr 2021 14:16:30 +0000 (16:16 +0200)]
Fix System.Runtime tests for single file runner (#50996)

Allows us to test the documented single file behaviors.

Not adding a new `PlatformDetection` thing for this since we don't really have a way to detect single file that wouldn't end us up testing a tautology.

3 years agoReduce unnecessary casting in SslStreamPal (#51324)
Ben Adams [Mon, 19 Apr 2021 13:42:49 +0000 (14:42 +0100)]
Reduce unnecessary casting in SslStreamPal (#51324)

3 years agoSimplify trimming non significant digits in JsonUtf8Writer (#51367)
devsko [Mon, 19 Apr 2021 10:34:11 +0000 (12:34 +0200)]
Simplify trimming non significant digits in JsonUtf8Writer (#51367)

* simplify trimming non significant digits

* PR feedback

* fixed formatting

3 years agoAdd JSON source generator (#51300)
Layomi Akinrinade [Mon, 19 Apr 2021 08:03:50 +0000 (01:03 -0700)]
Add JSON source generator (#51300)

* Add JSON source generator

* Address review feedback

* Address review feedback

* Align project structure with src-gen conventions

* Fix enum (de)serialization

3 years ago[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/xharness dotnet/runti...
dotnet-maestro[bot] [Sun, 18 Apr 2021 06:22:28 +0000 (08:22 +0200)]
[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/xharness dotnet/runtime-assets (#51307)

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

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.21212.6 -> To Version 6.0.0-beta.21214.5

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21214.1 -> To Version 1.0.0-prerelease.21215.2

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

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.21212.6 -> To Version 6.0.0-beta.21215.5

* Update dependencies from https://github.com/dotnet/runtime-assets build 20210415.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.21212.1 -> To Version 6.0.0-beta.21215.1

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

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.21212.6 -> To Version 6.0.0-beta.21216.2

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-preview.4.21212.2 -> To Version 6.0.0-preview.5.21216.2

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21214.1 -> To Version 1.0.0-prerelease.21216.1

* Update dependencies from https://github.com/dotnet/runtime-assets build 20210416.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.21212.1 -> To Version 6.0.0-beta.21216.1

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 agoRework request retry logic to be based on retry count limit (#48758)
Geoff Kizer [Sun, 18 Apr 2021 05:42:42 +0000 (22:42 -0700)]
Rework request retry logic to be based on retry count limit (#48758)

* rework request retry logic to be based off a fixed retry limit (MaxConnectionFailureRetries) instead of isNewConnection logic

* be more conservative about request retries -- only allow on receiving EOF or GOAWAY from the server

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoadd Task-based DisconnectAsync and refactor APM methods on top of it (#51213)
Geoff Kizer [Sun, 18 Apr 2021 02:40:53 +0000 (19:40 -0700)]
add Task-based DisconnectAsync and refactor APM methods on top of it (#51213)

* add Task-based DisconnectAsync and refactor APM methods on top of it

* fix BeginDisconnect to throw synchronously and add relevant tests

* remove #region stuff in Socket.cs and add link to github issue

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years ago MacOS single-file diagnostic support changes (#51425)
Mike McLaughlin [Sat, 17 Apr 2021 21:25:10 +0000 (14:25 -0700)]
 MacOS single-file diagnostic support changes (#51425)

* MacOS single-file support changes

Use dysymtab_command to just load the extern/export symbols. Don't read
the whole symbol string table; read the symbol name a char at a time.

https://github.com/dotnet/runtime/issues/38901

* Don't add null to symbol name

* Code review feedback

* Code review feedback

* Code review feedback fix

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210417.1 (#51435)
dotnet-maestro[bot] [Sat, 17 Apr 2021 16:11:48 +0000 (09:11 -0700)]
Update dependencies from https://github.com/mono/linker build 20210417.1 (#51435)

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

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoJIT: generalize the branch around empty flow optimization (#51409)
Andy Ayers [Sat, 17 Apr 2021 15:45:20 +0000 (08:45 -0700)]
JIT: generalize the branch around empty flow optimization (#51409)

If a BBJ_COND block falls through to an empty block which then jumps to some other
block, see if reversing the branch condition might simplify flow.

Resolves #46592.

3 years agoAdd Array.GetMaxLength<T> (#43301)
Huo Yaoyuan [Sat, 17 Apr 2021 12:08:56 +0000 (20:08 +0800)]
Add Array.GetMaxLength<T> (#43301)

* Add Array.GetMaxLength<T> implementation.

* Implement Array.MaxLength and fix all remaining references

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Update src/libraries/System.Collections/tests/Generic/Stack/Stack.Generic.Tests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoCouple of small perf tweaks to InterpolatedStringBuilder (#51356)
Stephen Toub [Sat, 17 Apr 2021 12:07:41 +0000 (08:07 -0400)]
Couple of small perf tweaks to InterpolatedStringBuilder (#51356)

* Change InterpolatedStringBuilder to store bool for custom formatter

* Use new string rather than ToString in InterpolatedStringBuilder

* Address PR feedback

3 years agoPass linker flags to Mono build on Android correctly (#51403)
Alexander Köplinger [Sat, 17 Apr 2021 08:33:34 +0000 (10:33 +0200)]
Pass linker flags to Mono build on Android correctly (#51403)

We were setting `_MonoLDFLAGS` in mono.proj but never passed the values down into CMake.

3 years agoOptimize Span<T>.Fill implementation (#51365)
Levi Broderick [Sat, 17 Apr 2021 08:29:50 +0000 (01:29 -0700)]
Optimize Span<T>.Fill implementation (#51365)

3 years agoUpdate DynamicallyAccessedMembersAttribute documentation. (#51408)
Eric Erhardt [Sat, 17 Apr 2021 07:55:45 +0000 (02:55 -0500)]
Update DynamicallyAccessedMembersAttribute documentation. (#51408)

Describe what it means to be applied to class, interface, or struct.

3 years agoReplace some uses of Span.Fill with Span.Clear (#51428)
Levi Broderick [Sat, 17 Apr 2021 07:16:43 +0000 (00:16 -0700)]
Replace some uses of Span.Fill with Span.Clear (#51428)

3 years agoupdate branding to preview5 (#51407)
Anirudh Agnihotry [Sat, 17 Apr 2021 06:45:41 +0000 (23:45 -0700)]
update branding to preview5 (#51407)

3 years agoHandle completed FlushResult on CopyToAsync (#51147)
Emmanuel André [Sat, 17 Apr 2021 05:33:16 +0000 (07:33 +0200)]
Handle completed FlushResult on CopyToAsync (#51147)

* Handle completed FlushResult on CopyToAsync

* Avoid the async state machine if write finishes synchronously

* Add test case for resume after target pipe is completed

3 years agoFix tree threading in fgOptimizeBranch (#51422)
Bruce Forstall [Sat, 17 Apr 2021 05:05:39 +0000 (22:05 -0700)]
Fix tree threading in fgOptimizeBranch (#51422)

In case `fgOptimizeBranch` gets far enough to calculate the cost of
statements it is considering duplicating, then it calls `gtPrepareCost` =>
`gtSetEvalOrder` to compute a statement's costs. Unfortunately, that
can reverse operands (and in this case, did). `fgOptimizeBranch` is
called only by `fgReorderBlocks` which is called by `fgInsertGCPolls`,
late enough that the tree is already threaded with gtNext/gtPrev links.
(The test case inserted multiple GC polls for SuppressGCTransitionAttribute
code.) When the operands of the tree were swapped, nobody fixed up these links.
The only other caller of `fgReorderBlocks` is `optOptimizeLayout`, which
comes before the trees are threaded.

The solution is to simply call `fgSetStmtSeq` if needed.

No SPMI x86, x64 asm diffs.

Fixes #51293, a failure in JIT/Performance/CodeQuality/Burgers/Burgers/Burgers.sh
on Linux arm32 under JitStress=1. There is IBC data, and setting
`COMPlus_JitDisablePgo=1` also fixes the failure.

3 years agoFix GC hole with collectible assemblies and tailcalls (#51315)
Jakob Botsch Nielsen [Fri, 16 Apr 2021 23:33:13 +0000 (01:33 +0200)]
Fix GC hole with collectible assemblies and tailcalls (#51315)

We must take special care to keep the tailcall dispatcher targets alive
while tailcalls are in-flight. In particular, given the following
callstack:

[B]M2()
[SPC]DispatchTailCalls
[A]M()

it could happen that [B]M2() queued a tail call to a function [B]M3().
Since there is a live dispatcher on the call stack, this would result in
[B]M2() storing a function pointer pointing to [B]M3() and returning to
this dispatcher to let it take care of the tailcall.

If B was loaded in a collectible ALC, it would then be possible for
there to be nothing keeping this ALC alive, and for the assembly to be
unloaded before the dispatcher invoked the function pointer.

I was unable to come up with a test case where this happened without
making changes to the dispatcher; the window otherwise seems to be too
small. To reproduce the problem I thus had to add a Thread.Sleep(50)
into the dispatcher, which quickly resulted in an
AccessViolationException in the scenario above. With the changes in this
commit I was then no logner able to reproduce the problem.

Fix #41314

3 years agoClean Installer test (#51373)
Mateo Torres-Ruiz [Fri, 16 Apr 2021 23:08:06 +0000 (16:08 -0700)]
Clean Installer test (#51373)

* Clean test

* Remove dir deletion

* Create parent dirs

3 years agoFileStream rewrite: Caching the ValueTaskSource in AsyncWindowsFileStreamStrategy...
Carlos Sanchez [Fri, 16 Apr 2021 23:03:28 +0000 (16:03 -0700)]
FileStream rewrite: Caching the ValueTaskSource in AsyncWindowsFileStreamStrategy (#51363)

* Caching the ValueTaskSource in AsyncWindowsFileStreamStrategy

* Add debug assert to WriteByteSlow for _writePos == _bufferSize

* Fix assertion failure

* Apply suggestions from code review

* Apply suggestions from code review

* some pedantic polishing

* fix the allocation bug: actually return the instance to the "pool"

* don't Dipose the handle if it has default value

* reset _result and _source in the Configure method

* delay the moment when the ValueTaskSource becomes ready to be reused to the moment after _source.SetException|SetResult is called

* apply Stephen suggestions

* implement Stephen idea

* use Reset in explicit way

* remove outdated comment

* address code review feedback

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
Co-authored-by: David Cantú <dacantu@microsoft.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
3 years agoSkip forwarding entrypoint library name to Android application Main() (#51397)
Alexander Köplinger [Fri, 16 Apr 2021 21:26:26 +0000 (23:26 +0200)]
Skip forwarding entrypoint library name to Android application Main() (#51397)

Some of the Android runtime tests were recently broken because they got an "entryPointLibName=<test assembly name>" argument in their Main args.
This argument is normally used to run a specific test: https://github.com/dotnet/runtime/blob/dd63ea2e6a9cc6f2661b817d15e558fc6605fa17/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Program.cs#L24

After https://github.com/dotnet/runtime/commit/1a98ba0ec20550c9e1ece5fff555d683dec3252b we were passing the `entryPointLibName` down to the managed app args even though it's only supposed to be used to tell the runtime which assembly to run.