platform/upstream/dotnet/runtime.git
2 years ago[MonoAOTCompiler] accept more than one AotProfilePath (#57111)
Jonathan Peppers [Wed, 11 Aug 2021 14:56:12 +0000 (09:56 -0500)]
[MonoAOTCompiler] accept more than one AotProfilePath (#57111)

* [MonoAOTCompiler] accept more than one AotProfilePath

Fixes part of: https://github.com/dotnet/runtime/issues/56989

The Android workload needs to be able to pass in multiple AOT profiles
to the `<MonoAOTCompiler/>` MSBuild task. We plan on shipping a
default profile in the Android workload, as well as the MAUI workload.
.NET MAUI would have two profiles when using profiled AOT.

Adding `profile-only`, and then multiple `profile` arguments is
currently working in legacy Xamarin.Android:

https://github.com/xamarin/xamarin-android/blob/77895e2a03ed91fdf3729cde54501f91e7d1a36f/src/Xamarin.Android.Build.Tasks/Tasks/GetAotArguments.cs#L256-L260

Either a single property or item group can be passed in for
`AotProfilePath` now. I avoided changing the name, as it looks like it
might be used by wasm.

* Update src/tasks/AotCompilerTask/MonoAOTCompiler.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoImprove docs for BinaryData.ToString() (#56325)
JoshLove-msft [Wed, 11 Aug 2021 14:23:01 +0000 (07:23 -0700)]
Improve docs for BinaryData.ToString() (#56325)

* Improve docs for BinaryData.ToString()

* Apply suggestions from code review

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
2 years agoMake sure rid specific libs projs get packaged (#57193)
Viktor Hofer [Wed, 11 Aug 2021 10:50:46 +0000 (12:50 +0200)]
Make sure rid specific libs projs get packaged (#57193)

* Make sure rid specific libs projs get packaged

RID specific runtime.*.runtime.native.System.IO.Ports projects weren't
packaged because the GeneratePackageOnBuild property wasn't set to true
for them. The property was only true during an allconfigurations build.
As these projects are only built outside of an allconfigurations build,
the GeneratePackageOnBuild property needs to account for such as well.

Also updating the NoTargets Sdk to clean the rid specific package up.

Moving the GeneratePackageOnBuild logic into a props file and set it to
false during servicing (or runtimelab) so that devs can set the property
during servicing directly in the project file if a project should be
packaged.

* Remove the GeneratePackage property

That property was intended to enabled incremental servicing but with
now using the NuGet Pack task we can just make use of the publicl
available GeneratePackageOnBuild property.

* Fix IsPackable setting

2 years agoFix regression in dictionary key serialization when registering custom primitive...
Eirik Tsarpalis [Wed, 11 Aug 2021 08:42:33 +0000 (11:42 +0300)]
Fix regression in dictionary key serialization when registering custom primitive converters. (#57138)

* Fixes regression in dictionary key serialization when registering custom primitive converters.

* reinstate debug assertion

* add test case for JsonTypeInfo overloads

* update method names

* fix sourcegen test

2 years ago[interp] Add wrapper for calli to native pointer (#57119)
Vlad Brezae [Wed, 11 Aug 2021 08:40:47 +0000 (11:40 +0300)]
[interp] Add wrapper for calli to native pointer (#57119)

If the signature has suppress gc transition attribute, we don't emit the wrapper and call native code directly.

2 years agoAnnotate unsupported APIs in System.Diagnostics.Process (#57120)
Adam Sitnik [Wed, 11 Aug 2021 08:01:26 +0000 (10:01 +0200)]
Annotate unsupported APIs in System.Diagnostics.Process (#57120)

2 years ago[MacCatalyst][libraries] Update MacCatalyst as Case Preserving for tests (#57167)
Mitchell Hwang [Wed, 11 Aug 2021 07:38:58 +0000 (03:38 -0400)]
[MacCatalyst][libraries] Update MacCatalyst as Case Preserving for tests (#57167)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoCallconv matching in PassingBy{Out,Ref}Test (#57075)
t-mustafin [Wed, 11 Aug 2021 05:43:31 +0000 (08:43 +0300)]
Callconv matching in PassingBy{Out,Ref}Test (#57075)

Signed-off-by: Timur Mustafin <t.mustafin@partner.samsung.com>
2 years agoSupport NoGC for regions (#54085)
Andrew Au [Wed, 11 Aug 2021 05:15:44 +0000 (22:15 -0700)]
Support NoGC for regions (#54085)

2 years agoadd timeout handling to QuicStream (#56060)
Tomas Weinfurt [Wed, 11 Aug 2021 04:09:47 +0000 (21:09 -0700)]
add timeout handling to QuicStream (#56060)

* add timeout handling to QuicStream

* feedback from review

* fix bad resolve

* feedback from review

2 years agoFix perms on diagnostic files (#57177)
Juan Hoyos [Wed, 11 Aug 2021 02:40:09 +0000 (19:40 -0700)]
Fix perms on diagnostic files (#57177)

2 years agoOptimize string.join for IList<string> with char separator (#56857)
John Call [Wed, 11 Aug 2021 02:15:18 +0000 (19:15 -0700)]
Optimize string.join for IList<string> with char separator (#56857)

* Improve string join for char separator

* Feedback

2 years agoRefactor ManagedWebSocket to avoid forcing Task allocations for ReceiveAsync (#56282)
Stephen Toub [Wed, 11 Aug 2021 02:14:13 +0000 (22:14 -0400)]
Refactor ManagedWebSocket to avoid forcing Task allocations for ReceiveAsync (#56282)

* Refactor ManagedWebSocket to avoid forcing Task allocations for ReceiveAsync

The ManagedWebSocket implementation today supports CloseAsyncs being issued concurrently with ReceiveAsyncs, even though CloseAsync needs to issue receives (this allowance was carried over from the .NET Framework implementation).  Currently the implementation does that by storing the last ReceiveAsync task and awaiting it in CloseAsync if there is one, but that means multiple parties may try to await the same task multiple times (the original caller of ReceiveAsync and CloseAsync), which means we can't just use a ValueTask.  So today asynchronously completing ReceiveAsyncs always use AsTask to create a Task from the returned ValueTask.  This isn't actually an additional task allocation today, as the async ValueTask builder will create a Task for the asynchronously completing operation, and then AsTask will just return that (and when it completes synchronously, there's extra code to substitute a singleton).  But once we switch to using the new pooling builder, that's no longer the case.

This PR uses an async lock as part of the ReceiveAsync implementation, with the existing async method awaiting entering that lock.  CloseAsync is then rewritten to be in terms of calling ReceiveAsync in a loop.  This also lets us remove the existing Monitor used for synchronously coordinating state between these operations, as the async lock serves that purpose as well.  Rather than using a SemaphoreSlim, since we expect zero contention in the common case, we use a simple AsyncMutex that's optimized for the zero contention case, using a single interlocked to acquire and a single interlocked to release the lock.

* Fix misleading comment

2 years agoFix wrong line info when debugging CoreLib in windbg (#57176)
Mike McLaughlin [Wed, 11 Aug 2021 01:47:23 +0000 (18:47 -0700)]
Fix wrong line info when debugging CoreLib in windbg (#57176)

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

Changed couple of the DAC functions used to use the code version manager to
get the properly native code start address.

2 years agoPhysicalFileProvider: Remove second try on GetFileLinkTargetLastWriteTimeUtc (#57136)
Adam Sitnik [Wed, 11 Aug 2021 01:22:15 +0000 (03:22 +0200)]
PhysicalFileProvider: Remove second try on GetFileLinkTargetLastWriteTimeUtc  (#57136)

* return the value from 2nd try

* Do not attempt a second try and just capture the FileNotFoundException

* Update src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Internal/FileSystemInfoHelper.cs

Co-authored-by: David Cantu <dacantu@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
2 years agoDisable 2 memory heavy array tests for 2 distros (#57108)
Dan Moseley [Wed, 11 Aug 2021 00:02:11 +0000 (18:02 -0600)]
Disable 2 memory heavy array tests for 2 distros (#57108)

* Disable 2 Array tests on 2 distros

* Update string

2 years agoClean up JSON src-gen known-type resolution (#57092)
Layomi Akinrinade [Tue, 10 Aug 2021 23:44:47 +0000 (16:44 -0700)]
Clean up JSON src-gen known-type resolution (#57092)

2 years agoUnblock publishing symbols with exclusion file. (#57162)
Juan Hoyos [Tue, 10 Aug 2021 23:38:49 +0000 (16:38 -0700)]
Unblock publishing symbols with exclusion file. (#57162)

2 years agoAvoid dereferencing target pointer (#57164)
Andrew Au [Tue, 10 Aug 2021 22:41:38 +0000 (15:41 -0700)]
Avoid dereferencing target pointer (#57164)

2 years agoPass runtime flavor args when copying native test components in CI (#57073)
Elinor Fung [Tue, 10 Aug 2021 21:58:55 +0000 (14:58 -0700)]
Pass runtime flavor args when copying native test components in CI (#57073)

* Pass runtime flavor args when copying native test components in CI
* Make test build script pass RuntimeFlavor property

2 years agoAdd runtime capability to allow updating parameters (#56599)
David Wengier [Tue, 10 Aug 2021 21:20:03 +0000 (07:20 +1000)]
Add runtime capability to allow updating parameters (#56599)

2 years agoUpdate helix version (#57084)
Kunal Pathak [Tue, 10 Aug 2021 21:15:28 +0000 (14:15 -0700)]
Update helix version (#57084)

2 years agoGet better assert failure in flaky FlushAsync_ThrowsIfWriterReaderWithException test...
Stephen Halter [Tue, 10 Aug 2021 21:03:33 +0000 (14:03 -0700)]
Get better assert failure in flaky FlushAsync_ThrowsIfWriterReaderWithException test (#57081)

2 years agoUpdate dependencies from https://github.com/mono/linker build 20210809.3 (#57124)
dotnet-maestro[bot] [Tue, 10 Aug 2021 20:57:33 +0000 (15:57 -0500)]
Update dependencies from https://github.com/mono/linker build 20210809.3 (#57124)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21405.1 -> To Version 6.0.100-preview.6.21409.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoSwitch to using globalconfig instead of ruleset for analyzer configuration (#57144)
Stephen Toub [Tue, 10 Aug 2021 20:15:57 +0000 (16:15 -0400)]
Switch to using globalconfig instead of ruleset for analyzer configuration (#57144)

2 years agoFix COM test failures on Windows Nano Server (#57148)
Jeremy Koritzinsky [Tue, 10 Aug 2021 19:28:59 +0000 (14:28 -0500)]
Fix COM test failures on Windows Nano Server (#57148)

* Disable ComWrappers activation tests when running on Windows Nano Server since they require reg-free COM.

* Run the test on a separate STA thread so we can get far enough in Main to detect running on nano server before we use the STA.

2 years agoDelete dead System.Net.Connections code (#57129)
Stephen Toub [Tue, 10 Aug 2021 19:11:53 +0000 (15:11 -0400)]
Delete dead System.Net.Connections code (#57129)

This never shipped, and won't in .NET 6.  If we decide to bring it back for a future release, it'll involve changes, and we can get whatever base code we want to start with from git history.  We don't need all of this to end up in an LTS branch.

2 years agoPrevent invoking property 'init' accessor from Visual Basic late binder (#57025)
Charles Stoner [Tue, 10 Aug 2021 18:46:00 +0000 (11:46 -0700)]
Prevent invoking property 'init' accessor from Visual Basic late binder (#57025)

2 years agoJIT: fix gc type for PUTARG_SPLIT codegen (#57099)
Andy Ayers [Tue, 10 Aug 2021 18:41:13 +0000 (11:41 -0700)]
JIT: fix gc type for PUTARG_SPLIT codegen (#57099)

If we need to swap registers during codegen for PUTARG_SPLIT, make sure
we use the right GC type.

Fixes #13127.

2 years agoUpdate the runtime code where iOS/MacCatalyst logic is currently used to benefit...
Buyaa Namnan [Tue, 10 Aug 2021 18:21:40 +0000 (11:21 -0700)]
Update the runtime code where iOS/MacCatalyst logic is currently used to benefit from the updated analyzer behavior (#57072)

* Update the runtime code where iOS/MacCatalyst logic is currently used to benefit from the updated analyzer behavior

2 years agoDon't log an error when a BackgroundService is canceled due to the host being stopped...
Eric Erhardt [Tue, 10 Aug 2021 15:18:28 +0000 (10:18 -0500)]
Don't log an error when a BackgroundService is canceled due to the host being stopped. (#57005)

* Don't log an error when a BackgroundService is canceled due to the host being stopped.

Fix #56032

* Add volatile to stopping field.

* Convert HostTests to use a logger instead of depending on EventSource.

* Make it obvious the test is using the default worker template

2 years agoCheck `EventSource.IsSupported` in code paths specific to thread pool worker tracking...
Koundinya Veluri [Tue, 10 Aug 2021 14:55:03 +0000 (07:55 -0700)]
Check `EventSource.IsSupported` in code paths specific to thread pool worker tracking (#56862)

Check `EventSource.IsSupported` in code paths specific to thread pool worker tracking

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

2 years agogeneric math: Don't include System.Runtime reference assembly when publishing (#57071)
Aleksey Kliger (λgeek) [Tue, 10 Aug 2021 14:51:14 +0000 (10:51 -0400)]
generic math: Don't include System.Runtime reference assembly when publishing (#57071)

System.Runtime.Experimental.csproj builds a reference assembly called System.Runtime.dll that should be used when compiling, but should not be included when packaging. For normal out of tree projects this happens because the System.Runtime.Experimental.nupkg makes it evident that <PackageReference Include="System.RuntimeExperimental" /> only provides reference assembly assets. But in-tree for <ProjectReference> we have to be explicit.

Fixes https://github.com/dotnet/runtime/issues/55823
Fixes https://github.com/dotnet/runtime/issues/55767
Fixes https://github.com/dotnet/runtime/issues/56836

2 years agoHandle FileNotFound for symlinks when using polling (#56915)
David Cantú [Tue, 10 Aug 2021 14:37:24 +0000 (07:37 -0700)]
Handle FileNotFound for symlinks when using polling (#56915)

* Handle FileNotFound for symlinks when using polling

* Re-enable tests

* Use CTS instead of Task.Wait(TimeSpan) to fix issues in browser.

2 years ago[libraries][iOS][tvOS] Reenable System.Resource.ResourceManager and System.Collection...
Mitchell Hwang [Tue, 10 Aug 2021 14:21:44 +0000 (10:21 -0400)]
[libraries][iOS][tvOS] Reenable System.Resource.ResourceManager and System.Collections.Immutable tests (#56994)

* [libraries][iOS][tvOS] Reenable System.Resorce.ResourceManager.Tests tests

* [libraries][iOS][tvOS] Remove ActiveIssue from test with no test data

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoFix ServiceController test (#57116)
Dan Moseley [Tue, 10 Aug 2021 13:47:40 +0000 (07:47 -0600)]
Fix ServiceController test (#57116)

2 years agoDisable GetBitLengthLarge for 32 bit due to OOM (#57110)
Dan Moseley [Tue, 10 Aug 2021 13:18:37 +0000 (07:18 -0600)]
Disable GetBitLengthLarge for 32 bit due to OOM (#57110)

2 years agoFix analyzer, docs file packaging and don't overbuild runtime.native IO.Ports package...
Viktor Hofer [Tue, 10 Aug 2021 12:38:45 +0000 (14:38 +0200)]
Fix analyzer, docs file packaging and don't overbuild runtime.native IO.Ports packages. (#57118)

* Fix analyzer and docs file packaging

This commit fixes analyzers which were dropped from the package during
the clean-up of pkgprojs and missing documentation files.

1. Analyzers were dropped from the package because the BeforePack
   hook wasn't respected. This happens when the NuGet Pack nuget package
   is referenced which then gets imported before the packaging.targets
   file. The BeforePack property needs to be set in a props file if
   NuGet's targets file isn't used from the SDK but from its package.
2. Documentation files were dropped as the
   DefaultAllowedOutputExtensionsInPackageBuildOutputFolder property
   didn't include the .xml extension.

* Don't overbuild runtime native IO packages

2 years agoRe-add S.T.J.SourceGeneration.UnitTests to STJ sln (#57080)
Layomi Akinrinade [Tue, 10 Aug 2021 11:15:55 +0000 (04:15 -0700)]
Re-add S.T.J.SourceGeneration.UnitTests to STJ sln (#57080)

* Re-add S.T.J.SourceGeneration.UnitTests to STJ sln

* Update slngen.template.proj

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2 years agoApply redundant branch optimizations in post-order of dominators (#57074)
Jakob Botsch Nielsen [Tue, 10 Aug 2021 09:48:28 +0000 (11:48 +0200)]
Apply redundant branch optimizations in post-order of dominators (#57074)

In #56979 we end up with outdated dominators and make a wrong decision
based on it. To avoid this situation, visit basic blocks in post-order
of the dominator tree to ensure that we have up-to-date dominators for
each basic block.

Fix #56979

2 years agoFix performance for `File.GetLastWriteTimeUtc` on Unix (#53070)
David Karlaš [Tue, 10 Aug 2021 08:12:13 +0000 (10:12 +0200)]
Fix performance for `File.GetLastWriteTimeUtc` on Unix (#53070)

All this changes are to internal methods which are later called by other public methods which correctly call `ToLocalTime` for local time "overloads".
Performance hit is most visible for application which doesn't need to load local timezone information which takes ~30ms on 2016 MacBook Pro.

Co-authored-by: Jeff Handley <jeff.handley@microsoft.com>
2 years agoFix ThreadLocal tracking behavior (#56956)
David Wrighton [Tue, 10 Aug 2021 08:04:09 +0000 (01:04 -0700)]
Fix ThreadLocal tracking behavior (#56956)

- Before this change the trackAllValues behavior for ThreadLocal<SomeParticularType> was defined by the first instance of thread local to have its value set on the thread
  - This could lead to unpredictable memory leaks (where the value was improperly tracked even though it wasn't supposed to be) This reproduces as a memory leak with no other observable behavior
  - Or data loss, where the Values collection was missing entries.
- Change the model so that ThreadLocal<T> trackAllValues behavior is properly defined by the exact ThreadLocal<T> instance in use
- Implement by keeping track of the track all changes behavior within the IdManager

Fixes #55796

2 years agoAutomatically generate .NETStandard compat errors (#57057)
Viktor Hofer [Tue, 10 Aug 2021 05:19:06 +0000 (07:19 +0200)]
Automatically generate .NETStandard compat errors (#57057)

* Automatically generate .NETStandard compat errors

Before this change, a project had to explicitly add a
NETStandardCompatError item to declare that a given tfm range
shouldn't be supported when packaging.

Automate this logic so that projects don't need to specify the item
themselves anymore. Instead condition the NETStandardCompatError target
calcuation logic on the existence of both a .NETStandard and a
.NETCoreApp tfm.

* Update Directory.Build.targets

* Update packaging.targets

* Update eng/packaging.targets

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
2 years agoadd more validation to quic config (#56923)
Tomas Weinfurt [Tue, 10 Aug 2021 04:38:20 +0000 (21:38 -0700)]
add more validation to quic config (#56923)

2 years agoFix half bug (#57047)
Dan Moseley [Tue, 10 Aug 2021 02:14:45 +0000 (20:14 -0600)]
Fix half bug (#57047)

* Fix half bug

* parens

2 years agoRemove unused System.Reflection.Emit leftovers (#57069)
Jan Kotas [Tue, 10 Aug 2021 01:19:55 +0000 (03:19 +0200)]
Remove unused System.Reflection.Emit leftovers (#57069)

2 years agoDelete old AssemblyExtensions.ApplyUpdate/GetApplyUpdateCapabilities (#56511)
Stephen Toub [Tue, 10 Aug 2021 00:49:34 +0000 (20:49 -0400)]
Delete old AssemblyExtensions.ApplyUpdate/GetApplyUpdateCapabilities (#56511)

* Delete old AssemblyExtensions.ApplyUpdate/GetApplyUpdateCapabilities

* Fix a few missed uses in mono tests

2 years agoFix typo in CreateDefaultPropagator doc comment (#57103)
Sourabh Shirhatti [Tue, 10 Aug 2021 00:19:43 +0000 (17:19 -0700)]
Fix typo in CreateDefaultPropagator doc comment (#57103)

2 years agoImprove GUI error dialog when no runtime is installed (#57089)
Mateo Torres-Ruiz [Tue, 10 Aug 2021 00:11:56 +0000 (17:11 -0700)]
Improve GUI error dialog when no runtime is installed (#57089)

* Add architecture and runtime version to error dialog

* PR feedback

2 years agoClean up ComWrappers tests (#57015)
Elinor Fung [Mon, 9 Aug 2021 23:53:46 +0000 (16:53 -0700)]
Clean up ComWrappers tests (#57015)

* Remove unnecessary defines

* Clean up managed ComWrappers tests

2 years agoWorkaround exception filter linker issues with Http3RequestStream (#57011)
Steve Pfister [Mon, 9 Aug 2021 23:22:38 +0000 (19:22 -0400)]
Workaround exception filter linker issues with Http3RequestStream (#57011)

The type of exception filters used cause the linker to generate invalid IL when building the AOT functional tests for iOS. This in turn causes the mono aot compiler to issue a warning about the invalid IL AND fails the build.

Addresses #57010 and unblocks failing builds on CI

2 years agoFix auto-atomicity for loops around required one/notone/set loops (#56735)
Stephen Toub [Mon, 9 Aug 2021 23:16:46 +0000 (19:16 -0400)]
Fix auto-atomicity for loops around required one/notone/set loops (#56735)

Given an expression like `(?:a{2,3}){2}`, we currently erroneously convert that to `(?>a{2,3}){2}`, i.e. making the inner loop atomic, even though that then causes this to fail to match `aaaa` when it should match it (it fails because the first iteration will atomically match `aaa` and thus won't given any back, and then the next iteration will fail to match at least two `a`s).

The simple fix is in FindLastExpressionInLoopForAutoAtomic, removing the special-case that tries to make the body of a loop that's a one/notone/set loop atomic.  There are likely special-cases of this special-case that are still valid, but I'm not convinced it's worth trying to maintain and risk other gaps.

2 years agoUpdate RequiresPreviewFeatures attribute (#56938)
Prashanth Govindarajan [Mon, 9 Aug 2021 22:48:40 +0000 (15:48 -0700)]
Update RequiresPreviewFeatures attribute (#56938)

* Add constructors and Message, URL properties

* Update attribute and tests

* sq

* Address feedback

* Just adding docs

2 years ago[interp] Add IL seq points (#56137)
Vlad Brezae [Mon, 9 Aug 2021 22:02:27 +0000 (01:02 +0300)]
[interp] Add IL seq points (#56137)

* [interp] Generate il seq points

Interpreter was generating only sdb seq points for implementing debugger support. Add also il seq points which are used for stack traces when debugging information is not present. We add IL seq points in locations where IL stack is empty, same as JIT.

* [interp] Use interp_prev_ins in more places

It skips over NOPs

* [tests] Disable all tests in readytorun folder on mono

We were disabling some of them all over the place. They shouldn'd be running on mono.

2 years ago[mono] Fix conversions from float to integer (#57048)
Vlad Brezae [Mon, 9 Aug 2021 22:00:57 +0000 (01:00 +0300)]
[mono] Fix conversions from float to integer (#57048)

* [interp] Fix conversions from float to integer

.un prefix is ignored for these conversions

* [mini] Fix conversions from float to integer

.un prefix is ignored for these conversions

* Re-enable test

2 years agoRecognize VS2022 with CMake (#57063)
Jeremy Koritzinsky [Mon, 9 Aug 2021 20:36:42 +0000 (15:36 -0500)]
Recognize VS2022 with CMake (#57063)

Fixes #57062

2 years agoFix building CoreCLR for x86 with the Windows 10.0.20348.0 SDK (#57067)
Jeremy Koritzinsky [Mon, 9 Aug 2021 20:36:13 +0000 (15:36 -0500)]
Fix building CoreCLR for x86 with the Windows 10.0.20348.0 SDK (#57067)

The SDK now defines CONTEXT_UNWOUND_TO_CALL in more cases, so we get a macro redefinition error. Since the SDK defines it to the same value as we do, just skip our definition if it's already defined.

2 years agoMonitorEnter test needs to handle the case of the threadpool cleaning up other thread...
David Wrighton [Mon, 9 Aug 2021 19:42:06 +0000 (12:42 -0700)]
MonitorEnter test needs to handle the case of the threadpool cleaning up other threads (#57008)

* MonitorEnter test needs to handle the case of the threadpool cleaning up other threads
- On rare gcstress test occasions there can a thread freed after allocating the 1024 threads but before the highThread is allocated

* Fix comment

2 years agoMore JSON xml updates (#57022)
Dan Moseley [Mon, 9 Aug 2021 18:58:01 +0000 (12:58 -0600)]
More JSON xml updates (#57022)

2 years agoDo not run crossgen2 under GC stress in tests (#56949)
Anton Lapounov [Mon, 9 Aug 2021 17:50:21 +0000 (10:50 -0700)]
Do not run crossgen2 under GC stress in tests (#56949)

2 years ago[libraries][Android] Remove ActiveIssue from BinaryFormetter dependent System.Collect...
Mitchell Hwang [Mon, 9 Aug 2021 17:40:45 +0000 (13:40 -0400)]
[libraries][Android] Remove ActiveIssue from BinaryFormetter dependent System.Collections test (#56985)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years ago[libraries][Android] Reenable System.Collections.Immutable Tests (#56988)
Mitchell Hwang [Mon, 9 Aug 2021 17:33:47 +0000 (13:33 -0400)]
[libraries][Android] Reenable System.Collections.Immutable Tests (#56988)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoFix missing offset in contained BITCAST for STORE_LCL_FLD (#57059)
Jakob Botsch Nielsen [Mon, 9 Aug 2021 17:20:39 +0000 (19:20 +0200)]
Fix missing offset in contained BITCAST for STORE_LCL_FLD (#57059)

2 years agoStrong name key id cleanup and pkg testing move (#57044)
Viktor Hofer [Mon, 9 Aug 2021 17:20:11 +0000 (19:20 +0200)]
Strong name key id cleanup and pkg testing move (#57044)

* Move src/libraries/pkg/test to src/libraries/testPackages

* Remove default StrongNameKeyId Open properties

2 years agoEnsure Directory.Delete works fine even if user has no ListDirectory permissions...
Adam Sitnik [Mon, 9 Aug 2021 16:56:58 +0000 (18:56 +0200)]
Ensure Directory.Delete works fine even if user has no ListDirectory permissions (#56996)

2 years agoOne more place to take care for better error handling (#56997)
Fan Yang [Mon, 9 Aug 2021 16:47:11 +0000 (12:47 -0400)]
One more place to take care for better error handling (#56997)

* One more place to take care for better error handling

* Handle null

* Rename function

2 years agoRemove salt length check from Rfc2898DeriveBytes
Kevin Jones [Mon, 9 Aug 2021 16:25:12 +0000 (12:25 -0400)]
Remove salt length check from Rfc2898DeriveBytes

Some standards/protocols want salts smaller than we permit, so we're really just getting in people's way.

2 years agoRemove unused System.Reflection.Emit leftovers (#56698)
Bar Arnon [Mon, 9 Aug 2021 15:21:38 +0000 (18:21 +0300)]
Remove unused System.Reflection.Emit leftovers (#56698)

* Remove unused System.Reflection.Emit leftovers

Follow up to #56153

* Remove nCreateISymWriterForDynamicModule

* Removes LineNumberInfo, MarkSequencePoint & GetMethodSigHelper

* Remove MarkSequencePoint from mono

* Fix GetMethodSigHelper overloads

* Match changes in mono

* Remove SequencePointList from mono

2 years agoRemove executable bit from unrelated files (#57051)
Adeel Mujahid [Mon, 9 Aug 2021 15:05:35 +0000 (18:05 +0300)]
Remove executable bit from unrelated files (#57051)

2 years ago[wasm] Skip tests for ExpectContinue HTTP header (#57058)
Pavel Savara [Mon, 9 Aug 2021 13:10:11 +0000 (15:10 +0200)]
[wasm] Skip tests for ExpectContinue HTTP header (#57058)

Skip tests for ExpectContinue HTTP header for WASM

2 years agoFix reference preservation for boxed structs (#56412)
Eirik Tsarpalis [Mon, 9 Aug 2021 12:48:36 +0000 (15:48 +0300)]
Fix reference preservation for boxed structs (#56412)

* Fix reference preservation for boxed structs.

* add null assertion for BoxedStructReferenceId when writing a new instance

2 years agoFix AccessViolation/InvalidProgramException in custom nullable converters. (#56577)
Eirik Tsarpalis [Mon, 9 Aug 2021 12:48:00 +0000 (15:48 +0300)]
Fix AccessViolation/InvalidProgramException in custom nullable converters. (#56577)

* Fix AccessViolation/InvalidProgramException in custom nullable converters.

* address feedback

* add comments to new test converters.

2 years agoOverride memory-based ReadAsync & WriteAsync for SerialStream.Unix (#56866)
Bar Arnon [Mon, 9 Aug 2021 09:13:55 +0000 (12:13 +0300)]
Override memory-based ReadAsync & WriteAsync for SerialStream.Unix (#56866)

2 years agoMove corehost.proj to corehost directory (#57036)
Adeel Mujahid [Mon, 9 Aug 2021 07:33:28 +0000 (10:33 +0300)]
Move corehost.proj to corehost directory (#57036)

* Move corehost.proj to corehost directory

* Simplify host version overriding

2 years agoFix invalid CodeDom comment generation when a new line starts with a slash (#56640)
Joseph Musser [Mon, 9 Aug 2021 03:19:06 +0000 (23:19 -0400)]
Fix invalid CodeDom comment generation when a new line starts with a slash (#56640)

* Failing tests where CodeDom creates invalid comment types

* Prevent CodeDom from creating invalid comment types

* Make C# generator impl more consistent with VB generator

* Switch attribute from ActiveIssue to SkipOnTargetFramework

* Be even more conservative about when the space is needed

* Attempt to improve readability

* Update VBCodeGenerationTests.cs

Co-authored-by: Dan Moseley <danmose@microsoft.com>
2 years agoJIT: fix morph tail call copy opt alias analysis (#57009)
Andy Ayers [Sun, 8 Aug 2021 21:48:39 +0000 (14:48 -0700)]
JIT: fix morph tail call copy opt alias analysis (#57009)

If there are non-call references to an implicit byref local, disqualify
that local from morph tail call copy optimization.

The fix is conservative in that "harmless" non-call references like field
accesses will also disqualify the opt. This can be improved on with extra
analysis in local morph.

Closes #56734.

2 years agoRemove HasWildCardCharacters method (#57028)
Ilya [Sun, 8 Aug 2021 20:32:20 +0000 (01:32 +0500)]
Remove HasWildCardCharacters method (#57028)

It is not used any more.

2 years agoJIT: arm64 redundant move peephole must check instruction format (#57016)
Andy Ayers [Sun, 8 Aug 2021 15:08:25 +0000 (08:08 -0700)]
JIT: arm64 redundant move peephole must check instruction format (#57016)

Otherwise we may mistake an immediate for a register and do an incorrect
optimization.

Fixes #56689.

2 years agoJIT: don't update early ref counts in morph (#57037)
Andy Ayers [Sun, 8 Aug 2021 15:07:56 +0000 (08:07 -0700)]
JIT: don't update early ref counts in morph (#57037)

These updates are a vestige of an earlier time when we could not distinguish
early ref counts from normal ref counts. Updating them makes reasoning using
them during morph tricky, and there's no longer any need to do this.

Prerequisite to fixing #56743.

2 years agoLink issue #10478 (#56728)
Kunal Pathak [Sun, 8 Aug 2021 07:48:21 +0000 (00:48 -0700)]
Link issue #10478 (#56728)

* Link issue #56726

* Update to 10478

2 years agoFix ARM64 floating point registers unwinding in PAL (#56919)
Jan Vorlicek [Sun, 8 Aug 2021 06:10:42 +0000 (08:10 +0200)]
Fix ARM64 floating point registers unwinding in PAL (#56919)

* Fix ARM64 floating point registers unwinding in PAL

We were not unwinding the non-volatile floating point registers at all
(not transferring them between the CONTEXT and ucontext_t before and
after the unw_step). That causes crashes on arm64 Unix in some of
the tests since JIT now generates code that uses e.g. the D8 register
and a runtime code that was throwing an exception was using it too.

* Fix non-OSX arm64, remove test csproj patch

* Fix Linux arm64

* Fix Linux arm64 - now really

Fixes #56522

2 years agoFix license in two code documents (#56755)
Adeel Mujahid [Sat, 7 Aug 2021 16:40:12 +0000 (19:40 +0300)]
Fix license in two code documents (#56755)

2 years agoAdditional Diagnostics in Dependency Injection (#56809)
Eric Erhardt [Sat, 7 Aug 2021 15:21:54 +0000 (10:21 -0500)]
Additional Diagnostics in Dependency Injection (#56809)

* Additional Diagnostics in Dependency Injection

Log events when a ServiceProvider is created:

* How many singleton, scoped, transient services?
* Log the list of registrations

Fix #56313

* Add ServiceProvider HashCode to all events.

* Write ServiceProvider information when DependencyInjectionEventSource becomes enabled.

This allows for listeners to attach to a process after it is running, and get the DI information.

* Update new events to use Informational level and to have a Keyword.

* Switch to use WeakReference when holding on to ServiceProviders in DependencyInjectionEventSource.

2 years ago[wasm] Redesign of managed objects marshaling and lifecycle (#56538)
Pavel Savara [Sat, 7 Aug 2021 06:06:48 +0000 (08:06 +0200)]
[wasm] Redesign of managed objects marshaling and lifecycle (#56538)

file cycle of JS owned C# instances is driven by FinalizationRegistry

- got rid of Runtime._weakDelegateTable and Runtime._rawToJS
- got rid of JSObject.WeakRawObject and JSObject.RawObject
- GCHandle instead of JSObject double proxy for plain managed ref types
- GCHandle instead of int sequence for delegates + redesign of invocation
- GCHandle for task + redesign of invocation
- improved in-flight retention of thenable/promise and Task
- explicitly delegate type of parameter for EventListener
- moved and renamed some binding functions
- renamed all handles to jsHandle or gcHandle as appropriate
- removed jsHandle math
- cleanup of unused functions
- improved error messages for invalid handles
- more unit tests

2 years agoFixes for text-based PGO (#56986)
Andy Ayers [Sat, 7 Aug 2021 00:52:39 +0000 (17:52 -0700)]
Fixes for text-based PGO (#56986)

Fix missing indirection when reading in text-based PGO data.

Prioritize reading text-based PGO over dynamic or static PGO data, so that we
can use text to provide a fixed set of PGO data when trying to isolate bugs.

In the jit, give text-based PGO data the same trust level we give to dynamic
PGO data.

2 years agoSgen: Added 'default-namespace' argument (#46500)
Tal Aloni [Fri, 6 Aug 2021 22:48:07 +0000 (01:48 +0300)]
Sgen: Added 'default-namespace' argument (#46500)

* Sgen: Added an optional 'default-namespace' argument

The .NET runtime support loading pre-generated assemblies according to both the type & defaultNamespace when creating an XmlSerializer instance,
Given that, it is extremely useful to have the ability to generate an assembly for different defaultNamespace.

* Added defaultNamespace argument to XmlReflectionImporter

* Prevent setting default-namespace twice

* Added missing using statement

2 years agoFixes #56930 (#57000)
Egor Chesakov [Fri, 6 Aug 2021 22:19:51 +0000 (15:19 -0700)]
Fixes #56930 (#57000)

* Don't eliminate store for the following sequence of instructions
```
ldr wzr, [addrReg, #immOff]
str wzr, [addrReg, #immOff]
```

* Add regression test for https://github.com/dotnet/runtime/issues/56930

2 years agoDisable test failing in .net framework (#56869)
Buyaa Namnan [Fri, 6 Aug 2021 22:17:56 +0000 (15:17 -0700)]
Disable test failing in .net framework (#56869)

* Disable test failing in .net framework

2 years agoChange IOptionsSnapshot to reuse options instances across scopes (#56271)
Nino Floris [Fri, 6 Aug 2021 21:51:45 +0000 (23:51 +0200)]
Change IOptionsSnapshot to reuse options instances across scopes (#56271)

* Change IOptionsSnapshot to reuse options instances across scopes

* Improve snapshot perf for unnamed option and delay dictionary alloc

Co-authored-by: Kahbazi <akahbazi@gmail.com>
Co-authored-by: Kahbazi <akahbazi@gmail.com>
2 years agoAllow Multiple EventSources with same name (GUID) (#56873)
John Salem [Fri, 6 Aug 2021 21:03:26 +0000 (14:03 -0700)]
Allow Multiple EventSources with same name (GUID) (#56873)

2 years agoFix contract violation in debugger func eval (#56933)
David Wrighton [Fri, 6 Aug 2021 20:23:26 +0000 (13:23 -0700)]
Fix contract violation in debugger func eval (#56933)

`DebuggerEval::DebuggerEval` is called from `Debugger::FuncEvalSetup` which is a NOTHROW function. As the `GetInteropSafeExecutableHeap` and associated `Alloc` functions can fail with an OOM, move the allocation out of the constructor to the caller where we can safely return `E_OUTOFMEMORY`.

This contract violation prevents debugging on chk and debug builds of the runtime.

Fixes #54504

2 years ago[wasm][debugger] Fixing async locals in nested ContinueWith blocks (#56911)
Thays Grazia [Fri, 6 Aug 2021 19:54:40 +0000 (16:54 -0300)]
[wasm][debugger] Fixing async locals in nested ContinueWith blocks (#56911)

* Adding test for #41984

* Adding old @radical tests and fixing it.

* Fixing tests.

* Update src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Update src/mono/wasm/debugger/tests/debugger-test/debugger-async-test.cs

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

* Addressing @radical comments.

* Addressing @radical comments.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoRemove System.Linq in Blazor WASM apps (#56937)
Eric Erhardt [Fri, 6 Aug 2021 19:24:45 +0000 (14:24 -0500)]
Remove System.Linq in Blazor WASM apps (#56937)

Removes the last usages of System.Linq in a default Blazor WASM app, which were a handful of ToArray calls.

Fix #56916

2 years agoThis fixes a perf bug in revisit_written_pages for regions - if we are called with...
Peter Sollich [Fri, 6 Aug 2021 19:08:15 +0000 (21:08 +0200)]
This fixes a perf bug in revisit_written_pages for regions - if we are called with concurrent_p == FALSE, we start iterating at gen 0. This causes the small_object_segments to be set to FALSE when we are done with gen 0. This is of course incorrect, we should set this flag when we are done with gen 2. Fix is to modify the if-condition to test for the end of gen 2. (#56987)

2 years agoMore Extensions doc update (#56991)
Dan Moseley [Fri, 6 Aug 2021 19:04:12 +0000 (13:04 -0600)]
More Extensions doc update (#56991)

2 years ago[Mono]: Make EventPipe MonoProfiler provider GC events async safe. (#56714)
Johan Lorensson [Fri, 6 Aug 2021 18:35:56 +0000 (20:35 +0200)]
[Mono]: Make EventPipe MonoProfiler provider GC events async safe. (#56714)

* Make EventPipe MonoProfiler provider GC events async safe.

EventPipe MonoProfiler provider includes most Mono profiler events,
but events currently triggered during GC is not emitted since EventPipe
is not async safe.

This commit add support to emit the MonoProfiler events triggered during
GC (gc resize, gc moves, gc roots and heap dump object references) into
a async safe temporary memory buffer that will be emitted into EventPipe
once GC completes (and world has been restarted). This opens up the
ability to do heapshots using EventPipe running on Mono into nettrace
files.

Heapshots can be triggered in same way as on CoreCLR, creating an
EventPipe session with GCHeapCollectKeyword keyword. Only one heapshot
can be triggered at a time, so in order to trigger an additional
heapshot, a new EventPipe session is setup (after the previous heapshot
has completed). Heapshot events will be included in all session with
configured keywords.

It is also possible to include all vtable/class references
(including class name), into heap dump. This is enabled by a specific
keyword and makes the dump self contained (no need to track type load etc).
That way runtime can start up without any profiler support, and then it
is possible to use custom tool or dotnet-trace to request a heap dump
(including all referenced vtable/class references) and once that
session is done, it is possible to do a new session and get a new
separate heap dump into a new session. Having separate sessions in
different files opens up the ability to diff between any heap dump over
time.

2 years agoReset loop numbers in RecomputeLoopInfo (#56981)
SingleAccretion [Fri, 6 Aug 2021 18:22:54 +0000 (21:22 +0300)]
Reset loop numbers in RecomputeLoopInfo (#56981)

They become stale after optimizations.

2 years agoFix race condition in Net.Security telemetry test (#56984)
Miha Zupan [Fri, 6 Aug 2021 17:33:32 +0000 (10:33 -0700)]
Fix race condition in Net.Security telemetry test (#56984)

2 years agoRefactor repeated invalid character checks in Path.GetFullPath Unix and Windows ...
Steve Berdy [Fri, 6 Aug 2021 16:58:25 +0000 (12:58 -0400)]
Refactor repeated invalid character checks in Path.GetFullPath Unix and Windows (#56568)

* Refactored repeated checks for invalid path chars

* Removed checkedForInvalids param and renamed method to GetFullPathInternal

* Apply suggestions from code review

* Cleaned up trailing whitespace

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoAdd JSON src-gen support for deserializing with parameterized ctors (#56354)
Layomi Akinrinade [Fri, 6 Aug 2021 16:47:48 +0000 (09:47 -0700)]
Add JSON src-gen support for deserializing with parameterized ctors (#56354)

* Add JSON src-gen support for deserializing with parameterized ctors

* Address API review and PR feedback

* Fix issue with init-only properties

* Make misc fixes for build