platform/upstream/dotnet/runtime.git
3 years agoFix incomplete dumps generated by createdump (#49468)
Mike McLaughlin [Thu, 11 Mar 2021 18:48:02 +0000 (10:48 -0800)]
Fix incomplete dumps generated by createdump (#49468)

* Fix incomplete dumps generated by createdump

Issue: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1277488?src=WorkItemMention&src-action=artifact_link

* Code review feedback

3 years agoRemove serialization field from HashSet (#49483)
Stephen Toub [Thu, 11 Mar 2021 18:39:24 +0000 (13:39 -0500)]
Remove serialization field from HashSet (#49483)

Same as the approach taken in Dictionary.

3 years agoAdd Task.WaitAsync methods (#48842)
Stephen Toub [Thu, 11 Mar 2021 17:11:15 +0000 (12:11 -0500)]
Add Task.WaitAsync methods (#48842)

3 years agoFix silent bad codegen VSD possible tailcall converted to normal call (#49256)
Bruce Forstall [Thu, 11 Mar 2021 17:01:30 +0000 (09:01 -0800)]
Fix silent bad codegen VSD possible tailcall converted to normal call (#49256)

The problem was when a VSD interface call returning a multi-byte struct
in registers was initially considered to be a tailcall, but the tailcall
was abandoned in morph due to not enough stack space to store outgoing
arguments, in which case we create a new call return local to store the
return struct, and re-morph the call. In doing so, we forget that we had
already added VSD non-standard args, and re-add them, leaving the originally
added arg as a "normal" arg that shouldn't be there.

So, in summary, for a call A->B, to see this failure, we need:
1. The call is considered a potential tailcall (by the importer)
2. The call requires non-standard arguments that add call argument IR in
   fgInitArgInfo() (e.g., VSD call -- in this case, a generic interface call)
3. We reject the tailcall in fgMorphPotentialTailCall() (e.g., not enough
   incoming arg stack space in A to store B's outgoing args), in this case
   because the first arg is a large struct. We can't reject it earlier,
   due to things like address exposed locals -- we must get far enough
   through the checks to have called fgInitArgInfo() to add the extra
   non-standard arg.
4. B returns a struct in multiple registers (e.g., a 16-byte struct in
   Linux x64 ABI)

The fix is to remove the previously-added non-standard VSD argument IR when
we are preparing to re-morph a call.

There was one other location that was already doing this. I'm a little
worried that there are other places where the non-standard added IR is
not being considered when we clear out the arg info before remorphing.
It seems like there is some risk here. Probably, we should consider a
better way of handling the non-standard arg IR given the need in some
cases to re-morph calls.

I commented out a few cases of:
```
assert(!fgCanFastTailCall(call, nullptr));
```
because this function can call `fgInitArgInfo` which can alter the IR.
That seems dangerous in an assert, which should have any side-effects
like modifying the IR.

Fixes #49078

No SPMI asm diffs.

3 years agosuperpmi.py: Add support for Azure CLI authentication (#49272)
Bruce Forstall [Thu, 11 Mar 2021 17:00:05 +0000 (09:00 -0800)]
superpmi.py: Add support for Azure CLI authentication (#49272)

Azure CLI authentication is currently disabled (the current
unauthenticated mode will be used).

To use SuperPMI collections and JIT rolling builds after Azure
authentication is enabled, you will need to install the Azure CLI from:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

and then log in using `az login` before running any superpmi.py
commands.

3 years agoAdd iOS functional test for invariant culture only mode. (#49057)
Maxim Lipnin [Thu, 11 Mar 2021 15:17:39 +0000 (18:17 +0300)]
Add iOS functional test for invariant culture only mode. (#49057)

Contributes to #43865

1. ./build.sh mono+libs -os iOS -arch x64 -c Release
2. ./dotnet.sh build /t:Test src/tests/FunctionalTests/iOS/Simulator/InvariantCultureOnlyMode /p:TargetOS=iOS /p:TargetArchitecture=x64 /p:Configuration=Release

3 years agoConvert the 'if (Const < (uint)span.Length)' patterns to equivalent natural versions...
SingleAccretion [Thu, 11 Mar 2021 14:52:23 +0000 (17:52 +0300)]
Convert the 'if (Const < (uint)span.Length)' patterns to equivalent natural versions (#49450)

3 years agoEnable new CA1839 and CA1840 Environment rules (#49393)
Stephen Toub [Thu, 11 Mar 2021 11:50:25 +0000 (06:50 -0500)]
Enable new CA1839 and CA1840 Environment rules (#49393)

3 years agoAdd Android functional test for invariant culture only mode (#49204)
Maxim Lipnin [Thu, 11 Mar 2021 08:23:10 +0000 (11:23 +0300)]
Add Android functional test for invariant culture only mode (#49204)

Contributes to #43865

./build.sh mono+libs -os Android -arch x64 -c Release
./dotnet.sh build /t:Test src/tests/FunctionalTests/Android/Device_Emulator/InvariantCultureOnlyMode /p:TargetOS=Android /p:TargetArchitecture=x64 /p:Configuration=Release

3 years agoFix APICompat errors for atttributes on parameters (#49408)
Santiago Fernandez Madero [Thu, 11 Mar 2021 08:03:10 +0000 (00:03 -0800)]
Fix APICompat errors for atttributes on parameters (#49408)

3 years agoAdd an option to do zero byte reads on StreamPipeReader (#49117)
David Fowler [Thu, 11 Mar 2021 07:49:43 +0000 (23:49 -0800)]
Add an option to do zero byte reads on StreamPipeReader (#49117)

- Added UseZeroByteReads to StreamPipeReaderOptions that allows not allocating a buffer by doing a zero byte read on the underlying Stream before the internal buffer is allocated.

3 years agoFix marshaling in HostFXR API test (#49386)
Mateo Torres-Ruiz [Thu, 11 Mar 2021 07:22:29 +0000 (23:22 -0800)]
Fix marshaling in HostFXR API test (#49386)

* Marshal sizte_t as UIntPtr
Use CharSet.Auto

* PR feedback

3 years ago[AndroidCrypto] Add exception check to RsaVerificationPrimitive (#49443)
Elinor Fung [Thu, 11 Mar 2021 02:11:17 +0000 (18:11 -0800)]
[AndroidCrypto] Add exception check to RsaVerificationPrimitive (#49443)

* Add exception check to AndroidCryptoNative_RsaVerificationPrimitive

* Fix return error code

3 years agoDon't include windows PInvokes on Unix for System.Drawing (#49405)
Santiago Fernandez Madero [Thu, 11 Mar 2021 02:02:10 +0000 (18:02 -0800)]
Don't include windows PInvokes on Unix for System.Drawing (#49405)

* Don't include windows PInvokes on Unix for System.Drawing

* More interop cleanup to avoid building windows only codepaths on Unix

* Make lower range use handletreshold to make test more resilient

3 years agoUpdating snaps for March releases (#49462)
Rahul Bhandari [Wed, 10 Mar 2021 23:29:02 +0000 (15:29 -0800)]
Updating snaps for March releases (#49462)

* Updating snaps

* Updating snaps for March releases

3 years ago[mono][wasm][debugger] Implement conditional breakpoint (#48785)
Thays Grazia [Wed, 10 Mar 2021 23:02:23 +0000 (20:02 -0300)]
[mono][wasm][debugger] Implement conditional breakpoint (#48785)

* Implementing conditional breakpoint

* Adding tests

* Changing what @radical suggested

* Changing what @radical suggested.

* Changed what @radical suggested.

* Implement support to conditional breakpoints returning string.
Adding more tests.

* Changing tests to use TheoryData as suggested by @radical.

* Apply suggestions from code review

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years ago[wasm] Throw exception if culture data does not exist in icu (#47301)
Tammy Qiu [Wed, 10 Mar 2021 22:59:22 +0000 (17:59 -0500)]
[wasm] Throw exception if culture data does not exist in icu (#47301)

* Add check for culture data in ICU
Add PredefinedOnly GlobalizationMode
Modified tests if Culture Data not found
* Add test for predefined culture env var
* change assembly test data to pl-PL to avoid culturenotfound exception

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoAdd EnumBuilder.CreateType back in the public API (#49319)
Eric Erhardt [Wed, 10 Mar 2021 21:17:11 +0000 (15:17 -0600)]
Add EnumBuilder.CreateType back in the public API (#49319)

Fix #46681

3 years agoImprove liveness for 'STORE_BLK(lcl_var)'. (#48797)
Sergey Andreenko [Wed, 10 Mar 2021 20:15:25 +0000 (12:15 -0800)]
Improve liveness for 'STORE_BLK(lcl_var)'. (#48797)

* improve liveness for STORE_BLK

* Improve code for `RehomeArgForFastTailCall`.

* Delete an unnecessary change

While reviewing this change again I found that `fgMarkUseDef` should be called when we visit the local itself, the diffs that I saw from this change were because the LCL_VAR was not marked as `GTF_VAR_DEF`. Now the lclVar is marked as `GTF_VAR_DEF` so we don't need this extra logic.

3 years agoEventSource Feature switch type fix (#49432)
Lakshan Fernando [Wed, 10 Mar 2021 20:08:23 +0000 (12:08 -0800)]
EventSource Feature switch type fix (#49432)

* eh fix

* test change that inadvertently got checked in earlier

* Suppresses the trimmer warning on TypeAnalysis ctor

* Incorporating FB

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

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

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

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

* an earlier change got reverted

* fixed proj file netcore app condition check

* fixed NETCORE_ENGINEERING_TELEMETRY build failures

* fixeing another NETCORE_ENGINEERING_TELEMETRY build failures

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

* PR FB and suppressing warnings for safe calls

* propagated the warning all the way up

* CI build break fix for one file

* excluding NativeRTEventSrc from being build in a project

* Missed couple of supppressions on NativeRTEventSrc

* build break fixes

* EventSource feature switch type fix

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoSwitch MibcProfileParser to the ILReader plan (#49355)
Michal Strehovský [Wed, 10 Mar 2021 19:56:54 +0000 (20:56 +0100)]
Switch MibcProfileParser to the ILReader plan (#49355)

* Add ILReader from NativeAOT branch

* Use ILReader in MibcProfileParser

Co-authored-by: dotnet-bot <dotnet-bot@microsoft.com>
3 years agoAdd support for repeated XML elements without a name attribute (#44608)
Alexander Moerman [Wed, 10 Mar 2021 19:55:04 +0000 (20:55 +0100)]
Add support for repeated XML elements without a name attribute (#44608)

* Add support for repeated XML elements without a name attribute

This commit adds support in Microsoft.Extensions.Configuration.Xml for repeated XML elements without requiring a Name attribute.
This solves a particularly subtle bug when configuring Serilog from an XML configuration source. For a full description, see #36541

The original implementation of the XmlStreamConfigurationProvider has been modified to do the following:

- Maintain a stack of encountered XML elements while traversing the XML source. This is needed to detect siblings.
- When siblings are detected, automatically append an index to the generated configuration keys. This makes it work exactly the same as the JSON configuration provider with JSON arrays.

Tests are updated to reflect the new behavior:
- Tests that verified an exception occurs when entering duplicate keys have been removed. Duplicate keys are supported now.
- Add tests that verify duplicate keys result in the correct configuration keys, with all the lower/upper case variants and with support for the special "Name" attribute handling.

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
3 years agoAdd debugger displays / type proxies for Timer (#49100)
Stephen Toub [Wed, 10 Mar 2021 18:40:58 +0000 (13:40 -0500)]
Add debugger displays / type proxies for Timer (#49100)

Adds a private Timer.AllTimers property that can be used in the debugger to get a list of all timers, debugger display strings for Timer / TimerQueueTimer that help to make sense of the state in a timer and when it'll fire next, and debugger type proxies for Timer/TimerQueueTimer/TimerQueue to help when navigating state.

3 years ago[mono] Add missing opcodes for r4 to native int conversions (#49427)
Vlad Brezae [Wed, 10 Mar 2021 18:25:39 +0000 (20:25 +0200)]
[mono] Add missing opcodes for r4 to native int conversions (#49427)

3 years agoSuperpmi collection pipeline improvements (#49385)
Kunal Pathak [Wed, 10 Mar 2021 17:48:41 +0000 (09:48 -0800)]
Superpmi collection pipeline improvements (#49385)

* Do not pass --use-zapdisable to dotnet

But instead pass to individual CoreRun.exe that is launched during benchmark run. That way we do not slow down the launch of dotnet.exe process.

* Fail superpmi collection pipeline if there was no valid .mch files were found to merge

* Upload merged .mch files as zipped artifacts

TODO: Upload the superpmi.log from all the partition runs

* TEMP: New Jit guid

- Add new JIT guid so we don't overwrite the existing .mch files
- Disable all the runs except benchmarks

* add trailing path sep

* Upload superpmi.logs separately

* Use PublishPipelineArtifacts instead of upload artifacts

* properly pass zapdisable to CoreRun.exe

* Revert "TEMP: New Jit guid"

This reverts commit e89ef69625e4e57bb622fc35ff66d82f14b34285.

* Remove CoreClrTestBuildHost from benchmark run

* fix --envVars for benchmarks run

* add missing space

* temporary disable other runs

* Revert "temporary disable other runs"

This reverts commit 2926d1f582061eee6c7852046982ffb5107887b3.

3 years ago[AndroidCrypto] Check if DSA impl is disposed before setting key size. (#49382)
Jeremy Koritzinsky [Wed, 10 Mar 2021 17:48:11 +0000 (09:48 -0800)]
[AndroidCrypto] Check if DSA impl is disposed before setting key size. (#49382)

3 years ago[AndroidCrypto] Update X509Certificates tests to consume test files that don't use...
Elinor Fung [Wed, 10 Mar 2021 17:45:02 +0000 (09:45 -0800)]
[AndroidCrypto] Update X509Certificates tests to consume test files that don't use RC2 (#49399)

3 years agoBump timeout in runtime-dev-innerloop to 90min (#49439)
Viktor Hofer [Wed, 10 Mar 2021 17:40:20 +0000 (18:40 +0100)]
Bump timeout in runtime-dev-innerloop to 90min (#49439)

Mitigates reported issues: https://github.com/dotnet/runtime/issues/49309.

3 years agoFix a crash in llvm if the sreg of a setret is not set because the methods ends with...
Zoltan Varga [Wed, 10 Mar 2021 17:11:50 +0000 (12:11 -0500)]
Fix a crash in llvm if the sreg of a setret is not set because the methods ends with a throw. (#49122)

3 years ago[macOS-arm64] Disable failing libraries tests (#49400)
Steve MacLean [Wed, 10 Mar 2021 17:02:50 +0000 (12:02 -0500)]
[macOS-arm64] Disable failing libraries tests (#49400)

* Disable tests for XUnit crashes on Apple Silicon

* Apple Silicon Disable System.IO.MemoryMappedFiles.Tests

* Apple Silicon disable DirectoryServices.Protocols.Tests

* Apple Silicon disable Cryptography tests

M1 helix missing usable libssl

* Apple Silicon disable TestVirtualMemorySize64

* Apple Silicon disable ImportCollectionsFromContainerOnly

* Apple Silicon disable XmlWriterApi tests

* Fix whitespace

3 years agoimprove PriorityQueue documentation (#49392)
Eirik Tsarpalis [Wed, 10 Mar 2021 15:54:32 +0000 (15:54 +0000)]
improve PriorityQueue documentation (#49392)

3 years ago[wasm] Fix debugger tests (#49206)
Ankit Jain [Wed, 10 Mar 2021 14:52:35 +0000 (09:52 -0500)]
[wasm] Fix debugger tests (#49206)

* [wasm][debugger] Correctly skip static properties when iterating type

.. members.

* [wasm][debugger][tests] cleanup

* [wasm][debugger][tests] Use SingleLine for the logger

3 years ago[mono] Fix the emission of EnumEqualityComparer instances into the corlib AOT image...
Zoltan Varga [Wed, 10 Mar 2021 13:16:22 +0000 (08:16 -0500)]
[mono] Fix the emission of EnumEqualityComparer instances into the corlib AOT image. (#49402)

Add a few dummy enums to the Mono namespace in corlib, and use them
to create valid EnumEqualityComparer instances. Also make sure the
instances are actually emitted and not replaced by gsharedvt instances.

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

3 years agojitutils M2M renaming reaction (#49430)
Viktor Hofer [Wed, 10 Mar 2021 13:14:17 +0000 (14:14 +0100)]
jitutils M2M renaming reaction (#49430)

* jitutils M2M renaming reaction

* Update format.py

3 years agoWinHttpHandler: Read HTTP/2 trailing headers
Anton Firszov [Wed, 10 Mar 2021 10:54:22 +0000 (11:54 +0100)]
WinHttpHandler: Read HTTP/2 trailing headers

Fixes #44778

3 years ago[RyuJIT] Make casthelpers cold for sealed classes (#49295)
Egor Bogatov [Wed, 10 Mar 2021 06:36:43 +0000 (09:36 +0300)]
[RyuJIT] Make casthelpers cold for sealed classes (#49295)

3 years agoJIT: Non-void ThrowHelpers (#48589)
Egor Bogatov [Wed, 10 Mar 2021 06:36:04 +0000 (09:36 +0300)]
JIT: Non-void ThrowHelpers (#48589)

3 years agoUpdate package index for servicing (#49417)
Eric StJohn [Wed, 10 Mar 2021 05:33:19 +0000 (21:33 -0800)]
Update package index for servicing (#49417)

3 years agoRemove unnecessary check on polymorphic serialization (#48464)
David Cantú [Wed, 10 Mar 2021 03:11:17 +0000 (19:11 -0800)]
Remove unnecessary check on polymorphic serialization (#48464)

3 years agoRemove release build cron triggers from jitstress jobs (#49333)
Bruce Forstall [Wed, 10 Mar 2021 02:25:19 +0000 (18:25 -0800)]
Remove release build cron triggers from jitstress jobs (#49333)

We need to make per-preview decisions about when and how
frequently to run non-baseline jobs. We don't want the
existing configuration to automatically flow to new previews.

3 years ago[main] Update dependencies from dotnet/arcade dotnet/llvm-project dotnet/runtime...
dotnet-maestro[bot] [Wed, 10 Mar 2021 00:58:37 +0000 (00:58 +0000)]
[main] Update dependencies from dotnet/arcade dotnet/llvm-project dotnet/runtime-assets (#49359)

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

 - re-introduce publishing workaround

3 years agoImplement AppleCryptoNative_X509GetRawData using SecCertificateCopyData
Filip Navara [Wed, 10 Mar 2021 00:40:55 +0000 (01:40 +0100)]
Implement AppleCryptoNative_X509GetRawData using SecCertificateCopyData

3 years ago[AndroidCrypto] Support a zero-length salt for HMACs. (#49384)
Jeremy Koritzinsky [Wed, 10 Mar 2021 00:27:36 +0000 (16:27 -0800)]
[AndroidCrypto] Support a zero-length salt for HMACs. (#49384)

3 years agoUse managed implementation of pbkdf2 for Android's one-shot implementation. (#49314)
Jeremy Koritzinsky [Wed, 10 Mar 2021 00:26:31 +0000 (16:26 -0800)]
Use managed implementation of pbkdf2 for Android's one-shot implementation. (#49314)

3 years agoMake 303 redirects do GET like Net Framework (#49095)
TimothyByrd [Tue, 9 Mar 2021 23:29:00 +0000 (15:29 -0800)]
Make 303 redirects do GET like Net Framework (#49095)

* Make 303 redirects do GET like Net Framework

In Net Framework, PUT redirects on a 303 do a GET.
Net 5.0 breaks compatibility with this.
See https://github.com/dotnet/runtime/issues/28998
This commit causes redirects of a 303 to do a GET for all methods except HEAD.

Co-authored-by: Timothy Byrd <timothy.byrd@laserfiche.com>
3 years agoMake sure event generation is incremental (#48903)
Juan Hoyos [Tue, 9 Mar 2021 22:13:54 +0000 (14:13 -0800)]
Make sure event generation is incremental (#48903)

3 years agoAdd amd and Surface arm64 perf runs (#49389)
Drew Scoggins [Tue, 9 Mar 2021 22:06:18 +0000 (14:06 -0800)]
Add amd and Surface arm64 perf runs (#49389)

* Add better queue selection support

* Add logical machine to job name

* Add logical machine for Arm64 runs

* Fix log naming

3 years agoEnregister EH var that are single def (#47307)
Kunal Pathak [Tue, 9 Mar 2021 21:58:16 +0000 (13:58 -0800)]
Enregister EH var that are single def (#47307)

* Enable EhWriteThry for SingleDef

* If EhWriteThru is enabled, DoNotEnregister if variable is not singleDef

* Revert code in ExecutionContext.RunInternal

* Revert code in AsyncMethodBuildCore.Start()

* Make sure we do not reset lvSingleDef

* Consitent display of frame offset

misc change in superpmi.py

* Use lvEHWriteThruCandidate

* Do not enregister EH Var that has single use

* do not enregister simdtype

* add missing comments

* jit format

* revert an unintended change

* jit format

* Add missing comments

3 years agoReplace custom Marvin copy with string.GetHashCode (#48410)
Stephen Toub [Tue, 9 Mar 2021 21:33:05 +0000 (16:33 -0500)]
Replace custom Marvin copy with string.GetHashCode (#48410)

* Use HashCode instead of custom Marvin implementation

* Update src/libraries/System.Formats.Cbor/src/System/Formats/Cbor/CborConformanceLevel.cs

3 years agoDo not block folding of unsigned (and unordered) comparisons in value numbering ...
SingleAccretion [Tue, 9 Mar 2021 21:32:05 +0000 (00:32 +0300)]
Do not block folding of unsigned (and unordered) comparisons in value numbering (#48568)

* Do not block folding of unsigned comparisons in value numbering

* Handle unordered FP comparisons in ValueNumStore::EvalComparison

* Added coverage of evaluating unordered FP comparisons of constants in value numbering

* Do not block evaluation of unordered comparisons with NaNs in ValueNumStore::VNForFunc

* Added coverage of early folding logic for cgt.un.r4

* Added coverage of early folding logic for cgt.un.r8

* Added coverage of early folding logic for clt.un.r4

* Added coverage of early folding logic for clt.un.r8

* Improve placement of comments

* Added coverage of early folding logic for bge.un.r4

* Added coverage of early folding logic for bge.un.r8

* Added coverage of early folding logic for bgt.un.r4

* Added coverage of early folding logic for bgt.un.r8

* Added coverage of early folding logic for ble.un.r4

* Added coverage of early folding logic for ble.un.r8

* Added coverage of early folding logic for blt.un.r4

* Added coverage of early folding logic for blt.un.r8

* Added coverage of early folding logic for bne.un.r4

* Added coverage of early folding logic for bne.un.r8

3 years agoFix to release memory allocated by AllocHGlobal (#48059)
gekka [Tue, 9 Mar 2021 20:31:18 +0000 (05:31 +0900)]
Fix to release memory allocated by AllocHGlobal (#48059)

3 years ago[wasm] Add Wasm.Build tests, for testing wasm app builds (#47683)
Ankit Jain [Tue, 9 Mar 2021 19:01:38 +0000 (14:01 -0500)]
[wasm] Add Wasm.Build tests, for testing wasm app builds (#47683)

* [wasm] Add Wasm.Build tests, for testing wasm app builds

These tests will build wasm test projects, as part of each test method,
and run them.

Other library tests are run with `xharness`, and the test assembly is run
under wasm.  But here we want to run them with xunit, outside wasm. So,
this has different requirements for the helix payload, eg, the sdk,
xunit console runner etc.

To make it work, a new Scenario - `BuildWasmApps` is added, which emits
it's archives in a `buildwasmapps/` folder, which makes it easy to pick
up for the helix test run.

The tests are added under `src/tests/BuildWasmApps/Wasm.Build.Tests`, but
they use `Directory.Build*` from `src/libraries`, similar to how
FunctionalTests do it.

Another use case of this kinda scenario are the wasm debugger tests,
in which the individual test methods launch wasm apps, and then debug
them. (TBD)

Tests:

- The initial set of tests are just proof-of-concept, and more will be
  added once this is merged.

Note: The individual tests build test projects, and then run them with
`xharness`, under `v8`, and Chrome.

* [wasm] Disable il stripping completely

This uses `mono-cil-strip` from a mono installation. And in it's current
form it can cause issues, so disabling it for now.

* Bump helix timeout for tests from 30m to 60m

* [wasm] Cleanup builing RunScriptCommand

.. this allows supporting other properties from xunit*targets, eg. to
run a particular test `$(XUnitMethodName)`, which adds `-method foobar`
to the command line.

* [wasm] Fix timeout string, 00:60:00 to 01:00:00

* [wasm] Fix path to build support dir

* cleanup

* [wasm] fix InvariantGlobalization test

* [wasm] cleanup Wasm.Build.Tests.csproj

* [wasm] Add `include_aot` param for the test data

* [wasm] Enable verbose output for xunit

Instead of writing all the output to stdout also, use `-verbose` which
gives output like:

```
      Wasm.Build.Tests.WasmBuildAppTest.InvariantGlobalization(config: "Debug", aot: False, invariantGlobalization: null) [STARTING]
  ============== wasm test =============
  ============== wasm test-browser =============
      Wasm.Build.Tests.WasmBuildAppTest.InvariantGlobalization(config: "Debug", aot: False, invariantGlobalization: null) [FINISHED] Time: 8.6357275s
```

We log the detailed output to files anyway.

* [wasm] fix tests

* [wasm] Really enable verbose output for xunit, this time

* [wasm] Update tests to track the xharness fix for expected-exit-code

* [wasm] Bump browser job's timeout from 120 to 180 mins

* Improve comment

Co-authored-by: Mitchell Hwang <mitchhwang1418@gmail.com>
* Update eng/testing/tests.mobile.targets

Co-authored-by: Mitchell Hwang <mitchhwang1418@gmail.com>
* Remove unrelated commit

Instead, this is moved to a different AOT PR.

Revert "[wasm] Disable il stripping completely"

This reverts commit 25c2340a636be7d8973c09b6808a20466fdcd296.

* Revert "Remove unrelated commit"

This is needed because `mono-cil-strip` isn't available on helix. And we
want to disable cil stripping anyway.

This reverts commit ead13ee3d9c6d53a22b3c3051542057373c77b31.

Co-authored-by: Mitchell Hwang <mitchhwang1418@gmail.com>
3 years agoResolve ILLink warnings in System.ComponentModel.TypeConverter (Round 1) (#48890)
Eric Erhardt [Tue, 9 Mar 2021 18:49:25 +0000 (12:49 -0600)]
Resolve ILLink warnings in System.ComponentModel.TypeConverter (Round 1) (#48890)

* Resolve ILLink warnings in System.ComponentModel.TypeConverter (Round 1)

Contributes to #45623

* Update the AttributeCollection message

* Add trimming test for SimplePropertyDescriptor.IsReadOnly

* Update the ref source with DynamicallyAccessedMembers attributes

3 years agoIncrease timeout for thread pool tests (#49329)
Dan Moseley [Tue, 9 Mar 2021 18:35:51 +0000 (10:35 -0800)]
Increase timeout for thread pool tests (#49329)

Relates to #48236

It isn't possible to say whether the test is hung, or will complete but occasionally needs more than 30 seconds. Let's try increasing the cutoff to see.

3 years ago[metadata_update] Fix bounds check error (#49328)
Aleksey Kliger (λgeek) [Tue, 9 Mar 2021 17:34:38 +0000 (12:34 -0500)]
[metadata_update] Fix bounds check error (#49328)

The issue is that the STANDALONESIG bounds check was using a 0-based index, and
mono_metadata_bounds_check_slow was compensating by adding 1.

But that made another call to the bounds check fail: in
mono_class_from_typeref_checked we passed a 1-based index.  So in the case
where a TypeRef was using the last AssemblyRef in a delta, the bound check
would fail.

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

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
3 years agoEnable ICU on iOS (#48606)
Steve Pfister [Tue, 9 Mar 2021 17:17:52 +0000 (12:17 -0500)]
Enable ICU on iOS (#48606)

3 years agoReset assignedInterval during verifyFinalAllocation (#49286)
Kunal Pathak [Tue, 9 Mar 2021 17:00:42 +0000 (09:00 -0800)]
Reset assignedInterval during verifyFinalAllocation (#49286)

* Unassign register for RefTypeDef if it is not assigned register

Fix failures exposed by EHWriteThru:

https://dev.azure.com/dnceng/public/_build/results?buildId=1021926&view=ms.vss-test-web.build-test-results-tab&runId=31791570&resultId=180705&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab

https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-47307-head-ad03bd78ebf7456dbe/System.Memory.Tests/console.387c2cf0.log?sv=2019-07-07&se=2021-03-24T01%3A36%3A31Z&sr=c&sp=rl&sig=hPD%2B625ykQtQRVKnl3pCZzTEiI5hXzrqZtIPgo6Wc74%3D

* Fix more asserts for spillAfter/Def where assignedInterval was not reset

Fixes errors like this:

https://dev.azure.com/dnceng/public/_build/results?buildId=1024357&view=ms.vss-test-web.build-test-results-tab&runId=31848698&resultId=181011&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab

https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-47307-head-2f177492e7644d448d/System.Management.Tests/console.5337e574.log?sv=2019-07-07&se=2021-03-25T09%3A27%3A01Z&sr=c&sp=rl&sig=aBfB4tstmjMyucEadkhaFxtWdog3teT32PvzPAS4Vv4%3D

* jit format

3 years agoJIT: update jit config defaults for PGO (#49267)
Andy Ayers [Tue, 9 Mar 2021 16:35:15 +0000 (08:35 -0800)]
JIT: update jit config defaults for PGO (#49267)

Enable edge profiling by default, when jitting, or when prejitting for R2R.
Keep block profiling there for classic ngen (so there is an entry probe).

Enable minimal probing by default, when jitting. Keep full probing there for
prejitting so presence of counts in a method implies method was executed.

Enable class profiling by default when jitting. Still TBD if we will also
do this when prejitting.

Enable guarded devirtualization by default (will only kick in for PGO).

Adjust experimental CI legs to reflect the above.

Net effect is that when jitting, COMPlus_TieredPGO=1 turns on dynamic PGO
with the expected set of behaviors, without any other options.

We'll still need to set COMPlus_TC_QuickJitForLoops=1 to have methods with
loops pass through Tier0.

3 years agoFix pgo ci bugs (#49349)
David Wrighton [Tue, 9 Mar 2021 16:10:24 +0000 (08:10 -0800)]
Fix pgo ci bugs (#49349)

* Fix null reference in pgo data merging

* Additional fixes found in CI usage of dotnet-pgo tool

3 years agoInclude timeout value in Regex cache key (#49352)
Stephen Toub [Tue, 9 Mar 2021 14:41:09 +0000 (09:41 -0500)]
Include timeout value in Regex cache key (#49352)

Static Regex methods use a cache of recently used regexes.  We currently include in the key for that cache whether a timeout value was specified, since whether there's a timeout can impact how the regex is built, but we don't currently include the actual value of the timeout.  This leads to oddities where if the same pattern, culture, and options are used with a static regex method and one non-infinite timeout, and then those exact same values are used with a different non-infinite timeout, and then original data was still in the cache, we'll end up using the previous timeout value rather than the new timeout value.  The fix is just to include the timeout itself in the key.

3 years agoFix access mode of memory-mapped apphost (#49341)
Mateo Torres-Ruiz [Tue, 9 Mar 2021 14:39:27 +0000 (06:39 -0800)]
Fix access mode of memory-mapped apphost (#49341)

* Use read access on apphost memory mapped file

* Add test

3 years agoSync shared crossgen2 files (#49302)
Michal Strehovský [Tue, 9 Mar 2021 14:37:13 +0000 (15:37 +0100)]
Sync shared crossgen2 files (#49302)

3 years agoFix link in covariant-return-methods.md (#49356)
lindexi [Tue, 9 Mar 2021 11:47:00 +0000 (19:47 +0800)]
Fix link in covariant-return-methods.md (#49356)

3 years ago[interp] Stop generating code in the cbb if the inlined method always throws (#49344)
Vlad Brezae [Tue, 9 Mar 2021 09:45:54 +0000 (11:45 +0200)]
[interp] Stop generating code in the cbb if the inlined method always throws (#49344)

3 years agoChange package names without interior dir names (#49202)
Andy Gocke [Tue, 9 Mar 2021 08:53:29 +0000 (00:53 -0800)]
Change package names without interior dir names (#49202)

* Change package names without interior dir names

The previous renaming properly renamed the package, but also renamed
the nested folder in the dotnet-runtime zip to Microsoft.NETCore.App.PGO,
which created problems with integration with the installer. This should
fix that by creating packages with a changed name without altering the contents.

* Test change without renaming host package

* Only set property when pgoinstrument is set

* Missed .Runtime package

* Code review comments

3 years agoFix EC key file import tests (#49253)
Jeremy Koritzinsky [Tue, 9 Mar 2021 07:29:15 +0000 (23:29 -0800)]
Fix EC key file import tests (#49253)

* Fix cofactor import and disable tests that require the ability to derive a new public key from a private key + curve + generator, order, and cofactor.

* Add missing member.

* Disable more tests against CanDeriveNewPublicKey.

* Use isSupported instead of ConditionalFact.

* Fix net47 build.

3 years agoRemove no longer needed `usenmakemakefiles` option (#49327)
Bruce Forstall [Tue, 9 Mar 2021 05:51:14 +0000 (21:51 -0800)]
Remove no longer needed `usenmakemakefiles` option (#49327)

After https://github.com/dotnet/jitutils/pull/318, we no longer
need this option.

3 years agoMove test_fx_ver under test folder (#49313)
Elinor Fung [Tue, 9 Mar 2021 03:46:53 +0000 (19:46 -0800)]
Move test_fx_ver under test folder (#49313)

3 years ago[AndroidCrypto] Add certs that don't use RC2 in test data (#49312)
Elinor Fung [Tue, 9 Mar 2021 03:46:36 +0000 (19:46 -0800)]
[AndroidCrypto] Add certs that don't use RC2 in test data (#49312)

3 years agoFix null reference in pgo data merging (#49326)
David Wrighton [Tue, 9 Mar 2021 02:06:18 +0000 (18:06 -0800)]
Fix null reference in pgo data merging (#49326)

Profile schema data can be null, handle both cases correctly in merge algorithm

3 years agoRe-enable windows JIT formatting jobs (#49025)
Bruce Forstall [Tue, 9 Mar 2021 01:08:41 +0000 (17:08 -0800)]
Re-enable windows JIT formatting jobs (#49025)

Addresses https://github.com/dotnet/runtime/issues/40034

3 years agoEnable CheckDownloadedFiles on DownloadBuildArtifacts task (#49321)
Santiago Fernandez Madero [Tue, 9 Mar 2021 00:43:07 +0000 (16:43 -0800)]
Enable CheckDownloadedFiles on DownloadBuildArtifacts task (#49321)

3 years agoSuppresses the trimmer warning on TypeAnalysis ctor (#48823)
Lakshan Fernando [Mon, 8 Mar 2021 22:40:58 +0000 (14:40 -0800)]
Suppresses the trimmer warning on TypeAnalysis ctor (#48823)

* eh fix

* test change that inadvertently got checked in earlier

* Suppresses the trimmer warning on TypeAnalysis ctor

* Incorporating FB

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

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

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

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

* an earlier change got reverted

* fixed proj file netcore app condition check

* fixed NETCORE_ENGINEERING_TELEMETRY build failures

* fixeing another NETCORE_ENGINEERING_TELEMETRY build failures

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

* PR FB and suppressing warnings for safe calls

* propagated the warning all the way up

* CI build break fix for one file

* excluding NativeRTEventSrc from being build in a project

* Missed couple of supppressions on NativeRTEventSrc

* build break fixes

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoFix some issues from consuming RSA and ECDiffieHellman in certs on Android
Elinor Fung [Mon, 8 Mar 2021 20:39:21 +0000 (12:39 -0800)]
Fix some issues from consuming RSA and ECDiffieHellman in certs on Android

3 years agoDo not bundle mscordaccore.dll in a singlefile package. (#49254)
Vladimir Sadov [Mon, 8 Mar 2021 20:16:38 +0000 (12:16 -0800)]
Do not bundle mscordaccore.dll in a singlefile package. (#49254)

3 years agoFix https://github.com/dotnet/runtime/issues/46698. (#49293)
Zoltan Varga [Mon, 8 Mar 2021 20:10:03 +0000 (15:10 -0500)]
Fix https://github.com/dotnet/runtime/issues/46698. (#49293)

3 years agoUpdate dependencies from https://github.com/dotnet/runtime build 20210307.6 (#49296)
dotnet-maestro[bot] [Mon, 8 Mar 2021 15:51:14 +0000 (15:51 +0000)]
Update dependencies from https://github.com/dotnet/runtime build 20210307.6 (#49296)

[main] Update dependencies from dotnet/runtime

3 years agoReplace a couple FormatterServices uses in DataContractSerialization (#49290)
Stephen Toub [Mon, 8 Mar 2021 15:46:24 +0000 (10:46 -0500)]
Replace a couple FormatterServices uses in DataContractSerialization (#49290)

3 years agoRule number correction (#49288)
CadenJi [Mon, 8 Mar 2021 11:39:08 +0000 (19:39 +0800)]
Rule number correction (#49288)

3 years agoReduce the size of the pipe (#49270)
David Fowler [Mon, 8 Mar 2021 06:58:05 +0000 (22:58 -0800)]
Reduce the size of the pipe (#49270)

- Use the pipe itself as the synchronization object
- Store the options instance as a way to reference shared settings
- Added a field to PipeOptions for storing if the Pool is the ArrayPool implementation of the MemoryPool
- Shrink PipeAwaitable in the common case
  - Move the ExecutionContext and SynchronizationContext into a typed called the SchedulingContext. These types are mostly used with async await and it's extremely rare to have to capture any of this state.
- Shrink the size of PipeCompletion
  - Since completion callbacks are deprecated they are rarely set. We remove the pool and the other fields and just store a list (which should be rarely used now).
- Reduce the default segment pool size to 4 items = 16K buffered
  - The original size was optimized to avoid pool resizes but we need to balance idle memory and the potential resize cost of the resize.

3 years agoLog the reason for importer's decision to reject the tail call in the dump (#49280)
SingleAccretion [Mon, 8 Mar 2021 05:48:48 +0000 (08:48 +0300)]
Log the reason for importer's decision to reject the tail call in the dump (#49280)

3 years agofix proxy detection for websockets on Windows (#48734)
Tomas Weinfurt [Mon, 8 Mar 2021 00:57:49 +0000 (16:57 -0800)]
fix proxy detection for websockets on Windows (#48734)

* fix proxy detection for websockets on Windows'

* feedback from review

3 years agoApply feedback to grow methods of generic collections (#49167)
Eirik Tsarpalis [Mon, 8 Mar 2021 00:56:02 +0000 (00:56 +0000)]
Apply feedback to grow methods of generic collections (#49167)

* Apply feedback to Grow methods of generic collections

* add assertion

3 years agoImprove zero-byte read handling in SslStream to reduce memory usage (#49123)
Geoff Kizer [Sun, 7 Mar 2021 21:02:28 +0000 (13:02 -0800)]
Improve zero-byte read handling in SslStream to reduce memory usage (#49123)

* add ZeroByteRead_PerformsZeroByteReadOnUnderlyingStreamWhenDataNeeded to stream conformance tests

* remove dead code

* change SslStream zero byte read implementation to issue zero-byte read on underlying stream when appropriate

* ensure buffer is always freed when not needed, and assert this

* create StreamConformanceTests assembly and reference from appropriate test projects

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoSpeed up interface checking and casting (#49257)
Ben Adams [Sun, 7 Mar 2021 19:54:19 +0000 (19:54 +0000)]
Speed up interface checking and casting (#49257)

* Reduce branches in IsInstanceOfInterface/ChkCastInterface

* Drop extra var, lea; additional check for small counts

* Feedback

* Undo IsInstanceOfClass change

* Tidy usings

3 years agoFix Activity.ParentId trace flags part (#49162)
Tarek Mahmoud Sayed [Sun, 7 Mar 2021 00:45:10 +0000 (16:45 -0800)]
Fix Activity.ParentId trace flags part (#49162)

3 years agoFix inverted active issues (#49265)
Steve MacLean [Sat, 6 Mar 2021 22:10:29 +0000 (17:10 -0500)]
Fix inverted active issues (#49265)

3 years agoJIT: update non-null assertion prop to destructure VNs (#49238)
Andy Ayers [Sat, 6 Mar 2021 19:15:50 +0000 (11:15 -0800)]
JIT: update non-null assertion prop to destructure VNs (#49238)

In addition to checking for assertions based on the VN of an address, try and
destructure the VN to find the "base" address, and check its VNs as well.

This lets us get rid of some extra null checks, typically ones that are at
an offset from an existing non-null pointer.

Closes #49180.

3 years ago[AndroidCrypto] Implement DSA import/export and signing/verification. (#49153)
Jeremy Koritzinsky [Sat, 6 Mar 2021 11:58:54 +0000 (03:58 -0800)]
[AndroidCrypto] Implement DSA import/export and signing/verification. (#49153)

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
3 years agoAdd DataflowBlock.ReceiveAllAsync extension method (#37876)
Emmanuel André [Sat, 6 Mar 2021 11:56:24 +0000 (12:56 +0100)]
Add DataflowBlock.ReceiveAllAsync extension method (#37876)

3 years agoUpdate debug dump template after runfo update to include dumps (#49183)
Santiago Fernandez Madero [Sat, 6 Mar 2021 05:15:29 +0000 (21:15 -0800)]
Update debug dump template after runfo update to include dumps (#49183)

* Update debug dump template after runfo update to include dumps

* Fix workitem param and generate a dump command per dump found

* PR Feedback

3 years agoJIT: fix prejit entry PGO instrumentation (#49154)
Andy Ayers [Sat, 6 Mar 2021 02:49:34 +0000 (18:49 -0800)]
JIT: fix prejit entry PGO instrumentation (#49154)

Don't assume the entry block is `fgFirstBB`. Make sure to put the
entry probe in the scratch bb.

Closes #49108.

3 years agoMove scenario to float (#49255)
Drew Scoggins [Sat, 6 Mar 2021 01:39:30 +0000 (17:39 -0800)]
Move scenario to float (#49255)

* Remove version parsing

* Remove version macro from yml file

3 years agoAdd pip upgrade step inside venv to fix crypto issue (#49250)
Drew Scoggins [Fri, 5 Mar 2021 23:12:06 +0000 (15:12 -0800)]
Add pip upgrade step inside venv to fix crypto issue (#49250)

3 years agoDo not create R2R in memory hashes if profiler is not present or hasn't added types...
David Mason [Fri, 5 Mar 2021 23:04:56 +0000 (15:04 -0800)]
Do not create R2R in memory hashes if profiler is not present or hasn't added types (#49177)

* only create lazy map if profiler added types

* also don't create for ApplyMetadata if they haven't added new types

* add check to skip call if no profiler was called

* Update src/coreclr/vm/ceeload.cpp

Co-authored-by: Brian Robbins <brianrob@microsoft.com>
Co-authored-by: Brian Robbins <brianrob@microsoft.com>
3 years ago[AndroidCrypto] Implement IExportPal for X509 certs (#49196)
Elinor Fung [Fri, 5 Mar 2021 22:55:26 +0000 (14:55 -0800)]
[AndroidCrypto] Implement IExportPal for X509 certs (#49196)

3 years agoAllow using SupportedOSPlatform, UnsupportedOSPlatform attributes on interfaces ...
Buyaa Namnan [Fri, 5 Mar 2021 22:38:08 +0000 (14:38 -0800)]
Allow using SupportedOSPlatform, UnsupportedOSPlatform attributes on interfaces  (#48838)

* Allow OSPlatform attributes for interfaces

3 years agoSerialize Dns async-over-sync requests for the same host (#49171)
Stephen Toub [Fri, 5 Mar 2021 21:15:30 +0000 (16:15 -0500)]
Serialize Dns async-over-sync requests for the same host (#49171)

* Serialize Dns async-over-sync requests for the same host

* Update src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs

3 years agoCapture Reverse P/Invoke frame offset in x86 GC info and disallow return hijacking...
Jeremy Koritzinsky [Fri, 5 Mar 2021 21:05:32 +0000 (13:05 -0800)]
Capture Reverse P/Invoke frame offset in x86 GC info and disallow return hijacking of reverse P/Invokes on x86. (#49066)

* Capture Reverse P/Invoke frame offset in x86 GC info and disallow return hijacking of reverse P/Invokes on x86.

* Check reverse p/invoke frame in exception handling.

* Fix formatting.

* Change sentinel values since 0 is a valid offset for the reverse P/Invoke frame variable.

* Fix decoding setting flip to actually flip the new sentinel values.

3 years ago[AndroidCrypto] Make RC2 transform explicitly throw PlatformNotSupportedException...
Elinor Fung [Fri, 5 Mar 2021 20:53:53 +0000 (12:53 -0800)]
[AndroidCrypto] Make RC2 transform explicitly throw PlatformNotSupportedException (#49195)