platform/upstream/dotnet/runtime.git
2 years agoundo gcname while running crossgen2 within standalone CI (#56361)
Manish Godse [Thu, 29 Jul 2021 17:56:07 +0000 (10:56 -0700)]
undo gcname while running crossgen2 within standalone CI (#56361)

* undo gcname while running crossgen2

* Fix couple more R2R tests to ignore standalone gc

* Fix comments based on CR

2 years ago[mono] Fix the long opcode decompose pass when using llvm. (#56535)
Zoltan Varga [Thu, 29 Jul 2021 17:30:34 +0000 (13:30 -0400)]
[mono] Fix the long opcode decompose pass when using llvm. (#56535)

It was replacing 64 bit opcodes with 32 bit ones while keeping the input/output 64 bit
vregs, leading to memory overwrites in later passes. Instead simply keep the 64
bit opcodes, llvm can handle them.

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

2 years ago[wasm][debugger] Fix javascript tests (#56489)
Thays Grazia [Thu, 29 Jul 2021 17:13:48 +0000 (14:13 -0300)]
[wasm][debugger] Fix javascript tests (#56489)

* Avoid throwing an exception outside the try catch when trying to get DebuggerDisplay and break the debugger.

* Fixing debugger tests that debug JS.

* revert unrelated changes on monosdbhelper.

* Update src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Addressing @radical comments.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoAvoid capturing current SynchronizationContext in SocketPal.SendPacketsAsync (#56512)
Stephen Toub [Thu, 29 Jul 2021 16:54:22 +0000 (12:54 -0400)]
Avoid capturing current SynchronizationContext in SocketPal.SendPacketsAsync (#56512)

2 years agoChange area ownership for R2R (#56557)
Manish Godse [Thu, 29 Jul 2021 16:53:06 +0000 (09:53 -0700)]
Change area ownership for R2R (#56557)

* update owners

* Fix whitespace

2 years ago[mono][aot] Emit extra interp entry wrappers for long signatures. (#56414)
Zoltan Varga [Thu, 29 Jul 2021 15:56:14 +0000 (11:56 -0400)]
[mono][aot] Emit extra interp entry wrappers for long signatures. (#56414)

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

2 years agoJIT: fix pred list maintenance during fgUpdateFlowGraph (#56509)
Andy Ayers [Thu, 29 Jul 2021 15:53:42 +0000 (08:53 -0700)]
JIT: fix pred list maintenance during fgUpdateFlowGraph (#56509)

Handle case where a BBJ_COND block both falls through and branches to
another block, and we want to introduce a block to re-route the fall through.

Closes #56495.

2 years ago[mono] Export jit icalls on osx/catalyst as well. (#56545)
Zoltan Varga [Thu, 29 Jul 2021 15:53:18 +0000 (11:53 -0400)]
[mono] Export jit icalls on osx/catalyst as well. (#56545)

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

2 years agoFix IsolatedStorage initialization on Android (#56534)
Alexander Köplinger [Thu, 29 Jul 2021 15:19:16 +0000 (17:19 +0200)]
Fix IsolatedStorage initialization on Android (#56534)

Android doesn't set an entry assembly so we need to handle that case.

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

2 years ago[mono] Fix an uninitialized memory access in the ABCREM pass. (#56508)
Zoltan Varga [Thu, 29 Jul 2021 14:49:44 +0000 (10:49 -0400)]
[mono] Fix an uninitialized memory access in the ABCREM pass. (#56508)

Detected by valgrind.

2 years ago[debugger] Improve debug after hot reload (#55869)
Thays Grazia [Thu, 29 Jul 2021 14:41:43 +0000 (11:41 -0300)]
[debugger] Improve debug after hot reload (#55869)

* Creating more test for hot reload debugging.

* Fixing step on android after hot reload.

* Fix get document information from enc pdb.

* Addressing Aleksey comments.

* Addressing @lambdageek comments and fixing implementation of mono_ppdb_lookup_location

* Fixing compilation on ios.

* Fix android compilation.

2 years agoFix StreamWindowScaleThresholdMultiplier_HighValue_WindowScalesSlower (#56373)
Anton Firszov [Thu, 29 Jul 2021 13:57:36 +0000 (15:57 +0200)]
Fix StreamWindowScaleThresholdMultiplier_HighValue_WindowScalesSlower (#56373)

2 years agoRevert "JIT: Drop redundant static initializations from (Equality)Comparer<T>.Default...
Egor Bogatov [Thu, 29 Jul 2021 13:08:42 +0000 (16:08 +0300)]
Revert "JIT: Drop redundant static initializations from (Equality)Comparer<T>.Default (#50446)" (#56400)

This reverts commit 46e5fe1c9a4584b006601d46063b353338219af0.

2 years ago[mono] remove redundant DISABLE_PERF_COUNTERS option (#56420)
Aleksey Kliger (λgeek) [Thu, 29 Jul 2021 13:05:58 +0000 (09:05 -0400)]
[mono] remove redundant DISABLE_PERF_COUNTERS option (#56420)

* [mono] remove redundant DISABLE_PERF_COUNTERS option

There is already a `DISABLE_PERFCOUNTERS` option, which is always set in src/mono/CMakeLists.txt

* fix log profiler in Android builds

2 years ago[libraries][Android] Re-enable test suites no longer failing with JSON parsing except...
Mitchell Hwang [Thu, 29 Jul 2021 12:58:21 +0000 (08:58 -0400)]
[libraries][Android] Re-enable test suites no longer failing with JSON parsing exception for Android arm64 (#56411)

* Temporarily remove test suites from proj level skip to evaluate JSON parsing

* Temporarily enable tests ran on this draft PR

* Remove temporary disabling of arm lanes for Android runtime-staging

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoFix the build of a couple SLNs (#56483)
Eric StJohn [Thu, 29 Jul 2021 11:32:37 +0000 (04:32 -0700)]
Fix the build of a couple SLNs (#56483)

Build in VS was broken because of missing projects from SLN and VS
attempting to call GetTargetPath on outer build of AnalyzerReference projects.

2 years agoDisable test ResponseHeadersRead_SynchronizationContextNotUsedByHandler for WinHttpHa...
Karel Zikmund [Thu, 29 Jul 2021 10:35:05 +0000 (12:35 +0200)]
Disable test ResponseHeadersRead_SynchronizationContextNotUsedByHandler for WinHttpHandler on Win7/Win81 (#56490)

Disable test ResponseHeadersRead_SynchronizationContextNotUsedByHandler for WinHttpHandler on Win7/Win81
Test types:
- System.Net.Http.Functional.Tests.PlatformHandler_HttpClientHandler_Asynchrony_Test
- System.Net.Http.Functional.Tests.PlatformHandler_HttpClientHandler_Asynchrony_Http2_Test

Disabled test tracked by #54034

2 years agoRemove Reflection.Emit APIs (#56153)
Bar Arnon [Thu, 29 Jul 2021 08:22:03 +0000 (11:22 +0300)]
Remove Reflection.Emit APIs (#56153)

* Remove Reflection.Emit APIs

Removes all unused leftover APIs

Fix #49452

* Fix the api-compat baseline

* Remove the baseline altogether

* Remove fIsTransient refs from .cpp (as well as .h)

* Remove nIsTransientInternal

* Remove DefineDynamicModule & DefineDocument

* Revert "Remove the baseline altogether"

This reverts commit ddb0303af94e6126848ef18cd09a70b55775a43b.

* API compat baseline for GetModuleHandleImpl

* Fix Mono

* Match changes in Mono runtime

2 years agoFix two issues with budget smoothing: (#56467)
Peter Sollich [Thu, 29 Jul 2021 08:03:31 +0000 (10:03 +0200)]
Fix two issues with budget smoothing: (#56467)

- We smoothed budgets *across* LOH and POH by mistake
- We didn't do any budget smoothing for LOH and POH in background GCs.

2 years agoUse Ubuntu instead of macOS pool for evaluate-paths-job.yml (#56479)
Alexander Köplinger [Thu, 29 Jul 2021 07:57:55 +0000 (09:57 +0200)]
Use Ubuntu instead of macOS pool for evaluate-paths-job.yml (#56479)

The script can run on Ubuntu as well so we can take some work off of the congested macOS pool.

Also set a fetch depth of 2 since that's all we need to calculate the changed paths, this shaves ~40 seconds off that step.

2 years agoPass excludemonofailures in managed test build job for mono (#56434)
Elinor Fung [Thu, 29 Jul 2021 05:45:28 +0000 (22:45 -0700)]
Pass excludemonofailures in managed test build job for mono (#56434)

* Pass excludemonofailures in managed test build job for mono
* Make test build scripts pass RuntimeFlavor when building tests (not just wrappers)

2 years agoavoid NRE in MsQuicConnection ConnectAsync (#56283)
Tomas Weinfurt [Thu, 29 Jul 2021 05:02:14 +0000 (22:02 -0700)]
avoid NRE in MsQuicConnection ConnectAsync (#56283)

* avoid NRE in MsQuicConnection ConnectAsync

* enable disabled test

* one more place where we set ConnectTcs to null

* use local variable

* feedback from review

2 years agoSupport 8-byte alignment for 12-byte structs on ARM32 (#56375)
Jakob Botsch Nielsen [Thu, 29 Jul 2021 03:45:51 +0000 (05:45 +0200)]
Support 8-byte alignment for 12-byte structs on ARM32 (#56375)

* Support 8-byte alignment for 12-byte structs on ARM32

Through explicit attributes it is possible that 8-byte aligned structs
are 12 bytes in size, so handle this in arm32 when we figure out if we
need an extra spill to keep the alignment.

Fix #42723

* Add a regression test

2 years agoAlter RuntimeComponentManifest.targets to use the correct runtime pack (#56431)
Steve Pfister [Thu, 29 Jul 2021 03:26:01 +0000 (23:26 -0400)]
Alter RuntimeComponentManifest.targets to use the correct runtime pack (#56431)

2 years agoFix EventSource shutdown deadlock (#56453)
Noah Falk [Thu, 29 Jul 2021 02:44:49 +0000 (19:44 -0700)]
Fix EventSource shutdown deadlock (#56453)

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

A deadlock was occuring because we held the EventListenersLock
while calling into EventUnregister which will take ETW's own native
lock. In the case of ETW sending an enable/disable notification
these locks are taken in reverse order which triggers a deadlock.

The fix is to ensure that we always order the locks so that any code
path taking both locks always takes the ETW lock first. In this case
it meant accumulating the list of event sources to dispose under
the lock but then exiting the lock prior to calling Dispose() which
will eventually call EventUnregister.

2 years agoReenable DiagnosticSource tests (#56500)
Noah Falk [Thu, 29 Jul 2021 02:43:50 +0000 (19:43 -0700)]
Reenable DiagnosticSource tests (#56500)

A few years ago this test was timing out on ARM64 because of hardware
constraints. I am re-enabling the test to see if this is still an issue
or if the situation has been resolved since then.

2 years agoValidate ref project references (#56488)
Eric StJohn [Thu, 29 Jul 2021 00:45:49 +0000 (17:45 -0700)]
Validate ref project references (#56488)

* Validate that reference assembly projects only reference other reference assembly projects

* Permit ref->src reference if src project produces reference assembly

* Move target to references.targets

2 years agoCovariant return updates to ecma augments (#56496)
David Wrighton [Thu, 29 Jul 2021 00:43:46 +0000 (17:43 -0700)]
Covariant return updates to ecma augments (#56496)

* Covariant return updates to ecma augments

2 years agoRefTypeZeroInit doesn't need treeNode (#56333)
Kunal Pathak [Wed, 28 Jul 2021 22:47:00 +0000 (15:47 -0700)]
RefTypeZeroInit doesn't need treeNode (#56333)

* RefTypeZeroInit doesn't need treeNode

* Add a test case

2 years agoAdd missing doc comments (#56499)
Noah Falk [Wed, 28 Jul 2021 22:35:49 +0000 (15:35 -0700)]
Add missing doc comments (#56499)

2 years ago[wasm] Fix Publish for Blazorwasm projects on VS17 (#56432)
Ankit Jain [Wed, 28 Jul 2021 21:34:02 +0000 (17:34 -0400)]
[wasm] Fix Publish for Blazorwasm projects on VS17 (#56432)

TL;dr `publish` fails on any blazorwasm project with VS17

A recent commit[1] moved initializing `$(_WasmIntermediateOutputPath)` from
a target, to project level `PropertyGroup`. It is set as:

`<_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm'))</_WasmIntermediateOutputPath>`

The `NormalizeDirectory` call converts this to a full path, presumably
using the current directory.

Because we are setting `$(_WasmIntermediateOutputPath)` at the project
level, it gets evaluated during the evaluation phase. And the current
directory doesn't seem to be set to the project directory at that point
in VS. So, `$(_WasmIntermediateOutputPath)` gets a wrong path like:

`C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm`.

And then when actually publishing, it fails to create this directory
with:

`Unable to create directory "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\". Access to the path 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\' is denied.`

Fix:
Set the property in `_InitializeCommonProperties` *target*, at which
point the current directory is correctly set.

Note:
- This doesn't seem to be reproducible outside VS
- It happens only on `publish`, because that's when the wasm targets
  come into play.

--
1.
```
commit d574b032793ae752387d32b97ff9840de17420a2
Author: Ankit Jain <radical@gmail.com>
Date:   Mon Jul 19 01:02:01 2021 -0400

    [wasm] Add support for using custom native libraries (#55797)
```

2 years agoFix redhat arm64 (#52244)
Jan Vorlicek [Wed, 28 Jul 2021 20:51:25 +0000 (22:51 +0200)]
Fix redhat arm64 (#52244)

* Fix RHEL 8 ARM64

Clang on ARM64 places the .rodata section into the same segment
as .text. On RHEL 8 ARM64, the kernel is configured for 64kB
memory pages. When we flip the page protection of the page containing
the GS cookie to RW and back to RO, we assume that the cookie lives
in a non-executable memory. This assumption is broken on RHEL 8 and
we end up setting protection of a part of the coreclr code to read
only instead of back to RX.

This change switches the linker we use to lld from the previously
used gnu linker. That linker places .rodata into a different segment
than .text by default. Moreover, I was planning to move to using
lld anyways to use all build tools from LLVM.

* Fix ARM build to use PC relative addresses only

The lld linker has revealed that we were using absolute addresses in some
asm helpers and so load time relocation was necessary. This change fixes
it by replacing all of those by PC relative ones.

* Update docker images used for building runtime

Use new images that have lld linker

* Disable lld linker for s390x

2 years agoEventSource Manifest Trimmer test (#56463)
Lakshan Fernando [Wed, 28 Jul 2021 20:50:19 +0000 (13:50 -0700)]
EventSource Manifest Trimmer test (#56463)

* EventSource Manifest Trimmer test

* FB

2 years agoFix fr-CA culture time formatting and parsing (#56443)
Tarek Mahmoud Sayed [Wed, 28 Jul 2021 20:02:39 +0000 (13:02 -0700)]
Fix fr-CA culture time formatting and parsing (#56443)

2 years agoUpdate area-owners.md (#56481)
Dan Moseley [Wed, 28 Jul 2021 19:55:10 +0000 (13:55 -0600)]
Update area-owners.md (#56481)

* Update area-owners.md

added area-codeflow so that maestro PR's don't make noise by tagging the infrastructure areas.

* Update area-owners.md

2 years agoAssert if we find undefined use during interval validation (#56439)
Kunal Pathak [Wed, 28 Jul 2021 19:43:39 +0000 (12:43 -0700)]
Assert if we find undefined use during interval validation (#56439)

* Assert if we find undefined use during interval validation

* Include lastUse check

2 years agoJIT: properly update loop memory dependence when loops are removed (#56436)
Andy Ayers [Wed, 28 Jul 2021 19:39:15 +0000 (12:39 -0700)]
JIT: properly update loop memory dependence when loops are removed (#56436)

If a loop is removed (because of unrolling) then the loop dependence
tracking introduced in #55936 and #56184 may not properly update.

So when a loop is removed, walk up the chain of parent loops looking
for one that is not removed, and record the dependence on that parent.

Addresses last part of #54118.

2 years agoBuild support for s390x: corehost (#53949)
Ulrich Weigand [Wed, 28 Jul 2021 19:07:32 +0000 (21:07 +0200)]
Build support for s390x: corehost (#53949)

* Build the (non-Windows) host binaries with either runtime flavor

* s390x architecture support in get_arch utility

2 years agoFix an assert in PoolingAsyncValueTaskMethodBuilder (#56468)
Stephen Toub [Wed, 28 Jul 2021 18:23:01 +0000 (14:23 -0400)]
Fix an assert in PoolingAsyncValueTaskMethodBuilder (#56468)

2 years agoRe-enable System.IO.FileSystem.DriveInfoTests.DriveInfoUnixTests.PropertiesOfValidDri...
Maxim Lipnin [Wed, 28 Jul 2021 18:19:20 +0000 (21:19 +0300)]
Re-enable System.IO.FileSystem.DriveInfoTests.DriveInfoUnixTests.PropertiesOfValidDrive on Android (#56462)

Contributes to #42548.

Based on akoeplinger's suggestion #42209 (comment)

2 years agoAdd validation for MetadataType attribute - Issue #46678 (#51772)
Matthew Hill [Wed, 28 Jul 2021 18:15:42 +0000 (06:15 +1200)]
Add validation for MetadataType attribute - Issue #46678 (#51772)

* MetadataType attribute class properties are now validated.

Fix #46678

* Clean up PR #51772

Co-authored-by: Brice Lambson <brice@bricelam.net>
2 years agoFix createdump segfault writing crash report json (#56437)
Mike McLaughlin [Wed, 28 Jul 2021 17:35:57 +0000 (10:35 -0700)]
Fix createdump segfault writing crash report json (#56437)

2 years agoUpdate libraries solution and NuGet.config files (#56430)
Viktor Hofer [Wed, 28 Jul 2021 16:44:17 +0000 (18:44 +0200)]
Update libraries solution and NuGet.config files (#56430)

* Update slngen and invocation

* Update NuGet.config files

* Update solution files with slngen

2 years ago[wasm] Wasm.Build.Tests - try to close down the stdout/err readers (#56180)
Ankit Jain [Wed, 28 Jul 2021 16:35:23 +0000 (12:35 -0400)]
[wasm] Wasm.Build.Tests - try to close down the stdout/err readers (#56180)

2 years agoFix Neutral Culture Names (#56321)
Tarek Mahmoud Sayed [Wed, 28 Jul 2021 16:23:51 +0000 (09:23 -0700)]
Fix Neutral Culture Names (#56321)

* Fix Neutral Culture Names

2 years agoRemove MONO_IOMAP / portability from mono (#56458)
Alexander Köplinger [Wed, 28 Jul 2021 15:10:27 +0000 (17:10 +0200)]
Remove MONO_IOMAP / portability from mono (#56458)

It's not used in netcore mono (since it only works in mono but not the PAL) and judging by the discussion in https://github.com/dotnet/runtime/issues/35299 the consensus is that we should not bring that feature back.

2 years agoIntroduce new AddEventListener and RemoveEventListener APIs on JSObject (#55849)
Katelyn Gadd [Wed, 28 Jul 2021 14:59:44 +0000 (07:59 -0700)]
Introduce new AddEventListener and RemoveEventListener APIs on JSObject (#55849)

Introduces new AddEventListener and RemoveEventListener methods on JSObject that create a delegate wrapper with its lifetime managed by the JavaScript GC instead of managed types, to ensure that delegates don't go away while JS is still using them. Migrates BrowserWebSocket to use the new APIs.

2 years agoBuild runtime.native.System.IO.Ports on linux-s390x (#56424)
Ulrich Weigand [Wed, 28 Jul 2021 14:31:32 +0000 (16:31 +0200)]
Build runtime.native.System.IO.Ports on linux-s390x (#56424)

* Add RID to runtime.native.System.IO.Ports/netcoreapp.rids.props

* Update runtime.native.System.IO.Ports.pkgproj file.

2 years agoDisable ResolutionsWaitingOnQueue_ResolutionStartCalledBeforeEnqueued on Mono interpr...
Miha Zupan [Wed, 28 Jul 2021 13:44:03 +0000 (06:44 -0700)]
Disable ResolutionsWaitingOnQueue_ResolutionStartCalledBeforeEnqueued on Mono interpreter (#56457)

2 years agoAdd Android 31 and iOS/tvOS/MacCatalyst 15 to RID graph (#55933)
Alexander Köplinger [Wed, 28 Jul 2021 13:43:44 +0000 (15:43 +0200)]
Add Android 31 and iOS/tvOS/MacCatalyst 15 to RID graph (#55933)

These OS versions will go stable later this summer.

2 years agoFix for issue 56200 (#56261)
ChrisVicary [Wed, 28 Jul 2021 13:37:19 +0000 (06:37 -0700)]
Fix for issue 56200 (#56261)

Use InternalFormat when formatting an integer
value as an Enum that uses the FlagsAttribute.

Fix #56200

Co-authored-by: cvicary <cvicary@ea.com>
2 years agoDisable test ConnectWithCertificateForDifferentName_Throws (#56456)
Karel Zikmund [Wed, 28 Jul 2021 13:28:15 +0000 (15:28 +0200)]
Disable test ConnectWithCertificateForDifferentName_Throws (#56456)

Test: System.Net.Quic.Tests.MsQuicTests.ConnectWithCertificateForDifferentName_Throws

Disabled test tracked by #56454

2 years agoUpdate dependencies from https://github.com/mono/linker build 20210726.2 (#56374)
dotnet-maestro[bot] [Wed, 28 Jul 2021 11:45:08 +0000 (07:45 -0400)]
Update dependencies from https://github.com/mono/linker build 20210726.2 (#56374)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21370.1 -> To Version 6.0.100-preview.6.21376.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoCleanup disabled test conditions (#56381)
Karel Zikmund [Wed, 28 Jul 2021 11:44:51 +0000 (13:44 +0200)]
Cleanup disabled test conditions (#56381)

2 years ago[mono] Add GC unsafe transition to mono_unhandled_exception (#56380)
Thays Grazia [Wed, 28 Jul 2021 10:40:34 +0000 (07:40 -0300)]
[mono] Add GC unsafe transition to mono_unhandled_exception  (#56380)

* Fix assert gc_unsafe.

* Update src/mono/mono/metadata/object.c

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
2 years agodon't fail the file extraction when we can't set last write time (#56370)
Adam Sitnik [Wed, 28 Jul 2021 10:16:15 +0000 (12:16 +0200)]
don't fail the file extraction when we can't set last write time (#56370)

2 years agoProperly rebuild optimization data when it changes (#56397)
Jakob Botsch Nielsen [Wed, 28 Jul 2021 08:27:36 +0000 (10:27 +0200)]
Properly rebuild optimization data when it changes (#56397)

The timestamp of the merged .mibc file was set to when the tool was
invoked, while the inputs have a timestamp from when they were created
in the training scenarios. That means the target to create the merged
.mibc file would not run incrementally until many weeks later.

To fix add an --inherit-timestamp flag to dotnet-pgo that makes the
merged output inherit the max timestamp from the inputs. This is not
ideal as it means incrementally going backwards does not work, but it's
better than the previous behavior.

Fix #53637

2 years agoMake open function calls in coreclr EINTR resilient on macOS (#56403)
Jan Vorlicek [Wed, 28 Jul 2021 08:23:38 +0000 (10:23 +0200)]
Make open function calls in coreclr EINTR resilient on macOS (#56403)

It was reported that on macOS, the open syscall can sometimes
return EINTR if it is interrupted by a signal even if the
signal has a handler installed with SA_RESTART.

There was just one call to open in the coreclr that
didn't have EINTR handled and that can be called on macOS, so
this change fixes it.

There are two places in the libraries in the included 3rd party
code - the brotli and the zlib - that don't have this treatment yet.
We may want to update them unless the policy we have for them is
to make changes upstream.

2 years agoFix dependency from EventLog to TraceSource ref (#56417)
Viktor Hofer [Wed, 28 Jul 2021 08:12:18 +0000 (10:12 +0200)]
Fix dependency from EventLog to TraceSource ref (#56417)

* Fix dependency from EventLog to TraceSource ref

This regressed with https://github.com/dotnet/runtime/commit/663c40dbc4ccedf82e38e96391c28695da0e418f. Reference projects should never reference source projects. This is one of the reasons why slngen creates different solution files now.

* Update Microsoft.Extensions.DependencyInjection.Abstractions.csproj

2 years agoFix comments in asm with JitDiffableDasm=1 (#56416)
Egor Bogatov [Wed, 28 Jul 2021 05:49:10 +0000 (08:49 +0300)]
Fix comments in asm with JitDiffableDasm=1 (#56416)

* Avoid asserts in DasmDiffable mode

* simplify

* Make formatter happier

* Address feedback

2 years agoCatch TcpClient ctor exceptions in FtpWebRequest.CreateConnectionAsync (#56379)
Stephen Toub [Wed, 28 Jul 2021 01:50:15 +0000 (21:50 -0400)]
Catch TcpClient ctor exceptions in FtpWebRequest.CreateConnectionAsync (#56379)

2 years agoAdd interop between serializer and DOMs (#56112)
Steve Harter [Wed, 28 Jul 2021 01:35:54 +0000 (20:35 -0500)]
Add interop between serializer and DOMs (#56112)

2 years agoFix type loader not recognizing overridden method (#56337)
David Wrighton [Tue, 27 Jul 2021 23:41:19 +0000 (16:41 -0700)]
Fix type loader not recognizing overridden method (#56337)

* Fix type loader not recognizing overridden method
- Result of a bad change when removing support for full stub dispatch in .NET 4.0 timeframe (circa 2008)
- Caused issue when the following set of conditions were all true
  - The type implements an interface
  - The interface has more virtual methods on it than the number of virtual methods on the base type of the type.
  - The base type implements the interface partially (and the partial implementation has a slot number greater than the number of virtual methods on the base type + its base types)
  - The type does not re-implement the interface methods implemented by the base type.
- The comment referred to situations where stub dispatch was used to resolve non-virtual calls which is a very long time removed feature and is not applicable to today's codebase.
- Not reachable with versions of C# that shipped before the default interfaces feature, but with that feature became easily reachable. Has been a bug since .NET 4 for handwritten IL.

Fixes #44533

2 years agoPrevent Segfault in EventPipe on disable (#56104)
John Salem [Tue, 27 Jul 2021 22:55:00 +0000 (15:55 -0700)]
Prevent Segfault in EventPipe on disable (#56104)

2 years agoUpdate runtimeconfig.json and deps.json paths when these break past the MAX_PATH...
Mateo Torres-Ruiz [Tue, 27 Jul 2021 22:24:16 +0000 (15:24 -0700)]
Update runtimeconfig.json and deps.json paths when these break past the MAX_PATH threshold  (#56224)

* Update runtimeconfig paths if we exceed MAX_PATH

* Add test

* PR feedback

* Get apphost for all platforms

* Probe bundle first
Fix return value of realpath

* Check for empty path upfront

2 years agoUse native allocator instead of pinning when decompressing embedded PDB (#56336)
Tomáš Matoušek [Tue, 27 Jul 2021 22:16:59 +0000 (15:16 -0700)]
Use native allocator instead of pinning when decompressing embedded PDB (#56336)

2 years agoSpecify win-x64 as a valid platform in the microsoft-net-runtime-* workloads for...
Steve Pfister [Tue, 27 Jul 2021 21:49:17 +0000 (17:49 -0400)]
Specify win-x64 as a valid platform in the microsoft-net-runtime-* workloads for iOS/tvOS/MacCatalyst (#56311)

In a prior change, win-x64 was specified for runtimes-*, but it is also needed in the other workloads

2 years agoFix FailFast message formatting race (#56388)
Jan Vorlicek [Tue, 27 Jul 2021 21:40:28 +0000 (23:40 +0200)]
Fix FailFast message formatting race (#56388)

* Fix FailFast message formatting race

SystemNative::GenericFailFast uses a global buffer for messages shorter than certain size.
When multiple threads call FailFast at the same time, they all use the same buffer,
overwriting each other's message. That leads to a problem on Unix when the message is
converted to UTF-8 using two calls to WideCharToMultiByte and another thread changes
the message to a longer one between those two calls. So the buffer size the first
call determines is no longer sufficient.

2 years agoTry to fix finalizer-based async tests (#56384)
Stephen Toub [Tue, 27 Jul 2021 21:17:03 +0000 (17:17 -0400)]
Try to fix finalizer-based async tests (#56384)

A dump from a failure showed the finalizable object we're relying on was unrooted and waiting for finalization.  Issue more Collects to see if that helps.

2 years agoFix MetricsEventSource tests (#56382)
Noah Falk [Tue, 27 Jul 2021 20:41:54 +0000 (13:41 -0700)]
Fix MetricsEventSource tests (#56382)

Last week I added a change to the error handling behavior when MetricEventSource
is enabled by multiple listeners and didn't properly update the tests.
1. The major issue was timout failures which were being caused because there is
a bug in EventListener where it doesn't notify EventSources that the source has
been disabled when the listener is disposed. This in turn caused every tests after
the first to reject the new EventListener because the EventSource believed it was
still in use by the first EventListener.
(EventListener bug is tracked https://github.com/dotnet/runtime/issues/56378)
2. A secondary issue is that I didn't update the test which was explicitly verifying
the behavior where the EventSource emits an error in response to having two
listeners and I had changed the product behavior there.

Fixes:
1. I worked around the EventListener bug by explicitly calling DisableEvents().
I also updated OnEventWritten to log the MultipleSessionsNotSupportedError
so that any future error that is similar has more obvious diagnostic logging.
2. I updated the test with new expectation that the 1st listener continues normal
operation and the 2nd listener is the one that gets rejected.

I also did a little refactoring and added a 2nd tests of multiple listeners to confirm
it works if the first one is disabled before the 2nd one starts.

2 years agoRemove invalid Castle.DynamicProxy.Internal.AbstractInvocation from ILLink descriptor...
Alexander Köplinger [Tue, 27 Jul 2021 20:06:31 +0000 (22:06 +0200)]
Remove invalid Castle.DynamicProxy.Internal.AbstractInvocation from ILLink descriptor files (#56392)

The type is actually in the `Castle.DynamicProxy` namespace, not the `.Internal` one.
This causes an error with newer linker versions.

The whole `Castle.DynamicProxy` namespace is already preserved so we can remove the entry for AbstractInvocation.

2 years ago[libraries][iOS][tvOS][MacCatalyst] Remove ActiveIssue from no longer… (#56401)
Mitchell Hwang [Tue, 27 Jul 2021 19:37:04 +0000 (15:37 -0400)]
[libraries][iOS][tvOS][MacCatalyst] Remove ActiveIssue from no longer… (#56401)

* [libraries][iOS][tvOS][MacCatalyst] Remove ActiveIssue from no longer failing Microsoft.Extensions.Hosting.Unit.Tests

* Remove StopAsyncWithCancellation Active Issue as well

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoRemove ActiveIssues from tests no longer failing (#56393)
Mitchell Hwang [Tue, 27 Jul 2021 19:04:37 +0000 (15:04 -0400)]
Remove ActiveIssues from tests no longer failing (#56393)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoHave HttpClientHandler throw the InnerException when catching TargetInvocationExcepti...
Steve Pfister [Tue, 27 Jul 2021 18:40:15 +0000 (14:40 -0400)]
Have HttpClientHandler throw the InnerException when catching TargetInvocationException (#56334)

Originally on mobile workloads when UseNativeHttpHandler is set to true, all reflection method invokes
bubbled up a TargetInvocationException.  To make the details a bit more readable, we will instead rethrow
the InnerException.

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

2 years agoSurface exceptions thrown by LoopbackSocksServer (#56396)
Miha Zupan [Tue, 27 Jul 2021 18:39:44 +0000 (11:39 -0700)]
Surface exceptions thrown by LoopbackSocksServer (#56396)

2 years agofix ByteArrayConverter null handling inconsistencies. (#56390)
Eirik Tsarpalis [Tue, 27 Jul 2021 18:10:54 +0000 (21:10 +0300)]
fix ByteArrayConverter null handling inconsistencies. (#56390)

Fixes #49728.

2 years agoAdd tests for reads and writes beyond EOF (#56395)
Adam Sitnik [Tue, 27 Jul 2021 18:07:49 +0000 (20:07 +0200)]
Add tests for reads and writes beyond EOF (#56395)

* ensure that reads beyond EOF return 0

* ensure that writes beyond EOF extend the file and the content is zeroed

2 years agoJIT: more fixes for VN loop dependence tracking (#56184)
Andy Ayers [Tue, 27 Jul 2021 17:53:44 +0000 (10:53 -0700)]
JIT: more fixes for VN loop dependence tracking (#56184)

Specify `Overwrite` when setting loop dependence map entries, as we may
refine the initial result.

Fixes #56174.

Extract loop dependence of `VNF_PhiMemoryDef`.

Fixes new case noted in #55936, and 13/16 or so other cases Jakob sent
me privately. Also update a comment and fix tests to work better with
jitstress per other notes on that PR.

2 years agoFix thread pool hang (#56346)
Koundinya Veluri [Tue, 27 Jul 2021 16:59:14 +0000 (09:59 -0700)]
Fix thread pool hang (#56346)

* Fix thread pool hang

- In https://github.com/dotnet/runtime/pull/53471 the thread count goal was moved out of `ThreadCounts`, it turns out that are a few subtle races that it was avoiding. There are other ways to fix it, but I've added the goal back into `ThreadCounts` for now.
- Reverted PR https://github.com/dotnet/runtime/pull/55985, which worked around the issue in the CI

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

* Revert "mitigation for quic tests hangs (#55985)"

This reverts commit 0a5e93b09fe92cf866456552eef78a95bf6fdf27.

2 years agoUpdate CG2 ArgIterator to match the runtime one (#56059)
Jan Vorlicek [Tue, 27 Jul 2021 16:51:28 +0000 (18:51 +0200)]
Update CG2 ArgIterator to match the runtime one (#56059)

* Update CG2 ArgIterator to match the runtime one

The goal of the change is primarily to make it correct for the Apple
Silicon where the calling convention slightly differs from the
Unix ARM64 one, especially in passing arguments smaller than a pointer
size on stack.

2 years agoavoid ReadFile syscall if we know that there is nothing to read from file (#56387)
Adam Sitnik [Tue, 27 Jul 2021 16:13:38 +0000 (18:13 +0200)]
avoid ReadFile syscall if we know that there is nothing to read from file (#56387)

* avoid ReadFile syscall if we know that there is nothing to read from file

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoserialize the access to mutable shared state in System.IO.Packaging (#56367)
Adam Sitnik [Tue, 27 Jul 2021 16:10:34 +0000 (18:10 +0200)]
serialize the access to mutable shared state in System.IO.Packaging (#56367)

2 years agoSpecify RunContinuationsAsynchronously in DNS telemetry test (#56368)
Miha Zupan [Tue, 27 Jul 2021 13:31:34 +0000 (06:31 -0700)]
Specify RunContinuationsAsynchronously in DNS telemetry test (#56368)

2 years agoFix Invariant Test Configuration (#56340)
Tarek Mahmoud Sayed [Tue, 27 Jul 2021 13:07:43 +0000 (06:07 -0700)]
Fix Invariant Test Configuration (#56340)

2 years agopull in new version of msquic (#56344)
Tomas Weinfurt [Tue, 27 Jul 2021 13:07:25 +0000 (06:07 -0700)]
pull in new version of msquic (#56344)

2 years agofix CloseAsync_ByServer_AcceptThrows quic test (#56355)
Tomas Weinfurt [Tue, 27 Jul 2021 13:06:42 +0000 (06:06 -0700)]
fix CloseAsync_ByServer_AcceptThrows quic test (#56355)

2 years agoSkip finalizer test if precise GC is not supported (#56364)
Ulrich Weigand [Tue, 27 Jul 2021 13:05:21 +0000 (15:05 +0200)]
Skip finalizer test if precise GC is not supported (#56364)

* Finalizer_OperationNotCompleted_CompletesOperation assumes precise GC

2 years agoDisable tests requiring large contiguous memory allocation on 32-bit platforms (...
Jakob Botsch Nielsen [Tue, 27 Jul 2021 12:43:08 +0000 (14:43 +0200)]
Disable tests requiring large contiguous memory allocation on 32-bit platforms (#56366)

Fix #56197

2 years agoTighten up some ArrayPool.Return usage (#56229)
Stephen Toub [Tue, 27 Jul 2021 11:40:36 +0000 (07:40 -0400)]
Tighten up some ArrayPool.Return usage (#56229)

Avoid potential problems if Return were to throw an exception after having already put the array back into the pool.

2 years agoDisable test SendAsync_WithZeroLengthHeaderName_Throws (#56363)
Karel Zikmund [Tue, 27 Jul 2021 10:55:54 +0000 (12:55 +0200)]
Disable test SendAsync_WithZeroLengthHeaderName_Throws (#56363)

Test: System.Net.Http.Functional.Tests.SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3_MsQuic.SendAsync_WithZeroLengthHeaderName_Throws

Disabled test tracked by #56292

2 years agoUpdate compiler version to enable CallerArgumentExpression (#56349)
Stephen Toub [Tue, 27 Jul 2021 10:40:25 +0000 (06:40 -0400)]
Update compiler version to enable CallerArgumentExpression (#56349)

2 years agoHonor ThrowOnEventWriteErrors for exceptions thrown by EventListeners (#56232)
Miha Zupan [Tue, 27 Jul 2021 09:28:10 +0000 (02:28 -0700)]
Honor ThrowOnEventWriteErrors for exceptions thrown by EventListeners (#56232)

2 years agoAdd timeouts to IPInterfaceProperties tests (#56319)
Miha Zupan [Tue, 27 Jul 2021 09:26:42 +0000 (02:26 -0700)]
Add timeouts to IPInterfaceProperties tests (#56319)

* Add timeouts to IPInterfaceProperties tests

* Use common Timeout value and Xunit output helper

* Add Threading.Tasks using

2 years agoDisplay class names and string literals in asm (#55970)
Egor Bogatov [Tue, 27 Jul 2021 09:02:22 +0000 (12:02 +0300)]
Display class names and string literals in asm (#55970)

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
2 years agoFix an assert in emitOffsetToLabel (#56278)
Egor Bogatov [Tue, 27 Jul 2021 09:01:26 +0000 (12:01 +0300)]
Fix an assert in emitOffsetToLabel (#56278)

2 years agoSkip environment variable access calls for non OSX apple platforms (#56320)
Mitchell Hwang [Tue, 27 Jul 2021 06:36:43 +0000 (02:36 -0400)]
Skip environment variable access calls for non OSX apple platforms (#56320)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoGlobally disable implicit namespaces (#56348)
Santiago Fernandez Madero [Tue, 27 Jul 2021 06:22:08 +0000 (23:22 -0700)]
Globally disable implicit namespaces (#56348)

2 years agoFix ReliabilityFramework code formatting (#56342)
Andrew Au [Tue, 27 Jul 2021 06:17:54 +0000 (23:17 -0700)]
Fix ReliabilityFramework code formatting (#56342)

2 years agoFix an error printed out when install_location file is missing (#56327)
Vitek Karas [Tue, 27 Jul 2021 04:43:17 +0000 (06:43 +0200)]
Fix an error printed out when install_location file is missing (#56327)

The app will still run, but we must not print out anything in that case.

Fixes #56219

2 years agoUpdate SR.cs (#56332)
Chris Ross [Tue, 27 Jul 2021 02:56:13 +0000 (19:56 -0700)]
Update SR.cs (#56332)