platform/upstream/dotnet/runtime.git
2 years agoAddress feedback on fabricbot config for area pods (#66137)
Jeff Handley [Sat, 5 Mar 2022 05:05:01 +0000 (21:05 -0800)]
Address feedback on fabricbot config for area pods (#66137)

Automatically remove the `untriaged` label when a triage action is performed. When an issue/PR is moved to another area, consider it done on the original board instead of removing it.

2 years agoReplace CngCommon hash with OneShotHashHelpers.
Kevin Jones [Sat, 5 Mar 2022 03:49:08 +0000 (22:49 -0500)]
Replace CngCommon hash with OneShotHashHelpers.

2 years agoRename classes in p/invoke generator to be `LibraryImport` (#66217)
Elinor Fung [Sat, 5 Mar 2022 03:42:33 +0000 (19:42 -0800)]
Rename classes in p/invoke generator to be `LibraryImport` (#66217)

2 years agoUse CMakeProjectReference instead of ProjectReference (#66202)
Aaron Robinson [Sat, 5 Mar 2022 03:40:27 +0000 (19:40 -0800)]
Use CMakeProjectReference instead of ProjectReference (#66202)

* Use CMakeProjectReference instead of ProjectReference

Changing this permits usage of "\runtime\dotnet.cmd build" as opposed
  to forcing users to use "\runtime\dotnet.cmd msbuild".

2 years ago[wasm] Add support for symbolicating native traces from JS, using a symbols file...
Ankit Jain [Sat, 5 Mar 2022 02:38:26 +0000 (21:38 -0500)]
[wasm] Add support for symbolicating native traces from JS, using a symbols file (#66042)

* [wasm] Fix run command lines for samples

* [wasm] Export FS_readFile

* [wasm] Add support for symbolicating traces in console errors, or

.. warnings. The regex patterns are hardcoded in `debug.ts`. And the
symbols are loaded from `dotnet.js.symbols`.

We try to symbolicate wherever possible.

* [wasm] Enable symbolicating for non-aot test builds by default

* [wasm] Enable symbol map for debugger tests

* Address feedback from @pavelsavara

* [wasm] Add a `mono_wasm_symbolicate_string` function

.. and use that to symbolicate traces marshaled as C# exceptions (thanks
to @pavelsavara for the suggestion).

2 years agoAdd HostApplicationBuilder (#65109)
Stephen Halter [Sat, 5 Mar 2022 01:15:17 +0000 (17:15 -0800)]
Add HostApplicationBuilder (#65109)

2 years agoDelete compUnsafeCastUsed (#66204)
SingleAccretion [Fri, 4 Mar 2022 22:59:19 +0000 (01:59 +0300)]
Delete compUnsafeCastUsed (#66204)

2 years agoSlightly more aggressive ASG reversal (#65920)
SingleAccretion [Fri, 4 Mar 2022 22:06:37 +0000 (01:06 +0300)]
Slightly more aggressive ASG reversal (#65920)

Allows us to reverse "ASG(IND(const), ...)".

2 years agoKeep the volatility of CLS_VARs in rationalize (#65919)
SingleAccretion [Fri, 4 Mar 2022 21:38:48 +0000 (00:38 +0300)]
Keep the volatility of CLS_VARs in rationalize (#65919)

2 years agoFix source generated regex compilation failure due to mismatched notion of atomic...
Stephen Toub [Fri, 4 Mar 2022 20:45:33 +0000 (15:45 -0500)]
Fix source generated regex compilation failure due to mismatched notion of atomic (#66195)

During and post-parsing, we apply various optimizations to the regex node tree, in particular trying to annotate as much as possible as atomic in order to eliminate unnecessary backtracking.  Then later when RegexCompiler and the source generator view the final tree, they also compute for every node whether a child may backtrack, as doing so enables avoiding unnecessary backtracking-related code generation if the child is known to not backtrack (e.g. because it's now marked as atomic).  However, things can go awry if the compiler / source generator's view of what's atomic differs from what's actually generated.  Because of how optimizations are applied to the node tree, it's possible for a late optimization to make a transformation that then would enable a node to be made atomic, but we don't run that phase of the optimizer again, and thus the node is left non-atomic.  Then the source generator comes along, does its analysis, and sees that the node should be treated as atomic.  That leads to problems, because the node itself will have unnecessary backtracking code generated but the parent will rightly assume there wasn't anyway and won't generate the code necessary to compensate for it, or alternatively will generate code that causes problems (e.g. the source generator uses this information to determine whether it can output scopes).

Our outer loop tests that source gen our full regex corpus caught a case where this was happening.  A couple fixes, either of which on their own is sufficient to address this particular case, but each of which also brings other benefits:
1. When rendering a single-char loop, it consults the computed atomicity table to determine whether the rest of the source generation views it as atomic.  If it does, it instead does an atomic rendering.
2. When we do our ending backtracking elimination pass (i.e. walking down the right-hand side of atomic nodes to make anything that ends them also be atomic), we should also recur into lookarounds.

This also removes some duplicated code for reducing lookarounds, and renames some stale method names.

2 years agoClean up stale use of runtextbeg/end in RegexInterpreter (#66178)
Stephen Toub [Fri, 4 Mar 2022 20:33:55 +0000 (15:33 -0500)]
Clean up stale use of runtextbeg/end in RegexInterpreter (#66178)

2 years ago[wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY (#65790)
Radek Doulik [Fri, 4 Mar 2022 19:36:48 +0000 (20:36 +0100)]
[wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY (#65790)

* [wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY

It was renamed in emscripten 1.39.9:

    - Rename `TOTAL_MEMORY` to `INITIAL_MEMORY` and `WASM_MEM_MAX` to `MAXIMUM_MEMORY`,
      which are more accurate and match wasm conventions. The old names are still
      supported as aliases.

* Add EmccInitialMemory property

2 years agoFix catching of generic exception in crossgened shared generic code (#66162)
Jan Kotas [Fri, 4 Mar 2022 19:13:54 +0000 (11:13 -0800)]
Fix catching of generic exception in crossgened shared generic code  (#66162)

* Add regression test

Fixes #66005

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoAdd support for Windows IO completions to the portable thread pool (#64834)
Koundinya Veluri [Fri, 4 Mar 2022 18:47:48 +0000 (10:47 -0800)]
Add support for Windows IO completions to the portable thread pool (#64834)

* Add support for Windows IO completions to the portable thread pool

- Added an implementation for BindHandle
- Polling for IO completions is done in batches on separate threads similarly to what is done on Unixes
- Added a high-priority work item queue to have IO completion work items run at higher priority
- Removed the time-sensitive work item queue, used the high-priority queue instead

2 years agoMake sure that StressLogAnalyzer works with filtering 64 bit addresses (#64594)
Andrew Au [Fri, 4 Mar 2022 18:07:01 +0000 (10:07 -0800)]
Make sure that StressLogAnalyzer works with filtering 64 bit addresses (#64594)

2 years agoUpdate files to remove imhameed (#66160)
Sam Patel [Fri, 4 Mar 2022 17:15:58 +0000 (12:15 -0500)]
Update files to remove imhameed (#66160)

* Update Codeowners to remove imhameed

* Update area-owners.md to remove imhameed

* Update fabricbot.json file to remove imhameed

* update codeowners file to remove alexrp

* update codeowners to remove Egor from Mono files

* remove merp related entries from CODEOWNERS

Co-authored-by: Aleksey Kliger (λgeek) <alklig@microsoft.com>
Co-authored-by: Aleksey Kliger (λgeek) <alklig@microsoft.com>
2 years agoMake ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's (#66169)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:48:09 +0000 (16:48 +0000)]
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's (#66169)

* Make ReadStack.JsonTypeInfo derivation consistent with WriteStack

* remove duplicated assignment

2 years agoFix issues related to JsonSerializerOptions mutation and caching. (#65863)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:17:01 +0000 (16:17 +0000)]
Fix issues related to JsonSerializerOptions mutation and caching. (#65863)

* Fix issues related to JsonSerializerOptions mutation and caching.

* fix test style

* fix linker warning

2 years agoFix DebuggerDisplay for serializer types (#65971)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:14:36 +0000 (16:14 +0000)]
Fix DebuggerDisplay for serializer types (#65971)

* Fix DebuggerDisplay for serializer types

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs

2 years agoSome more clean up for RegexOptions.NonBacktracking (#66018)
Stephen Toub [Fri, 4 Mar 2022 15:52:45 +0000 (10:52 -0500)]
Some more clean up for RegexOptions.NonBacktracking (#66018)

* Remove some dead code

* Remove Algebras folder

* Delete more dead code

* Clean up BV

* Change GenerateMinterms to accept a HashSet rather than IEnumerable

* Remove more unnecessary enumerable iteration

* Delete more dead code

* A little more BitVector cleanup

* Address PR feedback

2 years ago[mono] Remove support for nint/nuint/nfloat from mini-native-types.c (#65967)
Alexander Köplinger [Fri, 4 Mar 2022 15:32:56 +0000 (16:32 +0100)]
[mono] Remove support for nint/nuint/nfloat from mini-native-types.c (#65967)

The Xamarin.iOS types were replaced by the BCL versions.

2 years ago delete the test file with custom security settings when it's being closed (#66192)
Adam Sitnik [Fri, 4 Mar 2022 15:07:03 +0000 (16:07 +0100)]
 delete the test file with custom security settings when it's being closed (#66192)

2 years agoRename unixinterface.cpp -> exports.cpp (#66190)
Aaron Robinson [Fri, 4 Mar 2022 14:50:07 +0000 (06:50 -0800)]
Rename unixinterface.cpp -> exports.cpp (#66190)

2 years agoRemove the multitarget from ILCompiler.Reflection.R2r (#66175)
Andy Gocke [Fri, 4 Mar 2022 14:49:12 +0000 (06:49 -0800)]
Remove the multitarget from ILCompiler.Reflection.R2r (#66175)

2 years ago[tests] Add MonoApi runtime tests (#65221)
Aleksey Kliger (λgeek) [Fri, 4 Mar 2022 13:46:02 +0000 (08:46 -0500)]
[tests] Add MonoApi runtime tests (#65221)

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

Create a new directory src/tests/Interop/MonoAPI for tests that use the mono embedding API.

Move the mono libtest.c native library along with managed tests: InstallEHCallback.cs, PInvokeDetach.cs and Thunks.cs to src/tests/Interop/MonoAPI/...

The native library (now called mono-embedding-api-test.c) builds on all platforms where we build native support libraries for the runtime tests.

The managed tests only run on desktop mono configurations for now.

* copy libtest.c from mono to src/tests and add cmake builds

* Make it build with the monoapi project

* remove mono-compiler.h dependency

* Remove dependency on gmodule.h

   Had to copy the w32_find_symbol code that searches for a symbol in every module.

* Remove test library eglib dependency

   Delete some unrunnable tests.

   Copy some basic eglib utilities into the test.

* Move native embedding API test lib to Interop/MonoAPI/Native

* Move install_eh_callback test to src/tests/Interop/MonoAPI/MonoMono

* add issues.targets excludes for MonoAPI tests

  Not expected to run on coreclr or mono on wasm or mobile, for now.

* Add PInvokeDetach MonoAPI test

* Return exit code 100 on success

* Change test class names to be unique

* fix win32 and gcc builds

* simplify managed code

* put all the MonoMono tests in a single directory

* Use the new MONO_API_FUNCTION monoapi headers

* compile the native library as C, not C++, same as libtest.c in the past

* delete many unused test functions

* delete unused utilities

* Add Thunks.cs tests

* Use a common setup method to probe for symbols

* simplify the native test library

* Make the PInvokeDetach native code sleep less

* add MIT banner

* skip Thunks test on AOT

   In the mono/mono repo that test was not expected to work with AOT

2 years agoUse RegexGenerator in System.Private.Xml (#66142)
Stephen Toub [Fri, 4 Mar 2022 11:33:07 +0000 (06:33 -0500)]
Use RegexGenerator in System.Private.Xml (#66142)

2 years agoUpdate Traversal msbuild SDK (#66165)
Viktor Hofer [Fri, 4 Mar 2022 10:53:13 +0000 (11:53 +0100)]
Update Traversal msbuild SDK (#66165)

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

2 years agoOnly register composite R2R native image code range once (#65623)
Tomáš Rylek [Fri, 4 Mar 2022 10:51:57 +0000 (11:51 +0100)]
Only register composite R2R native image code range once (#65623)

As David Wrighton noticed during an independent investigation,
today CoreCLR runtime logic ends up registering composite image
code range with the execution manager the number of times equal
to the number of component modules of the composite image
accessed at runtime, i.e. ultimately up to over 200 times in case
of the composite framework. This change fixes that by slightly
shuffling the initialization housekeeping chores.

Thanks

Tomas

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

2 years agoDon't add TestLibrary as a reference to all runtime tests (#66157)
Tomáš Rylek [Fri, 4 Mar 2022 10:50:50 +0000 (11:50 +0100)]
Don't add TestLibrary as a reference to all runtime tests (#66157)

When I was tagging several architecture-dependent runtime tests
with the ConditionalFact attribute, I added CoreCLRTestLibrary
as a general reference. This started causing timeouts in Mono AOT
tests because the library needs to be compiled many times.
As there's only a small number of architecture-dependent tests,
I have modified the change so that the test library is only added
explicitly to architecture-dependent tests.

Fixes: #66083

Thanks

Tomas

2 years agoImprove ICU missing msg for Alpine (#66150)
Dan Moseley [Fri, 4 Mar 2022 10:28:00 +0000 (03:28 -0700)]
Improve ICU missing msg for Alpine (#66150)

2 years agodocs(jsonPropertyOrder): correct ctor xmldocs (#66173)
Jay Harris [Fri, 4 Mar 2022 10:03:18 +0000 (02:03 -0800)]
docs(jsonPropertyOrder): correct ctor xmldocs (#66173)

Change the ctor XML docs on JsonPropertyOrderAttribute to property self-reference the JsonPropertyOrderAttribute type.

2 years agoSkip Upper vector save/restore for blocks that THROW (#66109)
Kunal Pathak [Fri, 4 Mar 2022 07:00:20 +0000 (23:00 -0800)]
Skip Upper vector save/restore for blocks that THROW (#66109)

* Skip upper vector save/restore if the call doesn't return or the block is a THROW block

* Revert "Disable SuperPMI replay jobs until #65332 is fixed (#66062)"

This reverts commit eb2fea80c6a4ff8117930b4003391d737f05c686.

* Just skip restore for BBJ_THROW

* Use skipSaveRestore to avoid extra save/restores

* jit format

2 years agoRename `DllImportGenerator` project to `LibraryImportGenerator` (#66029)
Elinor Fung [Fri, 4 Mar 2022 06:17:23 +0000 (22:17 -0800)]
Rename `DllImportGenerator` project to `LibraryImportGenerator` (#66029)

2 years agoAvoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)
madelson [Fri, 4 Mar 2022 04:19:52 +0000 (23:19 -0500)]
Avoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)

* Avoid Attribute.GetCustomAttributes() returning null for open generic type.

Fix #64335

2 years agoretire DummyTcpServer from SslStream tests (#65876)
Tomas Weinfurt [Fri, 4 Mar 2022 04:15:52 +0000 (20:15 -0800)]
retire DummyTcpServer from SslStream tests (#65876)

* retire DummyTcpServer from SslStream test

* fix build

* feedback from review

2 years agoFix System.IO.Ports native package not getting published any longer after the oob...
Jose Perez Rodriguez [Fri, 4 Mar 2022 03:56:22 +0000 (19:56 -0800)]
Fix System.IO.Ports native package not getting published any longer after the oob + sfx split (#66176)

2 years agoUpdate the StubManager for better debugger stepping. (#65947)
Aaron Robinson [Fri, 4 Mar 2022 01:10:06 +0000 (17:10 -0800)]
Update the StubManager for better debugger stepping. (#65947)

* Update various comments and logging

* The StubManager is now aware of InstantiatingMethods in IL Stub
  and StubLink scenarios
Created the concept of a "StepThroughStub". This handles cases where
  the stub should be treated like as an implementation details and
  simply forward to the appropriate target.
Updates to various logging mechanisms.

* Reorganize the ILStubType logic between DynamicMethodDesc and ILStubResolver.

2 years agoAdd RIDs for MIRACLE LINUX 8 and 9 (#61304)
Matthias Kruk [Fri, 4 Mar 2022 00:09:12 +0000 (09:09 +0900)]
Add RIDs for MIRACLE LINUX 8 and 9 (#61304)

Whenever we build dotnet RPMs for MIRACLE LINUX 8 (formerly Asianux Server 8) we have to
apply patches that add RIDs for MIRACLE LINUX. To streamline the build process, we would
like to add our RIDs to the upstream sources, in the same way CentOS and other RHEL-
derivatives do.

This commit adds the following runtime IDs:
 - "miraclelinux"
 - "miraclelinux-x64"
 - "miraclelinux.8"
 - "miraclelinux.8-x64"
 - "miraclelinux.9"
 - "miraclelinux.9-x64"

2 years agoFix copy propagation (#66070)
SingleAccretion [Thu, 3 Mar 2022 22:59:13 +0000 (01:59 +0300)]
Fix copy propagation (#66070)

Now that we don't push defs for shadowed parameters, we don't want to pop them as well.

2 years agoUse a unique EventId for Verbose in NetEventSource.Common (#66158)
Miha Zupan [Thu, 3 Mar 2022 22:57:56 +0000 (14:57 -0800)]
Use a unique EventId for Verbose in NetEventSource.Common (#66158)

2 years agoRun trim analyzer (#65870)
Sven Boemer [Thu, 3 Mar 2022 22:22:30 +0000 (14:22 -0800)]
Run trim analyzer (#65870)

* Use SDK logic for IsTrimmable

* Address some analyzer warnings

* Disable analyzer when baseline suppressions exist

* Don't mark unannotated test project as trimmable

* Add nativeaot annotations

* Add suppression in windows-only code

* Import illink.targets only when trimming mobile tests

* Don't run analyzer on unannotated windows OOBs

* PR feedback

Use pragma instead of UnconditionalSuppressMessage

2 years agoattempt to fix up EnterpriseTests (#65981)
Tomas Weinfurt [Thu, 3 Mar 2022 22:16:04 +0000 (14:16 -0800)]
attempt to fix up EnterpriseTests (#65981)

* attemp to fix up EnterpriseTests

* fix text

* increase timoeout on build step

* fix temeout

* add jobs

* update job

* fix formating

* fix name

* update server check

* restore original resolver before tests

* fix path

* experiment

2 years agoRemove leftover runtextbeg/end references from RegexCompiler / source generator ...
Stephen Toub [Thu, 3 Mar 2022 22:01:58 +0000 (17:01 -0500)]
Remove leftover runtextbeg/end references from RegexCompiler / source generator (#66129)

Now that we're operating over a span that represents the full input from beginning to end, we no longer need to access runtextbeg/runtextend, we can use inputSpan.Slice(pos) instead of inputSpan.Slice(pos, end - pos), etc.

2 years agoremove MemoryManagerPinLargeArray test, as it tests something that we don't ship...
Adam Sitnik [Thu, 3 Mar 2022 19:35:51 +0000 (20:35 +0100)]
remove MemoryManagerPinLargeArray test, as it tests something that we don't ship and causes trouble as it needs 2 GB of memory (#66152)

2 years agoavoid unnecessary base.Dispose call, as the base implementation does nothing (#66140)
Adam Sitnik [Thu, 3 Mar 2022 19:34:16 +0000 (20:34 +0100)]
avoid unnecessary base.Dispose call, as the base implementation does nothing (#66140)

2 years agoFix test failure due to conflicting merged PRs in DllImportGenerator tests. (#66156)
Jeremy Koritzinsky [Thu, 3 Mar 2022 19:21:34 +0000 (11:21 -0800)]
Fix test failure due to conflicting merged PRs in DllImportGenerator tests. (#66156)

Fixes #66143

2 years agoAdd a comment in source-generated regexes explaining why they cannot have optimized...
Theodore Tsirpanis [Thu, 3 Mar 2022 16:26:18 +0000 (18:26 +0200)]
Add a comment in source-generated regexes explaining why they cannot have optimized code. (#66114)

* Add a comment in source-generated regexes explaining why they cannot have optimized code.

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFix handling of atomic nodes in RegexCompiler / source generator (#66046)
Stephen Toub [Thu, 3 Mar 2022 16:24:39 +0000 (11:24 -0500)]
Fix handling of atomic nodes in RegexCompiler / source generator (#66046)

* Fix handling of atomic nodes in RegexCompiler / source generator

We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.

* Fix atomic handling for positive/negative lookaheads as well

2 years ago[mono][jit] Fix an assert in the local register allocator. (#66054)
Zoltan Varga [Thu, 3 Mar 2022 15:43:49 +0000 (10:43 -0500)]
[mono][jit] Fix an assert in the local register allocator. (#66054)

The assertion is hit when an instruction has a fixed sreg
(like shifts on x86) which was spilled to the stack.

2 years ago[monoapi] Add mono_method_get_unmanaged_callers_only_ftnptr (#66007)
Aleksey Kliger (λgeek) [Thu, 3 Mar 2022 15:38:37 +0000 (10:38 -0500)]
[monoapi] Add mono_method_get_unmanaged_callers_only_ftnptr (#66007)

Like `RuntimeMethodHandle.GetFunctionPointer`, but callable from native code

2 years agoImprove formatting of host test errors (#65730)
Vitek Karas [Thu, 3 Mar 2022 14:39:39 +0000 (06:39 -0800)]
Improve formatting of host test errors (#65730)

The host tests use FluentAssertions which has its own implementation of string formatting, for things like `Print("Some {0}", "message\r\nline")`. Instead of taking the string replacement as-is, it formats it by wrapping it in double quotes and replaces newlines with escaped values, so the above would output:
```
Some "message\r\nline"
```

This makes the test output quite hard to read without formatting it back (by unescaping the newlines).

Unfortunately FluentAssertions tries hard to always run the value through its own formatter. So even if we preformat everything and instead call `Print($"Some {"message\r\nline"})` it only works sometimes. The string is still parsed and the parser may fail if it finds for example only an open `{` without a closing one. This makes it nest to useless as we would have to make sure to somehow escape everything we feed in.

So this change introduces a new extension method FailWithPreformatted which circumvents the automatic formatting and uses the underlying AddFailure method which will not format anything.

2 years ago[iOS] Fix return code when failing to load ICU data (#66055)
Steve Pfister [Thu, 3 Mar 2022 14:05:27 +0000 (09:05 -0500)]
[iOS] Fix return code when failing to load ICU data (#66055)

`GlobalizationNative_LoadICUData` was returning -1 when loading failed instead of 0. The result would be a misleading exception as opposed to failing the application fast.

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

2 years agoMark SslProtocols.Tls and SslProtocols.Tls11 as obsolete (#65773)
Radek Zikmund [Thu, 3 Mar 2022 14:04:42 +0000 (15:04 +0100)]
Mark SslProtocols.Tls and SslProtocols.Tls11 as obsolete (#65773)

Fixes #65546

2 years agoMark ImageAnimator.UpdateFrames to accept a nullable Image (#65949)
Jeff Handley [Thu, 3 Mar 2022 12:45:47 +0000 (04:45 -0800)]
Mark ImageAnimator.UpdateFrames to accept a nullable Image (#65949)

2 years agoAdd support for static virtual methods (#66084)
Michal Strehovský [Thu, 3 Mar 2022 07:30:18 +0000 (08:30 +0100)]
Add support for static virtual methods (#66084)

Took the type system changes from #54063 and cleaned them up, added unit tests.

Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls.

Missing things:

* Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change.
* Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw.

But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.

2 years agoFix `mcs -merge` to stop printing an error message on success (#66128)
Bruce Forstall [Thu, 3 Mar 2022 07:01:11 +0000 (23:01 -0800)]
Fix `mcs -merge` to stop printing an error message on success (#66128)

Even on success, it would print "ERROR: No files found to merge."

2 years agoFix remaining COM warnings in crossgen2 (#65297)
Andy Gocke [Thu, 3 Mar 2022 06:12:26 +0000 (22:12 -0800)]
Fix remaining COM warnings in crossgen2 (#65297)

2 years agoDisable default marshalling for bool (#65749)
Jeremy Koritzinsky [Thu, 3 Mar 2022 04:57:54 +0000 (20:57 -0800)]
Disable default marshalling for bool (#65749)

2 years agoFix marshalling issue with BerVal (#66119)
Jose Perez Rodriguez [Thu, 3 Mar 2022 04:13:35 +0000 (20:13 -0800)]
Fix marshalling issue with BerVal (#66119)

2 years agoUpdate RegexGenerator to require LangVersion > 10 (#66111)
Stephen Toub [Thu, 3 Mar 2022 04:10:47 +0000 (23:10 -0500)]
Update RegexGenerator to require LangVersion > 10 (#66111)

We plan to take a dependency on a C# 11 language feature.  For now, reserve that right by requiring a version > 10.  We can downgrade it later if possible and desired.

2 years agoFix ZipArchiveEntry names shown as corrupted on other zip programs (#65886)
David Cantú [Thu, 3 Mar 2022 01:59:58 +0000 (17:59 -0800)]
Fix ZipArchiveEntry names shown as corrupted on other zip programs (#65886)

* Fix ZipArchiveEntry names shown as corrupted on other zip programs

* Add test

2 years ago[tests] Update eventsvalidation tests to use intree Microsoft.Diagnostics.NETCore...
Mitchell Hwang [Thu, 3 Mar 2022 01:22:51 +0000 (20:22 -0500)]
[tests] Update eventsvalidation tests to use intree Microsoft.Diagnostics.NETCore.Client (#66110)

* [tests] Update eventsvalidation tests to use intree Microsoft.Diagnostics.NETCore.Client
* Fix keyword position and set default EventLevel

2 years agoJIT: tolerate schema mismatches in partial compilation with pgo (#66105)
Andy Ayers [Thu, 3 Mar 2022 01:12:45 +0000 (17:12 -0800)]
JIT: tolerate schema mismatches in partial compilation with pgo (#66105)

Cleanup properly if we fail to instrument because of a schema allocation
failure. This fixes #65992.

More work is needed to ensure schema allocation does not fail. This
is tracked by #66101.

2 years agoJIT: add hash and tiering name to assert message (#66107)
Andy Ayers [Thu, 3 Mar 2022 01:11:01 +0000 (17:11 -0800)]
JIT: add hash and tiering name to assert message (#66107)

Now that methods may be jitted multiple times and may have complex names, it is
useful to know their hashes and tiering names as part of asserts.

2 years agoUpdate Roslyn and use new step tracking API in incremental tests. (#63978)
Jeremy Koritzinsky [Thu, 3 Mar 2022 01:07:43 +0000 (17:07 -0800)]
Update Roslyn and use new step tracking API in incremental tests. (#63978)

2 years ago[wasm] Bump sdk for workload testing to `7.0.100-preview.3.22151.18` (#65003)
Ankit Jain [Thu, 3 Mar 2022 00:57:08 +0000 (19:57 -0500)]
[wasm] Bump sdk for workload testing to `7.0.100-preview.3.22151.18` (#65003)

* [wasm] bump sdk for workload testing to 7.0.100-preview.2.22108.4

* [wasm] dotnet-install.sh logs errors from curl, while trying older urls,

.. don't let that fail the build.

* [wasm] trigger Wasm.Build.Tests when workload-testing.targets changes

* [wasm] trigger Wasm.Build.Tests on CI when eng/Versions.props changes

* [wasm] Update Wasm.Build.Tests to target net7.0 by default

net6 projects don't build with the workload currently. Tests will be
added for that once it is fixed.

* Bump sdk for workload testing to 7.0.100-preview.3.22128.3

* Bump sdk version for workload testing to 7.0.100-preview.3.22151.18

2 years agoSPMI no ASMDiff between Checked and Release (#61335)
Julie Lee [Wed, 2 Mar 2022 23:33:11 +0000 (15:33 -0800)]
SPMI no ASMDiff between Checked and Release (#61335)

* SPMI no ASMDiff between Checked and Release

Created the first file that builds release and checked builds

* SuperPMI asmdiff checked and release
* Added downloading JIT release builds in superpmi-asmdiff-job
* Added dummy 'run-superpmi-asmdiff-job'

* SuperPmi asmdiff checked release
* Added JIT release download
* Added dummy run job that just runs superpmi replay

* SuperPMI asmdiff checked release
* Remove the 4th argument for jobName and displayName

* SuperPMI asmdiff checked release
* In run-superpmi-asmdiff-checked-release-job.yml,
  * Added release_directory and release artifact to the script arguments
  * Added ReleaseCorrelationPayloadDirectory and ReleaseArtifactName to parameters to send-to-helix-step.yml

* In superpmi_asmdiff_checked_release_setup.py
  * Added release_directory and release_artifactname arguments
  * Copied release binaries to source_directory/payload_release

* SuperPMI asmdiffs checked release
* Added superpmi_asmdiffs_checked_release_setup.py to set up Helix directories for checked in base and release in diff directories.
* Use superpmi_asmdiffs.py and superpmi-asmdiffs.proj.
* Renamed files from asmdiff to asmdiffs.

* SuperPMI asmdiffs checked release: resolve merge conflict

* SuperPMI asmdiffs checked release: Fixed to use a proj and a script file that compare with Release

* Superpmi asmdiffs checked release: changed to --diff_with_release as a boolean arg

* SuperPMI asmdiffs checked release: Add dependency to completed Release build

* Superpmi asmdiffs checked release: add diff_with_release back that got removed from merge

* SuperPMI asmdiffs checked release: Do not create asm file for asmdiff check with release

* SuperPMI asmdiffs checked release: Report failure asm diffs (return code 2) if --diff_with_release

* SuperPMI asmdiffs checked release: Handled code review feedback to remove jit-analyze and diff_summary.md

* SuperPMI asmdiffs checked release: Changed to checked_directory instead of base_directory

* SuperPMI asmdiffs checked release: explictly say checked_directory

* SuperPMI asmdiffs checked release: schedule to run on Saturdays and Sundays only.

2 years agoTry to work around random CI failures in "dotnet restore" of benchmarks (#66116)
Bruce Forstall [Wed, 2 Mar 2022 23:10:50 +0000 (15:10 -0800)]
Try to work around random CI failures in "dotnet restore" of benchmarks (#66116)

Set the "retry" environment variable described in
https://github.com/NuGet/NuGet.Client/pull/4259.

2 years agoPartition SuperPMI replay task (#66065)
Bruce Forstall [Wed, 2 Mar 2022 23:04:59 +0000 (15:04 -0800)]
Partition SuperPMI replay task (#66065)

* Partition SuperPMI replay task

Split per-platform/architecture work into multiple partitions to increase pipeline
parallelism and reduce overall job time. The partitions are sets of
different JitStressRegs options.

We could create a partition for each JitStressRegs option, but the concern
is that there is potentially a lot of overhead downloading the large set
of MCH files, and we might want to share that overhead between work partitions.

* Add comment

2 years agoDo not value number locals on the LHS (#65902)
SingleAccretion [Wed, 2 Mar 2022 22:28:41 +0000 (01:28 +0300)]
Do not value number locals on the LHS (#65902)

* Consistently number LHSs with VNForVoid

And account for this in copy propagation.

No diffs.

* Remove the copy block quirk

Removing the PHI quirk is more problematic due to regressions.

* Tentative: remove the PHI quirk

Let's assess the diffs.

* Revert "Tentative: remove the PHI quirk"

This reverts commit b22d20ef390a846369a17755627aeba7923867c0.

2 years agoSwitch field being examined by NullablePublicOnlyOtherTypesTest (#66113)
Stephen Toub [Wed, 2 Mar 2022 22:01:16 +0000 (17:01 -0500)]
Switch field being examined by NullablePublicOnlyOtherTypesTest (#66113)

We should subsequently rewrite the tests to stop relying on the private members of types in other assemblies, but for now this gets the test passing.

2 years agoFix cross-arch build compilation error about missing O_RDONLY (#66094)
Stephen Toub [Wed, 2 Mar 2022 21:29:10 +0000 (16:29 -0500)]
Fix cross-arch build compilation error about missing O_RDONLY (#66094)

2 years agoDisable Match_Timeout_Repetition_Throws test with NonBacktracking (#66093)
Stephen Toub [Wed, 2 Mar 2022 21:28:46 +0000 (16:28 -0500)]
Disable Match_Timeout_Repetition_Throws test with NonBacktracking (#66093)

2 years agoDisable SuperPMI replay jobs until #65332 is fixed (#66062)
Bruce Forstall [Wed, 2 Mar 2022 19:39:48 +0000 (11:39 -0800)]
Disable SuperPMI replay jobs until #65332 is fixed (#66062)

Specifically, JitStressRegs=1 and JitStressRegs=8 legs.
Note that #65332 only hits 1 failure in each of these legs, and
only on arm64 platforms, but we don't have a way to be more
precise in our disabling.

2 years agoJIT: fix interaction of PGO and partial compilation (#66061)
Andy Ayers [Wed, 2 Mar 2022 19:26:29 +0000 (11:26 -0800)]
JIT: fix interaction of PGO and partial compilation (#66061)

Partially compiled methods must use the dense block based profile schema
instead of the sparse edge based profile schema.

Fixes #65977.

2 years agoAddress TODO to switch to generated p/invoke (#66057)
Elinor Fung [Wed, 2 Mar 2022 19:08:29 +0000 (11:08 -0800)]
Address TODO to switch to generated p/invoke (#66057)

2 years agoJIT: Unroll Equals and StartsWith for constant strings and spans. [0..32] chars ...
Egor Bogatov [Wed, 2 Mar 2022 17:56:50 +0000 (20:56 +0300)]
JIT: Unroll Equals and StartsWith for constant strings and spans. [0..32] chars (#65288)

Co-authored-by: Andy Ayers <andya@microsoft.com>
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years ago[wasm] Fix S.T.Regex test failures due to line ending differences (#66017)
Ankit Jain [Wed, 2 Mar 2022 17:47:58 +0000 (12:47 -0500)]
[wasm] Fix S.T.Regex test failures due to line ending differences (#66017)

2 years agoUse generic `Enum` methods when possible. (#64850)
Theodore Tsirpanis [Wed, 2 Mar 2022 16:27:18 +0000 (18:27 +0200)]
Use generic `Enum` methods when possible. (#64850)

* Use generic `Enum` methods when possible.

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

Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
2 years agoKeep CLSCompliantAttribute in sync for src <-> ref (#66075)
Viktor Hofer [Wed, 2 Mar 2022 15:17:47 +0000 (16:17 +0100)]
Keep CLSCompliantAttribute in sync for src <-> ref (#66075)

ApiCompat actually ran validation for that attribute until the check was
disabled with a675e1c2c4f46b98ecac1253223649d8f36d5da7.

Enable it again and only disable it for baseline api compat validation,
which is performed in ApiCompat.proj.

2 years ago[tests][eventpipe] Port over Dotnet/Diagnostics to enable eventpipe tests on Android...
Mitchell Hwang [Wed, 2 Mar 2022 14:54:01 +0000 (09:54 -0500)]
[tests][eventpipe] Port over Dotnet/Diagnostics to enable eventpipe tests on Android (#64358)

* [tests][eventpipe] Port over Dotnet/Diagnostics files for mobile eventpipe tests

Copied over files from src/Microsoft.Diagnostics.NETCore.Client based off of 99fab307

* [tests][eventpipe] Add TCP/IP logic for mobile eventpipe tests

* [tests] Remove Microsoft.Diagnostics.NETCore.Client package reference

* [tests][eventpipe] Downstream Diagnostics IpcTraceTest DiagnosticsClient bootstrap

https://github.com/dotnet/diagnostics/pull/720

* [tests][eventpipe] Downstream Diagnostics roslyn analyzer IpcTraceTest change

https://github.com/dotnet/diagnostics/pull/1044

* [tests][eventpipe] Enable TCPIP DiagnosticsClient in IpcTraceTest for Android

* [tests][eventpipe] Aesthetic IpcTraceTest modifications

* [tests][eventpipe] Disable subprocesses tests on Android

* [tests][eventpipe] Update processinfo

* [tests][eventpipe] Update processinfo2

* [tests][eventpipe] Update eventsourceerror

* [tests][eventpipe] Update bigevent

* [tests][eventpipe] Update buffersize

* [tests][eventpipe] Update rundownvalidation

* [tests][eventpipe] Update providervalidation

* [tests][eventpipe] Update gcdump

* [tests][JIT] Update debuginfo/tester

* [tests] Segment Microsoft.Diagnostics.NETCore.Client relevant tests for Linux arm coreclr

* Account for nonspecified RuntimeFlavor

* [tests] Moveup Default coreclr RuntimeFlavor property explicit declaration

* [tests] Duplicate Microsoft.Diagnostics.NETCore.Client dependent tests for Linux arm

* Fix debuginfo/tester test skip

* Temporarily enable bigevent on Linux arm and remove duplicate exclude

* Fix unaligned UTF16 string read in collect tracing EventPipe command.

Collect tracing 2 EventPipe command triggers an unaligned UTF16 string
read that could cause a SIGBUS on platforms not supporting unalinged
reads of UTF16 strings (so far only seen on 32-bit ARM Linux CI machine).

On CoreCLR this could even cause a unalinged int read due to
optimizations used in UTF8Encoding::GetByteCount.

* Revert "[tests] Duplicate Microsoft.Diagnostics.NETCore.Client dependent tests for Linux arm"

This reverts commit cb2cacd93bb61b74b36c2d2d26cccec38b51b8f7.

* Revert "[tests] Segment Microsoft.Diagnostics.NETCore.Client relevant tests for Linux arm coreclr"

This reverts commit dc29676bcea3a6073decf15a9f1dbc9b2e7b3bd8.

* Revert "Fix debuginfo/tester test skip"

This reverts commit 1e90d7e4667c0570c8f4c2536a25620697027c97.

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Co-authored-by: lateralusX <lateralusx.github@gmail.com>
2 years agoSimplify RuntimeHelpers.GetSubArray (#66011)
Jan Kotas [Wed, 2 Mar 2022 14:43:03 +0000 (06:43 -0800)]
Simplify RuntimeHelpers.GetSubArray (#66011)

The special casing of co-variant arrays was added in the original safe implementation to avoid exceptions from AsSpan (https://github.com/dotnet/coreclr/pull/22331#discussion_r252904254). ArrayTypeMismatchException is no longer a concern with the new unsafe implementation. There is a subtle behavior change in the actual type for co-variant arrays of reference types. However, the new behavior matches Array.Resize and it is very unlikely for any code out there to depend on this co-variant arrays corner case.

2 years ago[wasm][debugger] Support "on frame evaluation" of functions returning char (#65842)
Ilona Tomkowicz [Wed, 2 Mar 2022 13:03:10 +0000 (14:03 +0100)]
[wasm][debugger] Support "on frame evaluation" of functions returning char (#65842)

* Optional parameter fix.

* Working version of optional parameter support, requires refactoring.

* Refactored.

* Fixed failing tests.

* Add support to functions returning char, add test to an existing case.

* Simplified tests.

* Merged with optional params, uncommented char test

* Remove spaces.

* Applied @radical's suggestions.

* Removed indentation.

* Another indentation.

* Removed comment.

* Reverted type=char, as @radical suggested.

* Applied @radical's suggestions. No need for escaping + reverting original name.

2 years agoAvoid RegexCode/RegexWriter for all engines other than RegexInterpreter (#65986)
Stephen Toub [Wed, 2 Mar 2022 12:52:37 +0000 (07:52 -0500)]
Avoid RegexCode/RegexWriter for all engines other than RegexInterpreter (#65986)

* Avoid RegexCode/RegexWriter for all engines other than RegexInterpreter

* Address PR feedback

2 years agoMake DllImportGenerator emit a GeneratedCodeAttribute on our stubs (#65868)
Jeremy Koritzinsky [Wed, 2 Mar 2022 05:45:31 +0000 (21:45 -0800)]
Make DllImportGenerator emit a GeneratedCodeAttribute on our stubs (#65868)

2 years agoEE Suspension on x86 should use RtlRestoreContext when available (#65878)
Vladimir Sadov [Wed, 2 Mar 2022 04:21:51 +0000 (20:21 -0800)]
EE Suspension on x86 should use RtlRestoreContext when available (#65878)

* RestoreContextSimulated

* probe for RtlRestoreContext

* ntdll.dll

* restore self-trap sequence

* PR feedback

* Clarify CopyContext in RedirectedHandledJITCaseExceptionFilter

* simpler indentation.

* restore last error on the legacy path.

* Update src/coreclr/vm/threads.h

Co-authored-by: Dan Moseley <danmose@microsoft.com>
2 years ago[wasm] Update path to regex tests project, to be excluded for AOT (#66044)
Ankit Jain [Wed, 2 Mar 2022 04:06:31 +0000 (23:06 -0500)]
[wasm] Update path to regex tests project, to be excluded for AOT (#66044)

The project path changed in b4c746b7712e887af066d66d1ec777be6283f6f9,
causing the project to not get excluded on CI, and causing OOM failures
on rolling builds.

2 years agoRemove incorrect exception comment from AsSpan (#66051)
Fred Silberberg [Wed, 2 Mar 2022 03:05:12 +0000 (19:05 -0800)]
Remove incorrect exception comment from AsSpan (#66051)

This method never throws an `ArgumentNullException` for a null `text` input, and is even annotated as accepting `string?`.

2 years agoFix div-by-zero introduced in https://github.com/dotnet/runtime/pull/65926 (#66035)
Egor Bogatov [Wed, 2 Mar 2022 00:55:43 +0000 (03:55 +0300)]
Fix div-by-zero introduced in https://github.com/dotnet/runtime/pull/65926 (#66035)

2 years agoUpdate p/invoke source generator errors to use SYSLIB prefix (#65983)
Elinor Fung [Tue, 1 Mar 2022 22:24:04 +0000 (14:24 -0800)]
Update p/invoke source generator errors to use SYSLIB prefix (#65983)

2 years ago[hot_reload] various post-Preview 1 fixes (#65973)
Aleksey Kliger (λgeek) [Tue, 1 Mar 2022 21:17:38 +0000 (16:17 -0500)]
[hot_reload] various post-Preview 1 fixes (#65973)

* [debug] Handle gen-seq-points, and hot reload updates without PDBs

   When hot reload is used with dotnet watch, the baseline PDBs are available, and sequence points are enabled, but there are no PDB updates.

* [hot_reload] Fix off by one error

   when counting added and modified rows

* [hot_reload] Allow custom attribute deletions, even without ChangeCustomAttributes capability

   Roslyn seems to delete nullability annotations sometimes

* Add regression test for adding static lambdas

* param attributes for hot reload

* don't run test where it isn't supported

2 years ago[mono] Decompress ICU data during iOS/tvOS app startup (#64967)
imhameed [Tue, 1 Mar 2022 21:15:35 +0000 (16:15 -0500)]
[mono] Decompress ICU data during iOS/tvOS app startup (#64967)

This change adds support for decompressing ICU data files using the lzfse
decompressor built into Apple OSes.

If the data file path passed to `GlobalizationNative_LoadICUData` does not have
`.lzfse` as a suffix, then the contents of this file will be mapped into
shareable memory and passed directly to ICU.

Otherwise, the contents are decompressed using a fixed-size working buffer and
are stored inside a cache file with a name that contains a decimal encoded
representation of the originating compressed file's inode number, modification
time, and size. This filesystem metadata is extremely likely to change if the
contents of the source file ever changes, so there's no need to compute a
checksum of the data to determine if the cache is still valid. If a cache file
with an appropriate name is already present then it is mapped into shareable
memory and passed to ICU. Stale cache files (defined here to be any file with a
filename that ends with "-icudt.dat.uncompressed" that doesn't exactly match
the desired cache file name) are purged on startup.

`icudt.dat` for mobile is 2126 KiB right now; when compressed with lzfse it
shrinks to 675 KiB. On an iPhone SE 1st gen, this takes 4ms to decompress.

The "decompression framework" also supports lz4, zlib, and lzma. They are all
worse either in decompression time (lzma especially + zlib) or compression
ratio (lz4):

| Algorithm | icudt.dat compressed size | decompression time |
| --------- | ------------------------- | ------------------ |
| lz4       | 1031 KiB                  | 2.41 ms            |
| lzfse     | 675 KiB                   | 4.20 ms            |
| zlib      | 659 KiB                   | 9.61 ms            |
| lzma      | 427 KiB                   | 49.20 ms           |

I am not comfortable adding 50ms to app startup time. On this same
iPhone SE 1st gen, the "Contacts" app takes 166.7ms to display app-generated
pixels. This is end-to-end latency, from the first indication that iOS has
recognized my finger tap, to the display displaying any non-placeholder
content. This was measured with with a 240fps camera. A barebones
xamarin-macios app takes 125ms to display a "Hello world!" message.

This uses the filename's suffix to control decompression for simplicity, but it
would also be possible to instead frame compressed data with a very simple
header consisting of a long-enough magic number and a decompressed payload size
that can be used as a buffer sizing hint to the decompression loop.

Miscellany:
- On iOS, the cache-directory appears to be app-specific. Example: `/var/mobile/Containers/Data/Application/0C22E0D1-26CD-46CB-9EBC-6CF55B513ED1/Library/Caches/`.
- https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-pillai.pdf

2 years agoRevert "[mono][jit] Remove support for -O=-float32, i.e. treating r4 values as r8...
Zoltan Varga [Tue, 1 Mar 2022 20:09:47 +0000 (15:09 -0500)]
Revert "[mono][jit] Remove support for -O=-float32, i.e. treating r4 values as r8 on the IL stack. (#65740)" (#66006)

This reverts commit e069de8777bc7c972b898a5c31d80ca9e23bbbef.

2 years agoFastMod for EEHashTable (Faster virtual generics) (#65926)
Egor Bogatov [Tue, 1 Mar 2022 19:43:37 +0000 (22:43 +0300)]
FastMod for EEHashTable (Faster virtual generics) (#65926)

2 years ago[main] Update dependencies from dotnet/linker (#65844)
dotnet-maestro[bot] [Tue, 1 Mar 2022 19:43:20 +0000 (11:43 -0800)]
[main] Update dependencies from dotnet/linker (#65844)

* Update dependencies from https://github.com/dotnet/linker build 20220223.2

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22122.1 -> To Version 7.0.100-1.22123.2

* Update dependencies from https://github.com/dotnet/linker build 20220224.4

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22122.1 -> To Version 7.0.100-1.22124.4

* Update dependencies from https://github.com/dotnet/linker build 20220225.2

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22122.1 -> To Version 7.0.100-1.22125.2

* Update dependencies from https://github.com/dotnet/linker build 20220228.3

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22122.1 -> To Version 7.0.100-1.22128.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoKeep Obsolete and EditorBrowsable attributes consistent between ref and src and Defin...
Viktor Hofer [Tue, 1 Mar 2022 19:31:17 +0000 (20:31 +0100)]
Keep Obsolete and EditorBrowsable attributes consistent between ref and src and DefineConst clean-up (#65847)

* NET5_0_OR_GREATER, NET6_0_OR_GREATER -> NETCOREAPP

The minimum supported .NETCoreApp version in the repository is 6.0,
hence both defines can be replaced with the versionless NETCOREAPP one.
There is no need to version APIs below the minimum supported .NETCoreApp
version.

* Sync ObsoleteAttribute between ref and src

ApiCompat wasn't enabled to check if the ObsoleteAttribute is in sync
between the ref and the src assembly. Enabling it showed numerous
mismatches which this commit fixes.

Also making sure that the ApiCompat run that compares the live build
against the previous version of .NETCoreApp and .NETStandard2.x doesn't
complain about ObsoleteAttribute API changes as those are intentional.

* Sync EditorBrowsableAttribute between ref and src

The EditorBrowsableAttribute attribute wasn't enabled to be checked by
ApiCompat and in many cases there were mismatches. The most prominent
were InteropServices.

* HttpListenerContext pr feedback

* ResourceManager pr feedback

* Json PR feedback

* Fix cryptography PNSE build

2 years agoImprove nullability for TypeConverter.CanConvertTo (#63874)
Michael Ketting [Tue, 1 Mar 2022 18:43:17 +0000 (19:43 +0100)]
Improve nullability for TypeConverter.CanConvertTo (#63874)

The nullability of parameter 'destinationType' in
TypeConverter.CanConvertTo(...) was changed from
not-nullable to nullable during the development of .NET 6.

Since a destination type supported by this TypeConverter
can never be null, a NotNullWhenAttribute is added to the
'destinationType' parameter when the result value of
TypeConverter.CanConvertTo(...) is 'true'.

Fix #63186

2 years agoFix libraries GCStress pipeline (#65924)
Bruce Forstall [Tue, 1 Mar 2022 18:20:06 +0000 (10:20 -0800)]
Fix libraries GCStress pipeline (#65924)

* Remove reference to deleted setup-stress-dependencies.cmd/sh

Automatically download and copy coredistools.dll to the libraries testhost.

* Remove reference to setup-stress-dependencies.cmd/sh scripts

This is in the libraries gcstress pipeline.

It is no longer necessary.

* Set a huge timeout for GCStress

2 years agoNative aot trim annotations experiment (#65816)
Lakshan Fernando [Tue, 1 Mar 2022 17:31:05 +0000 (09:31 -0800)]
Native aot trim annotations experiment (#65816)

* Add nativeaot trim annotations experiment

* Fix mono libraries

* Update src/libraries/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* FB on attribute message

* FB

* missed nativeaot message change

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2 years ago[wasm] Fix a race condition in adding payloads for helix (#65995)
Ankit Jain [Tue, 1 Mar 2022 16:37:11 +0000 (11:37 -0500)]
[wasm] Fix a race condition in adding payloads for helix (#65995)

* [wasm] Fix a race condition in adding payloads for helix

The issue shows up only in Wasm.Build.Tests for the
`TestUsingWorkloads!=true` case, as `clang --version` failing with:

```
/datadisks/disk1/work/A0100914/p/build/emsdk/upstream/bin/clang: error while loading shared libraries: libLLVM-13git.so: cannot open shared object file: No such file or directory (TaskId:231)
```

For this non-workloads testing case, we copy `emscripten` from the
system copy to the git checkout. And then use that directory for the
payload.

The build logs show that the missing file (`libLLVM-13git.so`) does get
copied as part of copying `/usr/local/emscripten/emsdk` to
`$(RepoRoot)/src/mono/wasm/emsdk`. But the file, and a few others seem
to be missing in the final helix payload.

We add `emsdk` to the payload for target path `build/emsdk`.

But a recent change also added `node` for this case with a target path
`build/emsdk/node`, with an overlapping path with `build/emsdk`. I
believe this is causing an issue where these directories are being
processed in parallel, and cause some files get missed.

This commit:

1. Add `node` only when needed (skip WBT for example);
2. Use a non-overlapping path for `node`, `build/emsdk-node`.

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

* Change `_HelixLocalNodePath` evaluation order

Co-authored-by: Radek Doulik <radekdoulik@gmail.com>