platform/upstream/dotnet/runtime.git
3 years agoClean up JSON source gen APIs (#54527)
Layomi Akinrinade [Fri, 25 Jun 2021 23:09:23 +0000 (16:09 -0700)]
Clean up JSON source gen APIs (#54527)

* Clean up JSON source gen APIs

* Address review feedback

* Simplify GenerateX computation

3 years agoFix handling of static virtual method implementation checking (#54710)
David Wrighton [Fri, 25 Jun 2021 22:06:22 +0000 (15:06 -0700)]
Fix handling of static virtual method implementation checking (#54710)

- It turns out that GetMethodDescFromMemberDefOrRefOrSpec and FindOrCreateAssociatedMethodDesc are not safe to use on a MemberRef whent  the associated MethodTable is not fully loaded.
- Instead only use that feature when working with a MethodDef or a fully loaded type, and when working with a not fully loaded type, use MemberLoader::FindMethod instead.
- When running the resolution algorithm for doing constraint validation, it also is not necessary to fully resolve to the exact correct MethodDesc, which as that process uses FindOrCreateAssociatedMethodDesc needs to be avoided.
- The above was not evident as in many cases, the validation algorithm did not run as it was misplaced and located directly before the call to SetIsFullyLoaded. That code path is only followed if the type is able to fully load without circular dependencies. (Test case CuriouslyRecurringGenericWithUnimplementedMethod added to cover that scenario)
- In addition, while investigating these issues, I realized we were lacking checks that the constraints on the impl and decl method were not checked at during type load, but that work was instead deferred to dispatch time. Along with the constraint check there was also a set of accessibility checks that had been missed that are common to all MethodImpl handling. Fix by adding tweaking the logic to share most of that code.

3 years agoFix thread safety of _typeRefsInCompilationModuleSet (#54760)
David Wrighton [Fri, 25 Jun 2021 22:05:56 +0000 (15:05 -0700)]
Fix thread safety of _typeRefsInCompilationModuleSet (#54760)

3 years agoTweak classcompat loader to skip MethodImpls associated with static methods (#54658)
David Wrighton [Fri, 25 Jun 2021 18:10:50 +0000 (11:10 -0700)]
Tweak classcompat loader to skip MethodImpls associated with static methods (#54658)

3 years agoFix BackoutJitData (#54711)
Jan Vorlicek [Fri, 25 Jun 2021 17:06:37 +0000 (19:06 +0200)]
Fix BackoutJitData (#54711)

* Fix BackoutJitData

The RemoveJitData that the BackoutJitData calls requires the code
header to be copied to the final location. This change fixes it.

I've also found that in one of my previous changes, I've accidentally
enabled jitting into a scratch buffer by default by adding the
FEATURE_WXORX define unconditionally. So I am removing it in this change
for non Apple Silicon, it will be replaced by a dynamic check whether W^X
is enabled in the final W^X change.

3 years ago[mono][jit] Refactor the generic sharing code a bit. NFC. (#54705)
Zoltan Varga [Fri, 25 Jun 2021 16:55:02 +0000 (12:55 -0400)]
[mono][jit] Refactor the generic sharing code a bit. NFC. (#54705)

* [jit] Refactor the emit_rgctx code a bit.

* Add an enum to specify the way the rgctx is accessed from a gshared method.
Use it to simplify some logic.

3 years agoRevert "[wasm] browser http response stream could be seekable (#54603)" (#54742)
Pavel Savara [Fri, 25 Jun 2021 14:14:54 +0000 (16:14 +0200)]
Revert "[wasm] browser http response stream could be seekable (#54603)" (#54742)

This reverts commit c139d00640485e8c231c54d1573dc02d7c9e8daf.

3 years ago[wasm] browser http response stream could be seekable (#54603)
Pavel Savara [Fri, 25 Jun 2021 08:56:28 +0000 (10:56 +0200)]
[wasm] browser http response stream could be seekable (#54603)

- browser http response stream could be seekable
- test WebAssemblyEnableStreamingResponse

3 years agoOverride more Stream members on System.IO.Compression streams (#54518)
Stephen Toub [Fri, 25 Jun 2021 07:35:29 +0000 (03:35 -0400)]
Override more Stream members on System.IO.Compression streams (#54518)

3 years ago[main] Update dependencies from 9 repositories (#54543)
Přemek Vysoký [Fri, 25 Jun 2021 07:07:51 +0000 (09:07 +0200)]
[main] Update dependencies from 9 repositories (#54543)

3 years agoFix CQ regression & correctness bug in morphing of long muls (#53566)
SingleAccretion [Fri, 25 Jun 2021 06:37:09 +0000 (09:37 +0300)]
Fix CQ regression & correctness bug in morphing of long muls (#53566)

* Add a test covering GTF_MUL_64RSLT transform

* Disable the test on Mono

* Add genActualTypeIsInt helper

* Add some gtFlags helpers

* Prepare decomposition for new long muls

* Update gtIsValid64RsltMul

To understand the new format for long muls.

* Rework morphing of long muls

Previously, morph was looking for the exact pattern of
MUL(CAST(long <- int), CAST(long <- int)) when assessing
candidacy of GT_MUL for being marked with "GTF_MUL_64RSLT" and
emitted as "long mul".

This worked fine, until the importer was changed to fold
all casts with constant operands. This broke the pattern
matching and thus all MULs in the form of (long)value * 10
started being emitted as helper calls.

This change updates morph to understand the new folded casts
and in general updates the "format" of long mul from
"CAST * CAST" to "CAST * (CAST | CONST)".

In the process, new helper functions have been introduced, to
avoid bloating fgMorphSmpOp with the new sizeable logic.

Recognition of overflowing cases has been upgraded, and a correctness
bug, where "checked((long)uint.MaxValue * (long)uint.MaxValue)"
was wrongly treated as non-overflowing, fixed.

Additionally, the logic to emit intermediate NOPs has been
changed to instead always skip morphing the casts themselves,
even when remorphing.

* Add the script to generate the longmul test

The test itself has been regenerated using it and
there were no diffs, as expected.

3 years agoEliminate chained casts to small types (#52561)
SingleAccretion [Fri, 25 Jun 2021 06:32:54 +0000 (09:32 +0300)]
Eliminate chained casts to small types (#52561)

We can take advantage of the implicit zero/sign-extension for
small integer types and eliminate some casts.

3 years agoOptimize `CAST(int <- long)` on 32 bit targets (#53040)
SingleAccretion [Fri, 25 Jun 2021 06:32:44 +0000 (09:32 +0300)]
Optimize `CAST(int <- long)` on 32 bit targets (#53040)

* Optimize CAST(int <- long) on 32 bit targets

* Revert "Optimize CAST(int <- long) on 32 bit targets"

Revert the implementation in lowering

* Optimize CAST(int <- long) on 32 bit targets

Move the code from lowering to long decomposition.

* Fixed the "Arguments" note for DecomposeNode

* Added the function header

For OptimizeCastFromDecomposedLong.

* Remove the TODO comment

While correct, it has questionable value.

* Add a more detailed dump output

* Do not try to optimize checked casts

It is easy to get it wrong. Let the frontend handle this.

* Do not depend on tree order

Previous version of the code assumed that there could be
no nodes between the cast and its operand. That is not
a correct assumption to make in LIR.

3 years agoMove the metadata update related APIs to the MetadataUpdater class (#54590)
Mike McLaughlin [Fri, 25 Jun 2021 05:54:28 +0000 (22:54 -0700)]
Move the metadata update related APIs to the MetadataUpdater class (#54590)

Move the metadata update related APIs to the MetadataUpdater class

The old APIs AssemblyExtensions.ApplyUpdate() and AssemblyExtensions.GetApplyUpdateCapabilities() will be removed
after all the references to them have been changed to the new APIs.

Add the new IsSupported API described in issue https://github.com/dotnet/runtime/issues/51159.

Change the tests to use the MetadataUpdater APIs.

Fix the ApplyUpdate qcalls and icalls

Add the ILLink substitutions for MetadataUpdater.IsSupported property

Change the old APIs to call the new ones

Update mono's MetadataUpdater.IsSupported property

Update feature switch doc

Fixed the argument checking in coreclr's MetadataUpdater.ApplyUpdate().

3 years agoS.N.Quic made private (#54610)
Marie Píchová [Fri, 25 Jun 2021 04:37:07 +0000 (06:37 +0200)]
S.N.Quic made private (#54610)

Note this will need reaction on ASP.NET side.

3 years agoDisallow promotion of HVA structs when their fields of TYP_SIMD8 were promoted as...
Egor Chesakov [Fri, 25 Jun 2021 03:26:08 +0000 (20:26 -0700)]
Disallow promotion of HVA structs when their fields of TYP_SIMD8 were promoted as plain structs (#54694)

3 years ago[wasm][debugger] Detect initial status of pause on exceptions. (#54040)
Thays Grazia [Fri, 25 Jun 2021 01:21:57 +0000 (22:21 -0300)]
[wasm][debugger] Detect initial status of pause on exceptions. (#54040)

* Detect initial status of pause on exceptions.

* Changing what @radical suggested.

* Changing more things.

* Test case created.
I could not test the pause on "all" exceptions because if I enable the pause on caught exceptions and reload the page it will stop in a lot of exceptions other then the one that I inserted in AttachToTarget.

* Adding a test for Reload page with ALL set.

* Fixing merge conflicts.

* setting icordebug = false.

* Removing unrelated change.

3 years agodefMAC construction up a scope to make it live long enough. (#54702)
Jeremy Koritzinsky [Thu, 24 Jun 2021 23:40:40 +0000 (16:40 -0700)]
defMAC construction up a scope to make it live long enough. (#54702)

Fixes #54649

3 years agoFix MonoCrossAOT.UnixFilePermissions for wasm (#54693)
Steve Pfister [Thu, 24 Jun 2021 23:19:11 +0000 (19:19 -0400)]
Fix MonoCrossAOT.UnixFilePermissions for wasm (#54693)

* Fix MonoCrossAOT.UnixFilePermissions for wasm

We introduced Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml in https://github.com/dotnet/runtime/pull/54501 to make sure the right permissions are set when installing AOT compiler workload packs.  We hardcoded the list to include mono-aot-cross, llc, and opt.  However, in wasm's case they only have mono-aot-cross.

This change makes the xml file a template and only includes mono-aot-cross for browser and all three for the other configurations.

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

* Use property instead of item for the file nodes

* Ankit suggestion

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
3 years agoMark AssemblyDependencyResolver as unsupported on Browser and mobile (#54601)
Maxim Lipnin [Thu, 24 Jun 2021 21:01:06 +0000 (00:01 +0300)]
Mark AssemblyDependencyResolver as unsupported on Browser and mobile (#54601)

* Mark AssemblyDependencyResolver as unsupported on Browser and mobile

* Apply AlekseyK's workaround to fix android CI builds

* Add an annotation for maccatalyst

3 years ago[mono] Implement Rdm and Dp (#49737)
imhameed [Thu, 24 Jun 2021 20:56:27 +0000 (13:56 -0700)]
[mono] Implement Rdm and Dp (#49737)

See https://github.com/dotnet/runtime/issues/42322 and
https://github.com/dotnet/runtime/issues/42280.

Tested manually on an arm64 Linux VM running on an M1 Mac Mini. Does not
enable RDM or DP when AOT-compiling the associated runtime tests; our CI
hardware doesn't support these extensions yet.

3 years agoPass the default ALC gchandle to the v3 preload hook (#54686)
Aleksey Kliger (λgeek) [Thu, 24 Jun 2021 20:56:12 +0000 (16:56 -0400)]
Pass the default ALC gchandle to the v3 preload hook (#54686)

* Pass the default ALC gchandle to the v3 preload hook

Fixes crashes early during startup when the gchandle is then used by the hooks
to call mono API functions.  The default ALC exists, but its managed object
doesn't, so the gchandle target is null.  The mono APIs detect the the special
gchandle and resolve it to the default ALC

Example crash
https://gist.github.com/grendello/b4ab24587a055725cc5e1416b86ad7ca

* [alc] Assert that we never see a null target from a managed ALC gchandle

3 years agoAdd ActivitySource support to DiagnosticsHandler (#54437)
Miha Zupan [Thu, 24 Jun 2021 20:45:52 +0000 (13:45 -0700)]
Add ActivitySource support to DiagnosticsHandler (#54437)

* Add ActivitySource support to DiagnosticsHandler

* Use ActivitySource as another enabled condition

* Make IsGloballyEnabled a property

* Simplify enabled check

* Revert using the exception filter

* Update HTTP ILLink.Substitutions.xml

3 years agoAdd CustomAttributes ApplyUpdate Capability (#54619)
Tom McDonald [Thu, 24 Jun 2021 20:17:39 +0000 (13:17 -0700)]
Add CustomAttributes ApplyUpdate Capability (#54619)

* Add CustomAttributes ApplyUpdate Capability

* Rename CustomAttributes ChangeCustomAttributes per #54284

3 years agoSupport synchronous Stream-based serialization methods (#54632)
Steve Harter [Thu, 24 Jun 2021 19:35:35 +0000 (14:35 -0500)]
Support synchronous Stream-based serialization methods (#54632)

3 years agoAdd args descriptions for VNF_MapStore and VNF_MapSelect (#54108)
SingleAccretion [Thu, 24 Jun 2021 19:34:08 +0000 (22:34 +0300)]
Add args descriptions for VNF_MapStore and VNF_MapSelect (#54108)

3 years agoEnsure relocation blocks are 4-byte aligned (#54668)
Anton Lapounov [Thu, 24 Jun 2021 19:09:36 +0000 (12:09 -0700)]
Ensure relocation blocks are 4-byte aligned (#54668)

3 years ago[mono][wasm] Reenable the remove finally pass. (#54450)
Zoltan Varga [Thu, 24 Jun 2021 19:05:15 +0000 (15:05 -0400)]
[mono][wasm] Reenable the remove finally pass. (#54450)

* [mono][wasm] Reenable the remove finally pass.

* [mono][wasm] Run methods which need stack walks using the interpreter instead of pushing an LMF.

* Disable vtype based sharing for vtypes with explicit sizes.

3 years agoRemove CoffeeFlux from CODEOWNERS (#54696)
Ryan Lucia [Thu, 24 Jun 2021 18:56:04 +0000 (14:56 -0400)]
Remove CoffeeFlux from CODEOWNERS (#54696)

3 years ago[wasm][debugger] Fixing debugger tests errors (#54664)
Thays Grazia [Thu, 24 Jun 2021 18:36:56 +0000 (15:36 -0300)]
[wasm][debugger] Fixing debugger tests errors (#54664)

* Fixing new debugger tests errors.
Errno is not being assigned anymore.

DebuggerTests.SetVariableValueTests

* Passing icordbg flag as false.

* Adding new tests.

3 years agoAdd non-LLVM iOS size scenario (#54585)
Bill Wert [Thu, 24 Jun 2021 17:46:31 +0000 (10:46 -0700)]
Add non-LLVM iOS size scenario (#54585)

* Add non-LLVM iOS size scenario

* add category

* remove parens

* variables in the wrong place.

* move setting configs to before it is written

3 years agoFix instruction hex display (#54675)
Jakob Botsch Nielsen [Thu, 24 Jun 2021 17:25:54 +0000 (19:25 +0200)]
Fix instruction hex display (#54675)

3 years ago[QUIC] Add Windows version check to QUIC initialization (#54488)
Natalia Kondratyeva [Thu, 24 Jun 2021 17:24:56 +0000 (19:24 +0200)]
[QUIC] Add Windows version check to QUIC initialization (#54488)

Add Windows version check to QUIC initialization, log min supported and current Windows version

3 years agoFix Activator.CreateInstance(GetType(), ...) related ILLink warnings in (#54680)
Krzysztof Wicher [Thu, 24 Jun 2021 17:20:36 +0000 (19:20 +0200)]
Fix Activator.CreateInstance(GetType(), ...) related ILLink warnings in (#54680)

System.Data.Common

3 years agoDisable MacCatalyst arm64 PR test runs on staging pipeline (#54678)
Alexander Köplinger [Thu, 24 Jun 2021 15:43:55 +0000 (17:43 +0200)]
Disable MacCatalyst arm64 PR test runs on staging pipeline (#54678)

We don't have enough capacity right now on Helix to handle the load.

3 years ago[WASM] Fix async/await in config loading (#54652)
Daniel Genkin [Thu, 24 Jun 2021 15:39:04 +0000 (11:39 -0400)]
[WASM] Fix async/await in config loading (#54652)

* Fixed config issue

* Updated Hot Reload test

3 years agoFix for heap_use_after_free flagged by sanitizer (#54679)
monojenkins [Thu, 24 Jun 2021 15:33:14 +0000 (11:33 -0400)]
Fix for heap_use_after_free flagged by sanitizer (#54679)

Copy of https://github.com/mono/mono/pull/21120

Co-authored-by: dseshadri <dseshadri@users.noreply.github.com>
3 years ago[wasm] Bump emscripten to 2.0.23 (#53603)
Radek Doulik [Thu, 24 Jun 2021 15:20:26 +0000 (17:20 +0200)]
[wasm] Bump emscripten to 2.0.23 (#53603)

Bumps emscripten to 2.0.23

The Browser AOT tests now use `-Wl,-lto-O0` option to reduce memory usage of `wasm-ld` tool, which was in some cases going over avaiable 8GB on helix machines.

* Revert "Add ActiveIssue to the MemoryMappedFiles tests"

This reverts commit ec1ae530606ef1061680600fc046226cc1c4cbc3.

* Revert "Add ActiveIssue attr to the FileSystem tests"

This reverts commit 356b3ff2a703980ac01b9df697a594e8c341c436.

* Bump emscripten version to 2.0.23

* Use newer docker images with 2.0.23

* Update docs

* Use 2.0.23 emscripten nuget packages

* Revert "Revert "Add ActiveIssue attr to the FileSystem tests""

This reverts commit eb2f9548b08c114b359fab8d867ba50de098fe48.

The fix is not present in 2.0.23

* Revert "Revert "Add ActiveIssue to the MemoryMappedFiles tests""

This reverts commit 8be39f583499a8d8451034c65260a785330b0795.

The fix is not present in 2.0.23

* Increase timeout for AOT tests

* Add description of emscripten bump to README

* Try to get information about resources

* Get all limits

* Escape & chars

* Reduce platform matrix

* Lets try one more build with doubled timeout

* Revert "Lets try one more build with doubled timeout"

This reverts commit 67dd7754bb79218b2c6b687034162d041715093e.

* Try -Wl,-O0 on CI

To be sure it behaves the same as in local build

* Use -Wl,-lto-O0 do lower link time optimization

It looks like it reduces the memory load a lot

* Set EmccLinkOptimizationFlag for AOT tests

And reset the default value

* Escape commas

* Revert "Reduce platform matrix"

This reverts commit fec0e557208eb165824e75cd57b895a74d164de4.

* Remove resource info retrieval

* Bump emsdk versions

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoFix compiler references when building inside VS (#54614)
Viktor Hofer [Thu, 24 Jun 2021 14:46:39 +0000 (16:46 +0200)]
Fix compiler references when building inside VS (#54614)

If for a source project a contract project exists, then the contract project's TargetPath should be passed to the compiler. This is handled by the SDK by default when `ProduceReferenceAssembly` is true. As dotnet/runtime doesn't use the `ProduceReferenceAssembly` feature yet, a custom target adds the necessary `ReferenceAssembly` metadata to the `TargetPathWithTargetPlatformMoniker` item which then is transformed to references for the compiler. That works fine on the CLI as the `GetTargetPathWithTargetPlatformMoniker` target runs after the ProjectReference to the ContractProject is resolved and its target path is available.
Inside VS the target ordering is different and the `ResolvedMatchingContract` item was empty as the ProjectReference to the contract wasn't yet resolved. The fix for that is to add a dependency onto the `ResolveProjectReferences` target to guarantee that the `ResolvedMatchingContract` item is populated in time.

Noticed this when the build of System.ComponentModel.Composition.Registration failed because the implementation assembly of System.ComponentModel.Composition was passed to the compiler instead of the reference assembly.

3 years agoprocess more TLS frames at one when available (#50815)
Tomas Weinfurt [Thu, 24 Jun 2021 14:31:07 +0000 (16:31 +0200)]
process more TLS frames at one when available (#50815)

* process more TLS frames when available

* add SslStream.Implementation.cs

* remove extra comment

* add back DefaultRequestHeaders_SentUnparsed

* feedback from review

* fix winhttp

* fix linker test

* feedback from review

* feedback from review

* feedback from review

* make EnsureFullTlsFrame async

* feedback from review

3 years agoAdd PeriodicTimer (#53899)
Stephen Toub [Thu, 24 Jun 2021 14:24:47 +0000 (10:24 -0400)]
Add PeriodicTimer (#53899)

3 years agoUdpClient with span support (#53429)
LateApexEarlySpeed [Thu, 24 Jun 2021 12:30:55 +0000 (20:30 +0800)]
UdpClient with span support (#53429)

Add API from #864

3 years agoexclude fragile tests (#54671)
Pavel Savara [Thu, 24 Jun 2021 12:06:06 +0000 (14:06 +0200)]
exclude fragile tests (#54671)

3 years agoget last error before calling a method that might fail as well (#54667)
Adam Sitnik [Thu, 24 Jun 2021 10:38:53 +0000 (12:38 +0200)]
get last error before calling a method that might fail as well (#54667)

3 years ago[FileStream] add tests for device and UNC paths (#54545)
Adam Sitnik [Thu, 24 Jun 2021 06:58:33 +0000 (08:58 +0200)]
[FileStream] add tests for device and UNC paths (#54545)

* add a test for unseekable device by using a path to named pipe

* add a test for seekable device by using DeviceID instead of drive letter

* add a test for a UNC file path (local file share)

3 years agoFix sporadic double fd close (#54660)
Dan Moseley [Thu, 24 Jun 2021 04:35:39 +0000 (22:35 -0600)]
Fix sporadic double fd close (#54660)

Fix https://github.com/dotnet/runtime/issues/54589

3 years agoRemove Version.Clone from AssemblyName.Clone (#54621)
Stephen Toub [Thu, 24 Jun 2021 04:00:01 +0000 (00:00 -0400)]
Remove Version.Clone from AssemblyName.Clone (#54621)

Version is immutable.

3 years ago[wasm] Enable fixed libraries tests (#54641)
Radek Doulik [Thu, 24 Jun 2021 03:52:40 +0000 (05:52 +0200)]
[wasm] Enable fixed libraries tests (#54641)

Fixed by https://github.com/dotnet/runtime/pull/52705 and
https://github.com/dotnet/runtime/pull/52707

3 years ago[wasm] Fix blazor/aot builds (#54651)
Ankit Jain [Thu, 24 Jun 2021 02:29:00 +0000 (22:29 -0400)]
[wasm] Fix blazor/aot builds (#54651)

`dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0-preview.7.21321.15\Sdk\WasmApp.Native.targets(342,5): error : Could not find AOT cross compiler at $(_MonoAotCrossCompilerPath)=`

Make sure this is set for the aot path.

3 years ago[mono][wasm] Fix compilation error on wasm (#54659)
Thays Grazia [Thu, 24 Jun 2021 01:49:43 +0000 (22:49 -0300)]
[mono][wasm] Fix compilation error on wasm (#54659)

3 years agoFix telemetry for Socket connects to Dns endpoints (#54071)
Miha Zupan [Thu, 24 Jun 2021 00:21:42 +0000 (17:21 -0700)]
Fix telemetry for Socket connects to Dns endpoints (#54071)

3 years ago[wasm] Build static components; include hot_reload in runtime (#54568)
Aleksey Kliger (λgeek) [Thu, 24 Jun 2021 00:13:37 +0000 (20:13 -0400)]
[wasm] Build static components; include hot_reload in runtime (#54568)

* [wasm] Build static components; include hot_reload in runtime

   Workaround until https://github.com/dotnet/runtime/issues/54565 is fixed
   Build the runtime always with support for hot_reload, and without diagnostics_tracing

* Update wasm.proj

* Add a browser functional test for hot reload

   Just check that the capabilities are non-empty which is a good proxy for hot reload being enabled in the runtime.

* Turn off trimming for hot reload functional test

* Disable test on browser AOT

* fix whitespace

Co-authored-by: Thays Grazia <thaystg@gmail.com>
3 years ago[wasm][debugger] Reuse debugger-agent on wasm debugger (#52300)
Thays Grazia [Wed, 23 Jun 2021 23:06:58 +0000 (20:06 -0300)]
[wasm][debugger] Reuse debugger-agent on wasm debugger (#52300)

* Trying to reuse debugger-agent on wasm debugger. This will remove a lot of code that does the same thing on mini-wasm-debugger.

* Replace remove_breakpoint and clear_all_breakpoints with the ones on debugger-agent and remove unused code.

* Stepping and callstack using debugger-agent.

* Remove more code.

* Get frame values using debugger-agent.

* Working valuetypes and call function on valuetypes.
make -C src/mono/wasm/ run-debugger-tests TEST_FILTER=DebuggerTests.SteppingTests.InspectValueTypeMethodArgsWhileStepping is working without use_cfo.

* Failed:   316, Passed:   175

* Failed:   307, Passed:   184, Skipped:     0, Total:   491

* Failed:   280, Passed:   211

* Failed:   277, Passed:   214

* Implemented boxed value.
Failed:   271, Passed:   220

* Implementing get properties on objects.
Implementing handling error on debugger-agent.

* Implementing callfunctionon object.
Failed:   248, Passed:   243

* Implementing get pointer values.
Failed:   243, Passed:   248

* Fixing pointer values and implement call on function with pointers.
Failed:   226, Passed:   265

* Reimplement call function on, and implement set values.
Failed:   192, Passed:   299

* Failed:   192, Passed:   299

* Fixing valuetype with null values.

Failed:   184, Passed:   307

* Implemented Evaluate expressions, conditional breakpoints, all breakpoints tests are passing.
Failed:   172, Passed:   319

* Fixing evaluate with value type.
Failed:   156, Passed:   335

* Trim part and add cache.
Failed:   148, Passed:   343

* Fixing evaluate expression.
Failed:    99, Passed:   392

* GetPropertiesTests working.

Failed:    53, Passed:   438

* Passing delegate tests.
Failed:    31, Passed:   460

* Removing unused code.

* Implementing exception handler.
Failed:    30, Passed:   461

* Fixing cfo returning array.
Removing more code.
Removing 2 tests that tests functions which does not exist anymore.
Failed:    18, Passed:   471

* Fix CallFunctionOn returning primitive types and null.

Failed:     9, Passed:   480

* Failed:     7, Passed:   482

* Fixing some tests.
Failed:     2, Passed:   488

* Removing a lot of code.
Failed:     4, Passed:   485

* 0 ERRORS!

* Removing more code.
No errors.

* Fixing added tests.

* Return javascript callstack after managed callstack.
Step out from managed code return to native wasm or javascript.
Adding debug info to Wasm.Browser.Sample to help testing debugger with sample.

* Change what Ankit suggested.
Clear cache with valuetypes and pointers after resume or step.

* Fixing suggestions.

* Fix error on wasm build.

* Apply suggestions from code review

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Changing what was suggested by @lewing.

* Fix pointer tests.

* Refactoring CreateJObjectForVariableValue

* Changing what @lewing suggested.

* Apply suggestions from code review

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Update src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Update src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Fixing @lewing changes.

* Trying to fix CI.

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoPut Crossgen2 in sync with #54235 (#54438)
Tomáš Rylek [Wed, 23 Jun 2021 21:39:28 +0000 (23:39 +0200)]
Put Crossgen2 in sync with #54235 (#54438)

3 years agoMove System.Object serialization to ObjectConverter (#54436)
Eirik Tsarpalis [Wed, 23 Jun 2021 21:37:17 +0000 (00:37 +0300)]
Move System.Object serialization to ObjectConverter (#54436)

* move System.Object serialization to ObjectConverter

* simply customized object converter test

3 years agoMove setting fHasVirtualStaticMethods out of sanity check section (#54574)
Tomáš Rylek [Wed, 23 Jun 2021 21:24:06 +0000 (23:24 +0200)]
Move setting fHasVirtualStaticMethods out of sanity check section (#54574)

3 years ago[wasm] Compile .bc->.o in parallel, before passing to the linker (#54053)
Ankit Jain [Wed, 23 Jun 2021 16:53:56 +0000 (12:53 -0400)]
[wasm] Compile .bc->.o in parallel, before passing to the linker (#54053)

3 years agoChange PathInternal.IsCaseSensitive to a constant (#54340)
Aleksey Kliger (λgeek) [Wed, 23 Jun 2021 13:44:41 +0000 (09:44 -0400)]
Change PathInternal.IsCaseSensitive to a constant (#54340)

* Return constants in PathInternal.GetIsCaseSensitive() on mobile platforms

   In particular on Android probing using I/O is slow and contributes to slow app startup.

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

* Implement Path.IsCaseSensitive as PathInternal.IsCaseSensitive

   Also Path.StringComparison => PathInternal.StringComparison

* Add test for PathInternal.IsCaseSensitive

   Move GetIsCaseSensitiveByProbing to FileSystemTest

* Drop PathInternal.s_isCaseSensitive cache field

* Delete Path.IsCaseSensitive and Path.StringComparison

   update callers to use PathInternal.IsCaseSensitive and PathInternal.StringComparison

* Remove catch clause from GetIsCaseSensitiveByProbing

* Mark new test [OuterLoop]

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoMake mono_polling_required a public symbol (#54592)
Steve Pfister [Wed, 23 Jun 2021 13:38:02 +0000 (09:38 -0400)]
Make mono_polling_required a public symbol (#54592)

Resolves build failure with the Android aot+llvm functional test

3 years agoRespect EventSource::IsSupported setting in more codepaths (#51977)
Marek Safar [Wed, 23 Jun 2021 12:56:44 +0000 (14:56 +0200)]
Respect EventSource::IsSupported setting in more codepaths (#51977)

3 years agoRoot ComActivator for hosting (#54524)
Lakshan Fernando [Wed, 23 Jun 2021 12:11:42 +0000 (05:11 -0700)]
Root ComActivator for hosting (#54524)

* rooting ComActivator that is needed for hosting

* FB

3 years agoAdd ILLink annotations to S.D.Common related to DbConnectionStringBuilder (#54280)
Krzysztof Wicher [Wed, 23 Jun 2021 12:02:37 +0000 (14:02 +0200)]
Add ILLink annotations to S.D.Common related to DbConnectionStringBuilder (#54280)

* Add ILLink annotations to S.D.Common related to DbConnectionStringBuilder

* address some feedback

* Make GetEvents() safe

* make GetProperties safe

* Mark GetProperties with RUC

3 years agoFix finalizer issue with regions (#54550)
Peter Sollich [Wed, 23 Jun 2021 10:09:38 +0000 (12:09 +0200)]
Fix finalizer issue with regions (#54550)

This fixes an issue in Server GC where an item in the finalizer queue became stale due to not being relocated.

The problem was that a finalizable object was allocated on one heap, but registered in the finalizer queue of another heap (this is possible due to heap balancing). In CFinalize::UpdatePromotedGenerations, we ask for the generation of an object, and move the object to the correct section of the finalizer queue. In the error case, we obtained the wrong result for the generation of the object because it lived on another heap, and that heap hadn't set the final generation for the region containing the object yet. So we ended up moving the finalizer entry to the section corresponding to gen 2, and missed a relocation of the object occurring in a gen 1 collection afterwards.

Fix: It seems best to make sure an object is always registered for finalization on the heap it's allocated from, so the fix simply fetches the heap from the alloc context after the allocation in the case of SOH, or determines it by calling gc_heap::heap_of in the case of LOH and POH. In the case of SOH, I added an assert to ensure that the heap obtained agrees with the result of calling gc_heap::heap_of.

I also added some dprintf calls to the finalizer logic to aid in future investigations.

3 years agoAdd support for multi-arch install locations (#53763)
Mateo Torres-Ruiz [Wed, 23 Jun 2021 07:19:10 +0000 (00:19 -0700)]
Add support for multi-arch install locations (#53763)

* Add support for multiple architectures inside install_locations

* Add install_location tests

* Fallback to DOTNET_ROOT on win32

3 years agoUpdate library testing docs page to reduce confusion (#54324)
Noah Falk [Wed, 23 Jun 2021 07:00:47 +0000 (00:00 -0700)]
Update library testing docs page to reduce confusion (#54324)

* Add warning on unmaintained testing doc page

* Update testing.md

Some example text that seems more clear to me, but only offered as a suggestion.
Feel free to adjust it or if you want to use it as-is please double check what I wrote is accurate : )

I think the useful elements are:
1. Being explicit about what workflow steps need to happen in total
2. Being explicit about which commands are covering the entire workflow and which ones are only covering a part of it
3. Show the simple "do-it-all" options first before showing more complex partial options. Glancing at the first example and blindly copying it should land in the pit of success.

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years ago[FileStream] handle UNC and device paths (#54483)
Adam Sitnik [Wed, 23 Jun 2021 06:53:55 +0000 (08:53 +0200)]
[FileStream] handle UNC and device paths (#54483)

* stop using NtCreateFile as there is no public and reliable way of mapping DOS to NT paths

3 years agoUpdate NetAnalyzers version (#54511)
Stephen Toub [Wed, 23 Jun 2021 06:34:38 +0000 (02:34 -0400)]
Update NetAnalyzers version (#54511)

* Update NetAnalyzers version

* Add NetAnalyzers to dependency flow

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoAdded runtime dependency to fix the intermittent test failures (#54587)
Daniel Genkin [Wed, 23 Jun 2021 04:46:38 +0000 (00:46 -0400)]
Added runtime dependency to fix the intermittent test failures (#54587)

* Added runtime dependency to hopefully fix the intermittent test failures

* addressed comments

* cleanup

* cleanup accidental spaces and tabs cleanup

* added Larry's comments

3 years agoDisable failing System.Reflection.Tests.ModuleTests.GetMethods (#54564)
Bruce Forstall [Wed, 23 Jun 2021 04:42:14 +0000 (21:42 -0700)]
Disable failing System.Reflection.Tests.ModuleTests.GetMethods (#54564)

Tracking: https://github.com/dotnet/runtime/issues/50831

3 years ago[wasm] Move AOT builds from `runtime-staging` to `runtime` (#54577)
Ankit Jain [Wed, 23 Jun 2021 03:46:33 +0000 (23:46 -0400)]
[wasm] Move AOT builds from `runtime-staging` to `runtime` (#54577)

These builds have had ~2-3 failures in the last 14 days (~90 builds).

3 years agoKeep obj node for ArrayIndex. (#54584)
Sergey Andreenko [Wed, 23 Jun 2021 01:58:23 +0000 (18:58 -0700)]
Keep obj node for ArrayIndex. (#54584)

3 years agoDisable another failing MemoryCache test (#54578)
Dan Moseley [Wed, 23 Jun 2021 01:08:12 +0000 (19:08 -0600)]
Disable another failing MemoryCache test (#54578)

3 years agoSet DLL flag on R2R binaries (#54533)
Anton Lapounov [Tue, 22 Jun 2021 22:45:36 +0000 (15:45 -0700)]
Set DLL flag on R2R binaries (#54533)

This is required for R2R relocations to be processed by the OS loader on Windows 7.

3 years agoAdd `SkipEnabledCheck` on `LoggerMessageAttribute` (#54305)
Maryam Ariyan [Tue, 22 Jun 2021 21:25:36 +0000 (17:25 -0400)]
Add `SkipEnabledCheck` on `LoggerMessageAttribute` (#54305)

* Add SkipEnabledCheck on LoggerMessageAttribute
* Make logging generator more robust with null input
* Adds LoggerMessageAttribute ctor overload
* properly identify misconfigured input

3 years agoImprove performance of IsRootScope check (#54555)
David Fowler [Tue, 22 Jun 2021 21:07:54 +0000 (14:07 -0700)]
Improve performance of IsRootScope check (#54555)

- Stash a field instead of doing an equality comparison.

Fixes #54351

3 years agoFix a memory corruption caused by an integer overflow (#54510)
Andrew Au [Tue, 22 Jun 2021 20:28:59 +0000 (13:28 -0700)]
Fix a memory corruption caused by an integer overflow (#54510)

3 years agoget rid of an unnecessary join (#54312)
Maoni Stephens [Tue, 22 Jun 2021 20:27:31 +0000 (13:27 -0700)]
get rid of an unnecessary join (#54312)

I think this join was left there by accident when we were doing the write watch feature. I'm puzzled why I didn't notice it. the comment was also inconsistent which strengthens my belief that this was a mistake. we don't need a join here (there used to not be a join) and disabling the dirty pages tracking can be done anywhere while the EE is stopped since write barriers cannot be invoked.

3 years agoDisable failing test BasicTestWithMcj under GCStress (#54566)
Bruce Forstall [Tue, 22 Jun 2021 20:12:05 +0000 (13:12 -0700)]
Disable failing test BasicTestWithMcj under GCStress (#54566)

Tracking: https://github.com/dotnet/runtime/issues/54203

3 years ago[Android] Fix AndroidAppBuilder to work w/ AOT+LLVM (#53643)
Steve Pfister [Tue, 22 Jun 2021 19:00:17 +0000 (15:00 -0400)]
[Android] Fix AndroidAppBuilder to work w/ AOT+LLVM (#53643)

We were missing a few key additions to make sure we can test against AOT+LLVM. This change will make sure we link against all the .dll-llvm.o files produced from the AOT compiler and include the right mtriple for each architecture.

Fixes #53628

3 years ago[mono]Re-enable runtime tests on Android arm64 (#49662)
Fan Yang [Tue, 22 Jun 2021 17:36:57 +0000 (13:36 -0400)]
[mono]Re-enable runtime tests on Android arm64 (#49662)

* Re-enable runtime tests on Android arm64

* disable irrelevant CI lanes

* Disable more dotnet-linker-tests and runtime-dev-innerloop CI lanes

* Comment out definition for DISABLE_LOGGING

* Remove defining logging for android

* Extend app installation timeout limit

* Fix command prefix for windows

* Enable tests excluded only for Android arm64

* Disable failed test on arm64

* Revert hacks

* Revert unintended changes

* More...

* Only run tests on arm64 for rolling build

* Fix merge error

3 years agoDisable failing tests under GCStress (#54532)
Bruce Forstall [Tue, 22 Jun 2021 16:57:09 +0000 (09:57 -0700)]
Disable failing tests under GCStress (#54532)

https://github.com/dotnet/runtime/issues/51477
https://github.com/dotnet/runtime/issues/53359

3 years agoImport the correct MacCatalyst workload pack (#54558)
Steve Pfister [Tue, 22 Jun 2021 16:44:55 +0000 (12:44 -0400)]
Import the correct MacCatalyst workload pack (#54558)

In https://github.com/dotnet/runtime/pull/54361 there was an incorrect import of the maccatalyst aot workload pack.  This fix corrects the problem.

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

3 years ago[wasm] Collect, and process satellite assemblies automatically (#53656)
Ankit Jain [Tue, 22 Jun 2021 16:35:38 +0000 (12:35 -0400)]
[wasm] Collect, and process satellite assemblies automatically (#53656)

3 years agoFail COM CoClass creation during construction instead of during jitting (#54508)
Jeremy Koritzinsky [Tue, 22 Jun 2021 16:32:53 +0000 (09:32 -0700)]
Fail COM CoClass creation during construction instead of during jitting (#54508)

3 years agoFix deadlock (#54426)
Andrew Au [Tue, 22 Jun 2021 16:00:43 +0000 (09:00 -0700)]
Fix deadlock (#54426)

3 years agoFix XML in Version.Details.xml
Stephen Toub [Tue, 22 Jun 2021 13:44:28 +0000 (09:44 -0400)]
Fix XML in Version.Details.xml

3 years ago[WIP][wasm][testing] remote loop network tests via xharness and websocket (#54289)
Pavel Savara [Tue, 22 Jun 2021 13:02:45 +0000 (15:02 +0200)]
[WIP][wasm][testing] remote loop network tests via xharness and websocket (#54289)

Makes it possible to run LoopbackServer tests with WASM
- conditional compilation of LoopbackServer via #if TARGET_BROWSER
- minimal implementation of WebSocketStream for the unit tests
- simple SocketWrapper class to abstract Socket and WebSocket close/dispose/shutdown
- added handling of CORS headers and pre-flight requests as necessary

- new xharness web server middleware
- adding it to helix payload

3 years agoRevert "[main] Update dependencies from 9 repositories (#54218)" (#54541)
Přemek Vysoký [Tue, 22 Jun 2021 11:20:02 +0000 (13:20 +0200)]
Revert "[main] Update dependencies from 9 repositories (#54218)" (#54541)

This reverts commit 04ad80aff37e2ef5eac0cc6d2a895ccf0f9d65a3.

3 years ago[main] Update dependencies from 9 repositories (#54218)
dotnet-maestro[bot] [Tue, 22 Jun 2021 09:53:13 +0000 (09:53 +0000)]
[main] Update dependencies from 9 repositories (#54218)

[main] Update dependencies from 9 repositories

 - Merge branch 'main' into darc-main-b0a81754-f267-416d-a8e2-cf56f8c1ee3e

 - PInvoke warnings fixes for OOB assemblies

 - Update testPackages.proj

 - Update testPackages.proj

 - Update dependencies from https://github.com/dotnet/arcade build 20210621.1

 - Merge branch 'main' into darc-main-b0a81754-f267-416d-a8e2-cf56f8c1ee3e

Conflicts:
eng/Version.Details.xml
eng/Versions.props

 - Fix xml

 - Update dependencies from https://github.com/dotnet/xharness build 20210622.2

3 years agoArPow stage 1: local source-build infrastructure (#53294)
Michael Simons [Tue, 22 Jun 2021 08:14:07 +0000 (03:14 -0500)]
ArPow stage 1: local source-build infrastructure (#53294)

* Initial arcade-powered source-build infra

* Add patches, fixup from 5.0

* Rename patches to match 6.0-p1 work

* Add source-build specific build script

* Incorporate build-source-build.sh, into eng/

* Run inner build script, through coreclr

* Initial source-build args based on live build (not props file)

* Cleanup: add RID comments, rm empty/absolute args

* Fix subsets

* Disable sourcelink in env, not args

* Fix CI NZEC

* Revert "Use same code to DetectCiphersuiteConfiguration for portable and non-portable builds"

This reverts commit 464010d9d0241bbdcbfbda25b32e78991ddf6093.

* Fix portability

* Fix AllJits build

* Fix missing crossgen2 for non-portable RID

* Create supplemental intermediate nupkgs

* Tweak category names

* Use centralized supplemental nupkg infra

* Add additional 6.0 patches

* Patch updates after merging in main

* SourceBuild.props cleanup

* Fix issue with incorrect patch merge

* Patch updates

* Edit clr.tools patch

* patch updates

* Revert patch integration

* Patch updates

* Edits per code review feedback

* ILAsm workaround

* patch updates

* Move logic to set ILAsmToolPath for source-build

* Update eng/SourceBuild.props

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
* Remove libraries specific patches

* Patch updates necessary with latest main merge

* Add back libraries-packages.proj harvesting patch

* Refactor intermediate package split to be chunkier

* Integrate patch 0017

* Subsets update per code review

* Remove obsolete patch

* Removed patches that were integrated into main

* Remove two additional patches

* Remove remaining patches

Co-authored-by: Davis Goodin <dagood@microsoft.com>
Co-authored-by: dseefeld <dseefeld@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoConvert some COM object checking functions to managed code (#54471)
Aaron Robinson [Tue, 22 Jun 2021 06:44:16 +0000 (23:44 -0700)]
Convert some COM object checking functions to managed code (#54471)

* Convert COM object checking to managed code

* Convert IsComWrapperClass to a managed "can cast to" implementation.

* Add testing for updates.

3 years ago[Test] Move leakwheel to Pri1 (#54522)
Fan Yang [Tue, 22 Jun 2021 01:58:30 +0000 (21:58 -0400)]
[Test] Move leakwheel to Pri1 (#54522)

* Move to Pri1

* Remove leakwheel from issues.targets file for mono

3 years agoremoving more crossgen code from being built. (#54458)
Manish Godse [Tue, 22 Jun 2021 01:52:40 +0000 (18:52 -0700)]
removing more crossgen code from being built. (#54458)

Should improve build times further.

3 years agoMore Parse tests for double, single and Half (#50394)
Prashanth Govindarajan [Tue, 22 Jun 2021 01:22:30 +0000 (18:22 -0700)]
More Parse tests for double, single and Half (#50394)

* Test ibm-fpgen locally for validation

* sq

3 years agoDisable mainv1 and mainv2 for GCStress due to #54203 (#54514)
Bruce Forstall [Tue, 22 Jun 2021 01:10:58 +0000 (18:10 -0700)]
Disable mainv1 and mainv2 for GCStress due to #54203 (#54514)

3 years agoSYSLIB0026: Obsolete mutable X509 certificate APIs
Kevin Jones [Mon, 21 Jun 2021 23:36:51 +0000 (19:36 -0400)]
SYSLIB0026: Obsolete mutable X509 certificate APIs

3 years agoAdd name of corrupted certificate to CryptographicException on Mac
Oded Hanson [Mon, 21 Jun 2021 22:14:16 +0000 (01:14 +0300)]
Add name of corrupted certificate to CryptographicException on Mac

* Add name of corrupted certificate to CryptographicException on Mac

When trying to create a CertificateData out of raw X509 byte array it might throw if the data is corrupted. The existing exception message does not provide any information which might help the user identify the corrupted certificate and fix it.

This change, makes a native call to SecCertificateCopySubjectSummary which will provide a human readable summary of the certificate, and will generate an exception message using this string.

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
3 years agoDispose transient CFData in Interop.AppleCrypto.X509GetRawData
Oded Hanson [Mon, 21 Jun 2021 22:12:18 +0000 (01:12 +0300)]
Dispose transient CFData in Interop.AppleCrypto.X509GetRawData

3 years agoAdd code to flush JSON writer after root-level fast-path serialization (#54502)
Layomi Akinrinade [Mon, 21 Jun 2021 22:08:27 +0000 (15:08 -0700)]
Add code to flush JSON writer after root-level fast-path serialization (#54502)

3 years agoHTTP/3: Fix header field length calculation (#54442)
James Newton-King [Mon, 21 Jun 2021 21:45:57 +0000 (09:45 +1200)]
HTTP/3: Fix header field length calculation (#54442)