platform/upstream/dotnet/runtime.git
2 years agoFix mono debugger thread block when wait for attach (#62175)
D.S. Qiu [Thu, 2 Dec 2021 00:54:58 +0000 (08:54 +0800)]
Fix mono debugger thread block when wait for attach (#62175)

* wait_for_attach change to gc safe mode

* change MONO_REQ_GC_SAFE_MODE to MONO_REQ_GC_UNSAFE_MODE

2 years agoUse ReadOnlySpan<char> instead of strings on SourceGenerator engine (#62222)
Jose Perez Rodriguez [Thu, 2 Dec 2021 00:38:28 +0000 (16:38 -0800)]
Use ReadOnlySpan<char> instead of strings on SourceGenerator engine (#62222)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoCache LastAccessed during MemoryCache compaction (#61187)
Eric Erhardt [Thu, 2 Dec 2021 00:22:22 +0000 (18:22 -0600)]
Cache LastAccessed during MemoryCache compaction (#61187)

* Cache LastAccessed during MemoryCache compaction

During cache compaction, we are sorting entries based on their LastAccessed time. However, since the cache entries can still be used concurrently on other threads, the LastAccessed time may be updated in the middle of sorting the entries. This leads to exceptions in a background thread, crashing the process.

The fix is to cache the LastAccessed time outside of the entry when we are adding it to the list. This will ensure the time is stable during the compaction process.

Fix #61032

2 years agoAdd NetCoreAppCurrent configurations to Microsoft.Extensions libraries (#61867)
Eric Erhardt [Wed, 1 Dec 2021 23:33:21 +0000 (17:33 -0600)]
Add NetCoreAppCurrent configurations to Microsoft.Extensions libraries (#61867)

* Add NetCoreAppCurrent configurations to Microsoft.Extensions libraries

This makes all Extensions projects consistent in which TFMs they target. This way we don't need to add new TFMs during development of a new feature.

Fix #54012

2 years agothrow exception when creating an entry name that already exists in ZipArchive (#60973)
Badre BSAILA [Wed, 1 Dec 2021 20:16:59 +0000 (21:16 +0100)]
throw exception when creating an entry name that already exists in ZipArchive (#60973)

* throw exception when creating an entry name that already exists in ZipArchive

* secure code at the top of CreateEntry call

* specify entry name in exception message

* fix exception message, make AddEntry retrocompatible, and fix test issue with globalization

* restore the EmptyEntryTest code as before

2 years ago[SuperPMI] Added a new optional -compile argument (#62217)
SeanWoo [Wed, 1 Dec 2021 20:03:46 +0000 (00:03 +0400)]
[SuperPMI] Added a new optional -compile argument (#62217)

* Added a new optional -compile argument that specifies which method contexts need to be compiled

* Update src/coreclr/scripts/superpmi.py

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Added another form of -compile argument like -c

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
2 years ago[mono][llvm] Mark the gc poll function as used so llvm doesn't optimize it away causi...
Zoltan Varga [Wed, 1 Dec 2021 19:49:41 +0000 (14:49 -0500)]
[mono][llvm] Mark the gc poll function as used so llvm doesn't optimize it away causing an assert inside 'opt'. (#62198)

2 years ago[main] Update dependencies from dotnet/linker (#61669)
dotnet-maestro[bot] [Wed, 1 Dec 2021 19:15:39 +0000 (20:15 +0100)]
[main] Update dependencies from dotnet/linker (#61669)

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21565.4

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21566.4

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21567.1

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21568.1

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21569.1

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21572.2

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21580.1

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21562.1 -> To Version 7.0.100-1.21601.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years agoFeature/get debug view value processing (#60391)
Ondřej Škrabánek [Wed, 1 Dec 2021 19:08:56 +0000 (19:08 +0000)]
Feature/get debug view value processing (#60391)

* Added parameter for processing the value of the configuration e.g. for obfuscation

* Rename

* Extension methods separated

* After review suggestion changes

* Documentation update

* Build fixes

* Documentation for ConfigurationDebugViewContext added

* Nullable string error fix

* Changed to nullable string

* PR fixes

* Definition fix

* Missing definition

* Added getters to the definition

* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationRootExtensions.cs

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
* Tests added

* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationDebugViewContext.cs

Docs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationDebugViewContext.cs

Docs updateDocs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationDebugViewContext.cs

Docs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationDebugViewContext.cs

Docs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationRootExtensions.cs

Docs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationDebugViewContext.cs

Docs update

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2 years agoCouple of debug info test fixes (#62199)
Jakob Botsch Nielsen [Wed, 1 Dec 2021 18:24:36 +0000 (19:24 +0100)]
Couple of debug info test fixes (#62199)

It looks like in CI we are seeing a null method ID in some cases when
this test is run under R2R and GC stress. Add a check for this, and also
mark the test as stress incompatible like other ETW tests, since it runs
very slowly under stress modes.

Fix #62118

2 years agoneedLabel assert (#62025)
Kunal Pathak [Wed, 1 Dec 2021 16:00:36 +0000 (08:00 -0800)]
needLabel assert (#62025)

2 years agoFix use of StringBuilder.AppendFormat in ILCompiler (#62147)
Stephen Toub [Wed, 1 Dec 2021 15:34:49 +0000 (10:34 -0500)]
Fix use of StringBuilder.AppendFormat in ILCompiler (#62147)

2 years ago[main] Update dependencies from 5 repositories (#62187)
dotnet-maestro[bot] [Wed, 1 Dec 2021 14:55:37 +0000 (15:55 +0100)]
[main] Update dependencies from 5 repositories (#62187)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoOptimize FMA codegen base on the overwritten (#58196)
weilinwa [Wed, 1 Dec 2021 14:47:13 +0000 (06:47 -0800)]
Optimize FMA codegen base on the overwritten (#58196)

* Optimize FMA codegen base on the overwritten

* Improve function/var names

* Add assertions

* Get use of FMA with TryGetUse

* Decide FMA form with two conditions, OverwrittenOpNum and isContained

* Fix op reg error in codegen

* Decide form using lastUse and isContained in no overwritten case

* Clean up code

* Separate default case overwrittenOpNum==0

* Apply format patch

* Change variable and function names

* Update regOptional for op1 and resolve some other comments

* Optimize FMA codegen base on the overwritten

* Improve function/var names

* Add assertions

* Get use of FMA with TryGetUse

* Decide FMA form with two conditions, OverwrittenOpNum and isContained

* Fix op reg error in codegen

* Decide form using lastUse and isContained in no overwritten case

* Clean up code

* Separate default case overwrittenOpNum==0

* Apply format patch

* Change variable and function names

* Update regOptional for op1 and resolve some other comments

* Change var names

* Fix jit format

* Fix build node error for op1 is regOptional

* Use targetReg instead of GetResultOpNumForFMA in codegen

* Update variable names

* Refactor lsra to solve lastUse status changed caused assertion failure

* Add check to prioritize contained op in lsra

* Update for jit format

* Simplify code

* Resolve comments

* Comment out assert because of lastUse change

* Fix some copiesUpperBits related errors

* Update src/coreclr/jit/lsraxarch.cpp

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
* Add link to the new issue

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
2 years agofix issue where HTTP2 connection could be scavenged but not disposed (#62225)
Geoff Kizer [Wed, 1 Dec 2021 14:33:24 +0000 (06:33 -0800)]
fix issue where HTTP2 connection could be scavenged but not disposed (#62225)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
2 years agoJIT/EE interface cleanups (#62214)
Jan Kotas [Wed, 1 Dec 2021 13:42:32 +0000 (05:42 -0800)]
JIT/EE interface cleanups (#62214)

- Convert RuntimeHelpers.InitializeArray to new style intrinsic
- Delete unused isStructRequiringStackAllocRetBuf JIT/EE method and related optimization
- Delete unused CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT jit helper

2 years agoType memory maps with placeholders (#61933)
SingleAccretion [Wed, 1 Dec 2021 12:04:19 +0000 (15:04 +0300)]
Type memory maps with placeholders (#61933)

Use TYP_UNDEF (as TYP_MEM) for "first field"-like maps and
TYP_UNKNOWN (as TYP_HEAP) for the heaps themselves.

This will enable the type validation logic to be more precise.
For now, just assert that the heap is always updated with the
properly typed VNs.

2 years agoFix GT_ADD trees with mismatched operands (#62177)
Michal Strehovský [Wed, 1 Dec 2021 11:04:11 +0000 (20:04 +0900)]
Fix GT_ADD trees with mismatched operands (#62177)

Fixes issue observed in https://github.com/dotnet/runtimelab/issues/1128#issuecomment-979370161 - the trees generate additions of `TYP_I_IMPL` with `TYP_INT` and that confuses things down the line.

2 years agoFix some missing debug info (#62018)
Jakob Botsch Nielsen [Wed, 1 Dec 2021 10:25:47 +0000 (11:25 +0100)]
Fix some missing debug info (#62018)

* Propagate debug info in loop cloning

* Do not consume debug info on the standalone call statement created for
  inline candidates. This would lead to the loss of debugging
  information for failed inline candidates, since those statements are
  dropped and expanded in the upcoming GT_RET_EXPR node instead. In some
  cases it would also lead to the loss of debugging information for
  successful inlines.
  In the new logic we allow the same debugging information to be
  attached to the upcoming statement using the GT_RET_EXPR.

This change adds around 40 KB (~0.5%) to SPC.

2 years agoConsole.Unix: fix OpenStandardInput Stream sometimes throwing for Reads. (#62153)
Tom Deseyn [Wed, 1 Dec 2021 08:35:36 +0000 (09:35 +0100)]
Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads. (#62153)

* Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads.

When connected to a terminal reads happen line-by-line.

StdInReader caches the line in a StringBuilder.

Instead of returning when the destination buffer is full, an attempt
was made to decode the next chunk from the StringBuilder (if there is
one). This causes the encoder to throw for encoding into an empty buffer.

2 years agodon't run the System.IO.FileSystem.DriveInfo tests in parallel (#62134)
Adam Sitnik [Wed, 1 Dec 2021 08:28:20 +0000 (09:28 +0100)]
don't run the System.IO.FileSystem.DriveInfo tests in parallel (#62134)

* don't run the System.IO.FileSystem.DriveInfo in parallel, fixes #62119

* unify disabling test parallelization per assembly

2 years agore-enable and fix the SetOutReadToEnd test (#62200)
Adam Sitnik [Wed, 1 Dec 2021 08:27:17 +0000 (09:27 +0100)]
re-enable and fix the SetOutReadToEnd test (#62200)

2 years agoStart building a universal System.Linq.Expressions library (#61952)
Michal Strehovský [Wed, 1 Dec 2021 05:00:56 +0000 (14:00 +0900)]
Start building a universal System.Linq.Expressions library (#61952)

System.Linq.Expressions currently offers multiple build time definitions to build different flavors of the library:

* `FEATURE_COMPILE` (defined everywhere except iOS/tvOS/Catalyst, and NativeAOT) - enables Reflection.Emit-based expression tree compiler.
* `FEATURE_INTERPRET` (always defined and not actually possible to build without) - enables the expression interpreter
* `FEATURE_DLG_INVOKE` (defined everywhere except NativeAOT, but we likely need to be able to run without it on iOS too because there's uninvestigated bugs around it ActiveIssue'd in #54970) - in the interpreter, use a delegate to invoke `CallInstructions` instead of `MethodInfo.Invoke`. The delegate might have to be Reflection.Emitted if it's not supportable with `Func`/`Action` (that's the uninvestigated iOS/tvOS/Catalyst bug).

For #61231, we need to be able to build a single System.Linq.Expression library that can switch between these build-time configurations _at publish time_ since we don't want to build a separate S.L.Expressions library for NativeAOT. There are advantages in having this setup for non-NativeAOT scenarios too. This pull request accomplishes that by mechanically changing the `#define`s into feature switches.

The feature switch is placed in the last proposed location for https://github.com/dotnet/runtime/issues/17973. I expect we'll want such API to be public at some point; now that Xamarin and NativeAOT use this formerly .NET Native-only thing the API request became relevant again.

This pull request is focused on the mechanical replacement of `#defines` with feature switches and it's already a lot bigger than I'm comfortable with.

There's some obvious "`!FEATURE_COMPILE` means this is .NET Native with everything what that meant" that I did not touch because this is meant to be a mechanical change. Some cleanup will be needed at some point. Right now this just mostly means we're running fewer tests than we could.

Validation:
* Verified that we're still running the same number of tests with CoreCLR as we previously were and they're all passing.
* Verified we're getting mostly the same size of the S.L.Expressions library on iOS (433 kB grew to 436 kB, the diffs are expected).
* Verified things work on the NativeAOT side as well.

2 years agoHave RegexInterpreter work over ReadOnlySpan<char> instead of strings. (#62165)
Jose Perez Rodriguez [Wed, 1 Dec 2021 04:55:59 +0000 (20:55 -0800)]
Have RegexInterpreter work over ReadOnlySpan<char> instead of strings. (#62165)

2 years agoTrack a missing place to reset alignment flag from BasicBlock (#62163)
Kunal Pathak [Wed, 1 Dec 2021 01:25:45 +0000 (17:25 -0800)]
Track a missing place to reset alignment flag from BasicBlock (#62163)

* Add unmark loopAlign in a missing place

* Add test case

* add trailing \n

2 years agoImprove SuperPMI temp filename creation (#62169)
Bruce Forstall [Wed, 1 Dec 2021 00:18:24 +0000 (16:18 -0800)]
Improve SuperPMI temp filename creation (#62169)

* Improve SuperPMI temp filename creation

1. Disallow all non-ASCII characters from the MC filename.
2. Disallow `(` and `)` in filenames.
3. To improve uniqueness, always append an 8-character random number
to the filename.

* Fix Linux build

2 years agoFix a few syntax issues in shell scripts (#62102)
Adeel Mujahid [Tue, 30 Nov 2021 23:32:39 +0000 (01:32 +0200)]
Fix a few syntax issues in shell scripts (#62102)

* Fix a few syntax issues in shell scripts

* Cleanup trailing whitespace in changed files
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main

if uname 2>/devnull | grep -q Darwin; then
    space=" "
fi

git show --name-only --pretty="" HEAD...dotnet/main |\
    xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```

* Address CR feedback

2 years agoUse the right format of bkpt/brk for align that falls after jump (#62106)
Kunal Pathak [Tue, 30 Nov 2021 22:28:19 +0000 (14:28 -0800)]
Use the right format of bkpt/brk for align that falls after jump (#62106)

* Always use int3/bkpt

* Use right formatting for brk instruction

* Rename to brk_unix and brk_windows

* jit format

2 years agoRemove workarounds for referencing the DllImport source generator now that we use...
Jeremy Koritzinsky [Tue, 30 Nov 2021 21:48:15 +0000 (13:48 -0800)]
Remove workarounds for referencing the DllImport source generator now that we use the RTM sdk. (#62156)

Co-authored-by: Andy Gocke <andy@commentout.net>
2 years agoUpdate creating codespace instructions (#62213)
Eric Erhardt [Tue, 30 Nov 2021 21:13:21 +0000 (15:13 -0600)]
Update creating codespace instructions (#62213)

2 years agoUpdate DI external tests for Stashbox (#61928)
Peter Csajtai [Tue, 30 Nov 2021 20:58:40 +0000 (21:58 +0100)]
Update DI external tests for Stashbox (#61928)

2 years ago[JIT] [Issue: 61620] Optimizing ARM64 for *x = dblCns; (#61847)
SeanWoo [Tue, 30 Nov 2021 20:23:39 +0000 (00:23 +0400)]
[JIT] [Issue: 61620] Optimizing ARM64 for *x = dblCns; (#61847)

* [Issue: 61620] Optimizing ARM64 for *x = 0;

* Update src/coreclr/jit/lower.cpp

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
* Fixed bug with * x = dConst if dConst is not 0

* remove extra printf

* Replacing IsFPZero with IsCnsNonZeroFltOrDbl for STOREIND Minor edits with conditional compilation in lower.cpp

* fixed ARM codegen for STOREIND

* Update src/coreclr/jit/lower.cpp

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
* Update src/coreclr/jit/lower.cpp

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
* fix formatting

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoValidate end when reading QPACK headers (#62164)
github-actions[bot] [Tue, 30 Nov 2021 20:04:02 +0000 (09:04 +1300)]
Validate end when reading QPACK headers (#62164)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
2 years agoProtecting send message to debugger if it's disables (#61927)
Thays Grazia [Tue, 30 Nov 2021 20:02:27 +0000 (17:02 -0300)]
Protecting send message to debugger if it's disables (#61927)

2 years agoRuntimeHelpers.CreateSpan<T> (#61079)
David Wrighton [Tue, 30 Nov 2021 18:44:38 +0000 (10:44 -0800)]
RuntimeHelpers.CreateSpan<T> (#61079)

Implement `RuntimeHelpers.CreateSpan<T>` #60948

Implementation provides for
- Both non-intrinsic and intrinsic implementations in CoreCLR
- Non-intrinsic implementation in Mono
  - Mono implementation also implements untested big endian support

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoBuild HttpStress and SslStress with live-built runtime using current TFM (#61689)
Anton Firszov [Tue, 30 Nov 2021 17:16:30 +0000 (18:16 +0100)]
Build HttpStress and SslStress with live-built runtime using current TFM (#61689)

This PR changes both local (non-containerized) and containerized stress builds to build against the live-built runtime with the help of targetingpacks.targets.

2 years agoFix parsing of ping error replies on raw sockets (#61592)
Filip Navara [Tue, 30 Nov 2021 17:12:58 +0000 (18:12 +0100)]
Fix parsing of ping error replies on raw sockets (#61592)

* Fix parsing of ping error replies on raw sockets

* Re-enable ping tests

* Update the SendPingToExternalHostWithLowTtlTest test validation

2 years ago[TODO-List-Cleanup] Delete `NumChildren`, `GetChild` and `gtGetChildPointer` (#61875)
SingleAccretion [Tue, 30 Nov 2021 17:02:34 +0000 (20:02 +0300)]
[TODO-List-Cleanup] Delete `NumChildren`, `GetChild` and `gtGetChildPointer` (#61875)

* Delete "gtGetChildPointer"

TryGetUse does the same thing and is used more often.

Also some editorial renames to standardize on the "user/use" terminology.

* Delete NumChildren and GetChild

In most situations these methods are the wrong thing
to call - they are not very efficient by design.

Not surprisingly, thus, they were mostly only used in debug
code. The few product dependencies were removed and replaced
with equivalent alternatives, deduplicating the code.

In the process, BasicBlock::firstNode() was removed as it was
not used anywhere.

* Rename 'def' -> 'operand'

* A few forgotten pieces

* One more

2 years agoarea-PAL-Libraries merged into area-System.Runtime.InteropServices (#62180)
Jeff Handley [Tue, 30 Nov 2021 15:06:20 +0000 (07:06 -0800)]
area-PAL-Libraries merged into area-System.Runtime.InteropServices (#62180)

Past issues/PRs were re-tagged as area-System.Runtime.InteropServices and the issue labeler bot was retrained.

2 years agoFix method HttpHeadersNonValidated uses to get HeaderDescriptor (#62150)
Stephen Toub [Tue, 30 Nov 2021 15:04:56 +0000 (10:04 -0500)]
Fix method HttpHeadersNonValidated uses to get HeaderDescriptor (#62150)

We have two non-public methods for getting a HeaderDescriptor from a string name, one static on HeaderDescriptor and one instance on HttpHeaders.  HttpHeadersNonValidated was using the former, but this then doesn't take into account custom logic used by HttpHeaders in other methods, like TryAddWithoutValidation, which means some methods on HttpHeadersNonValidated can't find the corresponding headers.

2 years agoNo-op ConcurrentStack.PushRange(T[]) if empty (#62126)
Martin Costello [Tue, 30 Nov 2021 14:56:51 +0000 (14:56 +0000)]
No-op ConcurrentStack.PushRange(T[]) if empty (#62126)

* No-op ConcurrentStack.PushRange(T[]) if empty

Resolves #62121.

* Add more bounds checks

Assert that ArgumentOutOfRangeException is thrown if specifying indexes for an empty array with PushRange(T[], int, int).

* Review feedback

Allow out-of-bounds index on empty array if count is zero.

* Add extra test case

Add a further test case for a non-empty array but with a count parameter value of zero.

2 years agoavoid code duplication for disabling parallelization with xUnit (#62132)
Adam Sitnik [Tue, 30 Nov 2021 14:52:48 +0000 (15:52 +0100)]
avoid code duplication for disabling parallelization with xUnit (#62132)

The collection definitions must be in the same assembly as the test that uses them

2 years agoFix System.Object serialization with custom number handling (#62020)
Eirik Tsarpalis [Tue, 30 Nov 2021 14:47:58 +0000 (14:47 +0000)]
Fix System.Object serialization with custom number handling (#62020)

* Fix System.Object serialization with custom number handling

* fix typos

2 years agoFix mono alc from gchandle (#62120)
D.S. Qiu [Tue, 30 Nov 2021 14:07:03 +0000 (22:07 +0800)]
Fix mono alc from gchandle (#62120)

* remove MonoManagedAssemblyLoadContext

* fix mono_alc_from_gchandle use field

* change by vargaz review

* formatting

* fixed compiler error

2 years agoFix TimeSpan support in sourcegen (#62130)
Eirik Tsarpalis [Tue, 30 Nov 2021 13:55:44 +0000 (13:55 +0000)]
Fix TimeSpan support in sourcegen (#62130)

* fix TimeSpan support in sourcegen

* address feedback

2 years agoFix set value. Implement Runtime.evaluate. (#62142)
Thays Grazia [Tue, 30 Nov 2021 13:41:46 +0000 (10:41 -0300)]
Fix set value. Implement Runtime.evaluate. (#62142)

2 years agoAvoid printing debug info on 0 byte instructions (#62077)
Jakob Botsch Nielsen [Tue, 30 Nov 2021 10:27:42 +0000 (11:27 +0100)]
Avoid printing debug info on 0 byte instructions (#62077)

In particular do not attach it to INS_align that do not end up producing
any code.

2 years agoFix clang 13 induced runtime issues (#62170)
Jan Vorlicek [Tue, 30 Nov 2021 09:55:21 +0000 (10:55 +0100)]
Fix clang 13 induced runtime issues (#62170)

The clang 13 optimizer started to assume that "this" pointer is always
properly aligned. That lead to elimination of some code that was actually
needed.
It also takes pointer aliasing rules more strictly in one place in jit.
That caused the optimizer to falsely assume that a callee with an argument
passed by reference is not modifying that argument and used a stale
copy of the original value at the caller site.

This change fixes both of the issues. With this fix, runtime compiled
using clang 13 seems to be fully functional.

2 years ago[wasm][debugger] A draft of doc for describing debugger behavior. (#62015)
Ilona Tomkowicz [Tue, 30 Nov 2021 09:32:33 +0000 (10:32 +0100)]
[wasm][debugger] A draft of doc for describing debugger behavior. (#62015)

* A draft of doc for describing debugger behaviour.

* Removing spaces.

2 years agoRun Codespaces prebuild only in upstream repo (#62162)
Eric Erhardt [Tue, 30 Nov 2021 02:47:25 +0000 (20:47 -0600)]
Run Codespaces prebuild only in upstream repo (#62162)

The codespaces prebuild action can only run in the dotnet/runtime repo and not forks. The feature needs to be enabled for each repo and will fail if it isn't enabled. In order to minimize failure notifications, add a check to the action so it only runs against dotnet/runtime.

2 years agoRemove extraneous support in the test runner generator for referencing corelib direct...
Jeremy Koritzinsky [Tue, 30 Nov 2021 01:15:51 +0000 (17:15 -0800)]
Remove extraneous support in the test runner generator for referencing corelib directly. (#62154)

2 years agoMono hot reload reorg and beginning (disabled) add method support (#61853)
Aleksey Kliger (λgeek) [Tue, 30 Nov 2021 00:31:28 +0000 (19:31 -0500)]
Mono hot reload reorg and beginning (disabled) add method support (#61853)

This PR does two things:
1. Reorganizes how we keep track of deltas, and how we do metadata lookups after updates
2. Adds an ifdefed-out initial draft of support for adding methods.  (It worked for a simple test but it's not ready for general use yet).

Details of the delta changes.

* Previously Mono used a fully immutable model of metadata changes.  Logically each delta brings in modifications to existing table rows and addition of new rows.  Previously mono never formed the fully mutated tables - instead, each lookup was essentially responsible for playing all the changes forward every time it needed to lookup a row.  This was fine when we primarily supported only row additions (because we could just skip past all the updates that hadn't added the row we wanted yet, and just look in a single delta).  But as we started to support more and more modifications (of custom attributes, of property getters & setters, of parameters, etc) we now had to look through the whole list of deltas to make sure we found the latest modification of every row.
* The new approach is for each `DeltaInfo` (representing a summary of a particular update to a single assembly) to contain a collection of `mutants` - the fully modified tables with all the newly added rows and all the new modifications.  So lookups are fast now - we just go to the latest generation that is visible to a particular thread and look at its mutants tables.  The downside is increased memory use.  So we allocate the mutants from memory pools owned by each `DeltaInfo`.  Right now we never dealloc the pools, but in the future we could.  We already iterate over all the threads during our stop-the-world phase - we can record the earliest generation still needed by every thread and delete the pools for all earlier copies.  In practice this means we only keep 3 sets of tables: the mmaped baseline tables, the newest mutants, and the mutants from the prior generation for any still-executing methods.
* Additionally instead of storing a list of delta images in the `BaselineInfo`, we now store a list of `DeltaInfo` structs which each `DeltaInfo` pointing to a delta image.  This means that we can avoid repeated hash table lookups to map from a delta image to its `DeltaInfo` every time the runtime queries us for a table row or for a heap element.

---

* checkpoint: allow adding methods to existing classes.

Doesn't do anything yet.

And needs more sanity checking (roslyn won't give us virtual or abstract
methods, but we should check).

* fixme in loader

* [metadata] Add mono_metadata_table_num_rows

Returns the number of rows in a metadata table, taking into account metadata
update deltas

* add table to ptr table helper

* Param attr lookups for deltas can have param_index == 0

The params are added with a subsequent enclog "add param" function.

* WIP: start adding support for parameter additions.

It "works" in that calling methods appears to work (ie direct token references
seem to do the right thing).

Primarily this is because the param table additions are not that interesting.
All the good stuff is in the method signature (which is just in the blob heap).

Presumably anything that actually needs parameter attributes, or anything that
uses reflection to look at the parameters, will break.

* WIP: add MethodDef -> TypeDef lookup

Allows calling non-public methods, which are now assigned the correct parent

* Add hot reload test for lambda capturing this

Lambdas that only capture `this` (and not local variables or arguments) compile
to a private instance method in the enclosing class.  So it is enough to
support EnC deltas that add methods.

* clarify comments about MONO_METHOD_PARAMLIST

* [hot_reload] Store debug info of updated methods

* [hot_reload] Allocate modifiable tables in DeltaInfo

This is the foundation for a new approach for metadata lookups.
Instead of using an immutable model (each lookup traverses every delta to find
the most up to date version of each table row), we are going to create a
complete updated table for each generation and only do the lookup in the latest
exposed generation directly.  (This is essentially the CoreCLR model).

This commit is just the first foundations: we allocate the tables and copy over
the previous generations' rows and zero out any rows that will be inserted.
Delta applications and lookups have not been updated yet.

As a slight optimization, tables that don't have modified or added rows are not
copied from the base image.  If a generation modifies or adds rows, from that
point forward, each subsequent generation will copy the table.

We could be a bit more thrifty with copying, but it will complicate lookups.
Also eventually we will try to deallocate the pools for generations that are
older than no thread needs anymore.

Metadata heaps are still looked up in each delta directly - heap combining does
not seem necessary yet.

* [mini] Allow MONO_VERBOSE_METHOD='*:*'

Implement method name wildcard matching for method descriptions

Globbing doesn't work because we don't have g_pattern_match_simple in eglib.
But a plain '*' wildcard does work.

* populate mutated table rows

leave suppressed columns unchanged

* [hot_reload] Switch lookups to the mutant tables

* cleanup: remove of effective_table calculation

The row index doesn't change in the new scheme, pass it by value

* cleanup: Remove relative_delta_index from component API

It's only used internally by the update logic

* cleanup: Pass DeltaInfo to relative_delta_index

don't compute it from the dmeta image

* cleanup: Store a list of DeltaInfo in the BaselineInfo

Instead of storing a list of delta images and then relying on delta_info_lookup
to find the DeltaInfo, just store them directly on the baseline info.

This changes the cleanup responsibilities a bit.  Now we destroy the DeltaInfo
when we are iterate through the delta infos when we close the baseline image,
instead of when we remove the delta_image_to_info hashtable entry.

* Turn off method addition support, for now

Just want to get the cleanups enabled for now

* Fix null ptr when checking for updated ppdb info

2 years agoRevert "Adding support for the X86Base.Pause intrinsic on Mono (#61707)" (#62157)
Andy Gocke [Tue, 30 Nov 2021 00:14:45 +0000 (16:14 -0800)]
Revert "Adding support for the X86Base.Pause intrinsic on Mono (#61707)" (#62157)

This reverts commit 1997beecd941ec0b825a5319cda0e97f2effbf3b.

2 years agoSupport zero-byte reads on HTTP response streams (#61913)
Miha Zupan [Mon, 29 Nov 2021 23:11:38 +0000 (15:11 -0800)]
Support zero-byte reads on HTTP response streams (#61913)

* Allow zero byte reads on raw HTTP/1.1 response streams

* Allow zero byte reads on the rest of HTTP/1.1 response streams

* Allow zero byte reads on HTTP/2 response streams

* Allow zero byte reads on HTTP/3 response streams

* Enable sync zero-byte reads

* Add zero-byte read tests

* Fully enable zero-byte reads on HTTP/2 and 3

* Add zero-byte read tests for HTTP/2 and HTTP/3

* Remove unsafe-ish code from PeekChunkFromConnectionBuffer

* Add comments when we do extra zero-byte reads

* Update MockQuicStreamConformanceTests to allow zero-byte reads

* Update ConnectedStream tests to allow zero-byte reads

* Skip zero-byte read tests on Browser

* Update comment on explicit zero-byte reads in ChunkedEncodingReadStream

2 years agoCleanup some code using ECAlgorithm
Kevin Jones [Mon, 29 Nov 2021 22:29:43 +0000 (17:29 -0500)]
Cleanup some code using ECAlgorithm

2 years agoImplement PEM exports for RSA PKCS#1 and ECPrivateKey
Kevin Jones [Mon, 29 Nov 2021 22:23:30 +0000 (17:23 -0500)]
Implement PEM exports for RSA PKCS#1 and ECPrivateKey

2 years ago[main] Update dependencies from 3 repositories (#62098)
dotnet-maestro[bot] [Mon, 29 Nov 2021 15:21:52 +0000 (16:21 +0100)]
[main] Update dependencies from 3 repositories (#62098)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[wasm] Use cross origin policy headers (#62016)
Marek Fišera [Mon, 29 Nov 2021 14:28:48 +0000 (15:28 +0100)]
[wasm] Use cross origin policy headers (#62016)

* Remove active issue.
* Use --web-server-use-cop.

2 years agoCI matrix change: add Windows.Server.Core.20H2 - Second attempt (#60054)
Jan Jahoda [Mon, 29 Nov 2021 13:42:49 +0000 (14:42 +0100)]
CI matrix change: add Windows.Server.Core.20H2 - Second attempt (#60054)

* CI matrix change: add Windows.Server.Core.20H2 (#59572)

* Add Windows.Server.Core.20H2 to CI matrix

* add windows server 20H2

* Remove 20H2 from PR

* Remove 20H2 from PR run

* change helix queue for Windows.Server.Core.20H2

2 years agoFix `optComputeLoopSideEffects` to account for HWI stores (#61911)
SingleAccretion [Mon, 29 Nov 2021 13:40:11 +0000 (16:40 +0300)]
Fix `optComputeLoopSideEffects` to account for HWI stores (#61911)

Otherwise we can end up not seeing the loop has memory havoc.

Also added an assert that will prevent this issue from arising in the future.

2 years agoUpdate hash of the new CSE when resizing (#61984)
SingleAccretion [Mon, 29 Nov 2021 12:29:52 +0000 (15:29 +0300)]
Update hash of the new CSE when resizing (#61984)

The CSE logic maintains a custom hashtable implementation.

It triggers a resize at the same time as adding a new CSE,
but forgets the hash of the new CSE needs to be updated from
its pre-resize value. Failing to do so can lead to losing some
CSEs, though not in a correctness-impacting way.

2 years ago[mono]mono_runtime_delegate_invoke change to gc unsafe state (#62003)
D.S. Qiu [Mon, 29 Nov 2021 09:27:43 +0000 (17:27 +0800)]
[mono]mono_runtime_delegate_invoke change to gc unsafe state (#62003)

* mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE;

mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE;

* Update object.c

2 years agoFlip IL offset check (#62049)
Jakob Botsch Nielsen [Sat, 27 Nov 2021 19:37:34 +0000 (20:37 +0100)]
Flip IL offset check (#62049)

2 years agoFix miscellaneous typos (#62062)
Adeel Mujahid [Sat, 27 Nov 2021 00:32:13 +0000 (02:32 +0200)]
Fix miscellaneous typos (#62062)

* Fix miscellaneous typos

* Cleanup trailing whitespaces
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main

if uname 2>/devnull | grep -q Darwin; then
    space=" "
fi

git show --name-only --pretty="" HEAD...dotnet/main |\
    xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```

2 years ago[main] Update dependencies from 8 repositories (#61668)
dotnet-maestro[bot] [Fri, 26 Nov 2021 22:06:43 +0000 (23:06 +0100)]
[main] Update dependencies from 8 repositories (#61668)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Premek Vysoky <premek.vysoky@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years agofix for excessive gen0 in high memory load situation (#61884)
Maoni Stephens [Fri, 26 Nov 2021 21:19:07 +0000 (13:19 -0800)]
fix for excessive gen0 in high memory load situation (#61884)

in high memory load situations, when we had to wait for a BGC to finish, we switched to preemptive mode which means GCs could have occurred and replenished the budget. but when we come back from the wait, we use the previous decision on whether the budget was exceeded or not. this causes us to trigger GC incorrect and you would see GCs triggered when the allocated bytes are tiny.

2 years agoRefactor writing QPACK status (#62069)
github-actions[bot] [Fri, 26 Nov 2021 18:01:19 +0000 (07:01 +1300)]
Refactor writing QPACK status (#62069)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
2 years agoAvoid switching GC mode in COM's HasValidTarget (#62066)
Adeel Mujahid [Fri, 26 Nov 2021 17:58:25 +0000 (19:58 +0200)]
Avoid switching GC mode in COM's HasValidTarget (#62066)

* Avoid switching GC mode in COM's HasValidTarget

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoFix setting pipe as nonblocking (#61126)
Vikas Amar Tikoo [Fri, 26 Nov 2021 12:20:49 +0000 (04:20 -0800)]
Fix setting pipe as nonblocking (#61126)

2 years agoSuppress trim warning caused by recent attribute removal changes (#62023)
Vitek Karas [Fri, 26 Nov 2021 10:50:56 +0000 (11:50 +0100)]
Suppress trim warning caused by recent attribute removal changes (#62023)

This fixes a new warning generated by trimming some apps which was introduced in #54056.
The `ComVisibleAttribute` in this case is referenced, but if it's removed it doesn't change functionality in any way.

2 years agoExclude a newly added test on Mono (#62056)
Jakob Botsch Nielsen [Fri, 26 Nov 2021 07:54:33 +0000 (08:54 +0100)]
Exclude a newly added test on Mono (#62056)

Fix #62031

2 years ago[wasm][debugger] Stepping into hidden function. (#61312)
Ilona Tomkowicz [Fri, 26 Nov 2021 07:26:36 +0000 (08:26 +0100)]
[wasm][debugger] Stepping into hidden function. (#61312)

* Add test for ignoring stepping into hidden function.

* Corrected test to match Console App behaviour.

* Corrected test logic.

* Applied Thays's fix so that step into would work as step over in a hidden method.

* Revert debugging changes.

* Test for Debugger.Break().

* Col fix + checing the location after command execution.

* Correct value of VisibleMethod entry line.

* Move the breakpoint to the line 846.

* Create tests that match behaviour of Console App.

* Draft of Debugger.Break behaviour correction.

* Draft: 2 pauses on hidden method with Debugger.Break inside.

* Changed required behaviour to 2 pauses on the hidden method call.

2 years agoAdd endHeader flag to QPACK decode (#62059)
github-actions[bot] [Fri, 26 Nov 2021 02:21:41 +0000 (15:21 +1300)]
Add endHeader flag to QPACK decode (#62059)

Co-authored-by: Tratcher <Tratcher@users.noreply.github.com>
Co-authored-by: James Newton-King <james@newtonking.com>
2 years agoRe-enable Windows test that verifies DriveInfo.VolumeLabel setter fails on SUBST...
Carlos Sanchez [Thu, 25 Nov 2021 22:38:38 +0000 (16:38 -0600)]
Re-enable Windows test that verifies DriveInfo.VolumeLabel setter fails on SUBST'd drive (#59850)

* Re-enable test that verifies DriveInfo.VolumeLabel setter fails on SUBST'd drive

2 years agoIntegration of changes in shared files from runtimelab/NativeAOT (#62039)
Michal Strehovský [Thu, 25 Nov 2021 20:55:33 +0000 (05:55 +0900)]
Integration of changes in shared files from runtimelab/NativeAOT (#62039)

2 years agoAdd a github action to sync shared source from aspnetcore (#61999)
Chris Ross [Thu, 25 Nov 2021 19:07:26 +0000 (11:07 -0800)]
Add a github action to sync shared source from aspnetcore (#61999)

2 years ago[mono][interp] Fix handing of native types (#61612)
Vlad Brezae [Thu, 25 Nov 2021 14:19:45 +0000 (16:19 +0200)]
[mono][interp] Fix handing of native types (#61612)

* [interp] Improve logging on mobile devices

Use a single g_print in bulk for every instruction. Otherwise, the instruction ends up being displayed on multiple lines.

* [interp] Remove hack for nint/nfloat

These structures are valuetypes, but their mint_type is a primitive. This means that a LDFLD applied on the type would have attempted to do a pointer dereference, because it saw that the current top of stack is not STACK_TYPE_VT. This was fixed in the past by passing the managed pointer to the valuetype rather than the valuetype itself, against the normal call convention, which lead to inconsistencies in the code.

This commit removes that hack and fixes the problem by ignoring LDFLD applied to nint/nfloat valuetypes in the first place.

2 years ago[wasm] debug with modularized runtime(s) (#61848)
Pavel Savara [Thu, 25 Nov 2021 14:19:28 +0000 (15:19 +0100)]
[wasm] debug with modularized runtime(s) (#61848)

* New globalThis.getDotnetRuntime method, which takes runtimeId, essentially index of the runtime on the page. It returns the DotNetPublicAPI object of the instance {MONO, BINDING, Module, RuntimeId, RuntimeBuildInfo }.
* Change the debugger to use the getDotnetRuntime() function when talking to the runtime on the page via CDP.
* Use getDotnetRuntime() in unit tests, with runtimeId is zero as there is only one runtime in tests.
* We add optional &runtimeId=0 to the initial URL which opens DebuggerProxy, so that MonoProxy could be created for specific runtime on the page.
* Moved mono_wasm_add_dbg_command_received, mono_wasm_debugger_log and mono_wasm_trace_logger out of C macro into typescript
* Introduced RuntimeBuildInfo: { ProductVersion, Configuration } into DotNetPublicAPI

2 years agoUpdate path of disabled test that was moved (#62051)
Jakob Botsch Nielsen [Thu, 25 Nov 2021 13:38:28 +0000 (14:38 +0100)]
Update path of disabled test that was moved (#62051)

2 years agoReorganize libs.native (#61958)
Adeel Mujahid [Wed, 24 Nov 2021 22:47:45 +0000 (00:47 +0200)]
Reorganize libs.native (#61958)

* Reorganize libs.native

* Fix darwin build

* Fix wasm-win32 build

* Fix pipelines path evaluation

2 years agoUse GeneratedDllImport for blittable p/invokes in System.Console, System.IO.FileSyste...
Elinor Fung [Wed, 24 Nov 2021 21:19:34 +0000 (14:19 -0700)]
Use GeneratedDllImport for blittable p/invokes in System.Console, System.IO.FileSystem.Watcher, System.IO.Pipes (#61996)

2 years agoHandle empty string parameter value in MetadataLoadContext (#61457)
Petr Onderka [Wed, 24 Nov 2021 21:10:50 +0000 (22:10 +0100)]
Handle empty string parameter value in MetadataLoadContext (#61457)

2 years agoRemove SupportedOSPlatformAttribute("windows") from LdapSessionOption (#61388)
Andrew Stakhov [Wed, 24 Nov 2021 21:02:29 +0000 (16:02 -0500)]
Remove SupportedOSPlatformAttribute("windows") from LdapSessionOption (#61388)

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
2 years agoSplitting the hardware intrinsic tests into more test groupings (#61973)
Tanner Gooding [Wed, 24 Nov 2021 20:09:33 +0000 (12:09 -0800)]
Splitting the hardware intrinsic tests into more test groupings (#61973)

* Splitting the hardware intrinsics into more test groupings

* Don't split the hardware intrinsics into a separate XUnitWrapperGrouping

2 years agoUse GeneratedDllImport in System.Diagnostics.EventLog (#61990)
Elinor Fung [Wed, 24 Nov 2021 19:39:28 +0000 (12:39 -0700)]
Use GeneratedDllImport in System.Diagnostics.EventLog (#61990)

2 years agoThe DestroyStructure API passes null to the IL marshaller for (#61985)
Aaron Robinson [Wed, 24 Nov 2021 19:23:22 +0000 (12:23 -0700)]
The DestroyStructure API passes null to the IL marshaller for (#61985)

managed valuetypes. This is an issue with field marshallers of
  nested non-blittable types.

2 years agoFix calling NLS with Cultures has alternative sort names (#61992)
Tarek Mahmoud Sayed [Wed, 24 Nov 2021 18:35:38 +0000 (10:35 -0800)]
Fix calling NLS with Cultures has alternative sort names (#61992)

2 years agoUnify ARRAY_SIZE/STRING_LENGTH-like macros (#61537)
Adeel Mujahid [Wed, 24 Nov 2021 16:52:12 +0000 (18:52 +0200)]
Unify ARRAY_SIZE/STRING_LENGTH-like macros (#61537)

* Unify ARRAY_SIZE/STRING_LENGTH-like macros

* Cleanup trailing whitespaces in changeset files

* Use ArrLen in the JIT

* Keep using G_N_ELEMENTS in mono

* Resolve name conflict in test

2 years agoAdded null checks to prevent null pointer exception (#62013)
Haarmees [Wed, 24 Nov 2021 14:12:22 +0000 (15:12 +0100)]
Added null checks to prevent null pointer exception (#62013)

Co-authored-by: JochemH <jharmes@chipsoft.nl>
2 years agoNullable annotation for System.Windows.Extensions (#57896)
Huo Yaoyuan [Wed, 24 Nov 2021 13:52:50 +0000 (21:52 +0800)]
Nullable annotation for System.Windows.Extensions (#57896)

* Enable nullable in project file.

* Annotate SoundPlayer

* Annotate remaining types

* Update ref source

* Events should be nullable

* Fix assertion for NRE

* Update nullability of SoundLocation.

* Adjust nullability of SoundLocation and Stream.

* Title and message should be nullable

* Fix new NRT issue

2 years ago[wasm] [debugger] Eval fixes for static class eval (#61660)
Ilona Tomkowicz [Wed, 24 Nov 2021 13:49:52 +0000 (14:49 +0100)]
[wasm] [debugger] Eval fixes for static class eval (#61660)

* Using current namespace as the default place to serach for the resolved class.

* Add tests for static class, static fields and pausing in async method.

* Added tests for class evaluation.

* Fixing support to the current namespace and adding tests for it

* Assuing that we search within the current assembly first. Removed tests that fail in Consol App.

* Remove a test-duplicate that was not testing static class or static fields.

* Fixing indentation.

* Refixing indentation.

* Refix indentations again.

* Applied the advice about adding new blank lines.

* Changed the current assembly check.

* Extracting the check from the loop. One time check is enough.

* Simplifying multiple test cases into one call.

* Using local function as per review suggestion.

* Added test that was skipped by mistake.

* Added looking for the namespace in all assemblies because there is a chance it will be located out of the current assembly.

* Extracting value based on the current frame, not the top of stack location.

* Test for classes evaluated from different frames.

* Tests for nested static classes.

* Fix for nested static classes.

* Fixed 9 tests from EvaluateOnCallFrame.

* Fixing indentation and spaces.

* Applied review comments for values evaluation.

* Compressed two tests into one with MemberData.

* Added test case of type without namespace (failing).

* Addressed Ankit advices from the review.

* Revert merged nested evaluation changes.

* Incorporate Ankit's changes from d020d36.

* Fix - when both valuesare null we should keep checking (e.g. for nested static classes).

* Added nested tests.

* Redo changes after reverting them in merge.

* Fixed - works with and without namespace.

* Fix merge.

* Using current namespace as the default place to serach for the resolved class.

* Add tests for static class, static fields and pausing in async method.

* Added tests for class evaluation.

* Fixing support to the current namespace and adding tests for it

* Assuing that we search within the current assembly first. Removed tests that fail in Consol App.

* Remove a test-duplicate that was not testing static class or static fields.

* Fixing indentation.

* Extracting the check from the loop. One time check is enough.

* Simplifying multiple test cases into one call.

* Added test that was skipped by mistake.

* Test for classes evaluated from different frames.

* Tests for nested static classes.

* Fix for nested static classes.

* Fixing indentation and spaces.

* Applied review comments for values evaluation.

* Compressed two tests into one with MemberData.

* Addressed Ankit advices from the review.

* Revert merged nested evaluation changes.

* Incorporate Ankit's changes from d020d36.

* Fix - when both valuesare null we should keep checking (e.g. for nested static classes).

* Fix merge.

* Cleanup after rebase.

* Added nested tests.

* Fixed - works with and without namespace.

* Clean-up after rebasing with fix-static-attribute-support.

* Fixed 9 tests from EvaluateOnCallFrame.

* Fixed 18 test types.

* Fix test cases with spaces in the names, e.g. "  this" evaluation.

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

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Avoid resolving fields of a null value.

* Fix for 4 failing tests of Count evaluation.

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

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

Co-authored-by: Ankit Jain <radical@gmail.com>
* Add null safety.

* Exchanged multiple trims for one.

* Undo nested static changes that will be sumbitted in another PR.

* Revert "Undo nested static changes that will be sumbitted in another PR."

This reverts commit 6a1b7ad0f28e5d3e02637d87bcdeac8fc6ddca35.

* Hiding test that has to be fixed in the future.

* Applying Ankit's suggestion about code simplification.

Co-authored-by: DESKTOP-GEPIA6N\Thays <thaystg@gmail.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoAdd some tests that validate debug info through ETW events (#61962)
Jakob Botsch Nielsen [Wed, 24 Nov 2021 13:48:50 +0000 (14:48 +0100)]
Add some tests that validate debug info through ETW events (#61962)

Validate the debug mappings generated by the JIT using the
MethodILToNative event. Unfortunately we can not use EventListener as
the event there does not contain the actual mappings (#12678) so this
reuses some of the facilities from the tracing tests to use EventPipe
and TraceEvent.

This only adds the infrastructure and a small number of tests, but
at least this should make it easier to add more tests in this area in
the future.

There are some more limitations, for example we cannot validate the
CALL_INSTRUCTION mappings generated for the managed return value feature
because the debugger filters them out of the table reported. I am hoping
we can change these mappings to be included as normal in the future.

The tests themselves are added by adding a method to tests.il with an
ExpectedILMappings attribute that allows specifying a subset of IL
offsets that we expect mappings to be generated for, with separate
subsets under Debug and when optimizing. This was the best way I could
think of to be able to refer to the right IL offsets.

2 years agoAdd RequiresDynamicCodeAttribute to runtime (#61956)
Tlakaelel Axayakatl Ceja [Wed, 24 Nov 2021 11:53:01 +0000 (03:53 -0800)]
Add RequiresDynamicCodeAttribute to runtime (#61956)

* Add RequiresDynamicCodeAttribute to runtime

* Delete nullable enable

* Add test file to compilation for RequiresDynamicCode and RequiresAssemblyFiles

* Fix RequiresAssemblyFiles tests

2 years agoFix Android crypto asserts (#61827)
Kevin Jones [Wed, 24 Nov 2021 11:48:22 +0000 (06:48 -0500)]
Fix Android crypto asserts (#61827)

This fixes three asserts that were started occurring in the native Android cryptographic primitives.

- One shot hashing now tolerates empty/null input.
- Hashing and HMAC will now no-op if the append is empty.
- RSA encryption now tolerates empty/null input.

2 years agoUse separate partials for iOS&tvOS instead of UnknowUnix in System.Diagnostics.Proces...
Maxim Lipnin [Wed, 24 Nov 2021 11:36:32 +0000 (14:36 +0300)]
Use separate partials for iOS&tvOS instead of UnknowUnix in System.Diagnostics.Process (#61871)

2 years agoClean up test intermediates when clean test rebuild is requested (#62001)
Tomáš Rylek [Wed, 24 Nov 2021 09:25:16 +0000 (10:25 +0100)]
Clean up test intermediates when clean test rebuild is requested (#62001)

I hit this problem locally when working on the test merging
- I made a change in Jeremy's Roslyn generator logic adding a hard
FailFast and the tests continued building normally even when
specifying the rebuild option because the XUnitWrapperGenerator
project remained in the intermediate test folder and didn't get
actually rebuilt.

Thanks

Tomas

2 years agoMake more extensive use of lvaGetDesc() (#61494)
Bruce Forstall [Wed, 24 Nov 2021 04:31:05 +0000 (20:31 -0800)]
Make more extensive use of lvaGetDesc() (#61494)

Including the version with a `GenTreeLclVarCommon*` overload.

I mostly replaced `&lvaTable[varNum]` and `lvaTable + varNum`
expressions, leaving `lvaTable[varNum].xxx`.

Made many resulting `varDsc*` const.

Removed unused `lvaRefCount`.

Simplifies code, and centralizes assert checking.

Added new `lvaGetLclNum(LclVarDsc*)` function to map back to a varNum.

This deletes many `noway_assert` in favor of the lvaGetDesc `assert`;
I'm not worried about removing asserts from the Release build.

2 years agoprevent concurrent access to IO buffers on macOS (#61723)
Tomas Weinfurt [Wed, 24 Nov 2021 03:59:48 +0000 (19:59 -0800)]
prevent concurrent access to IO buffers on macOS (#61723)

2 years ago[wasm] Misc CI/test run improvements (#61937)
Ankit Jain [Wed, 24 Nov 2021 01:17:09 +0000 (01:17 +0000)]
[wasm] Misc CI/test run improvements (#61937)

- Update chrome+chromedriver for helix tests to latest stable (`96.0.4664.45`)
- Enable library tests to run on Windows, for manual runs

- Disable windows/AOT builds completely due to https://github.com/dotnet/runtime/issues/61721
- Disable failing WBT tests on windows due to https://github.com/dotnet/runtime/issues/61725
- Disable JS interop tests failing with new chrome - https://github.com/dotnet/runtime/issues/61945

Co-authored-by: Radek Doulik <radek.doulik@gmail.com>
2 years ago[mono] Remove support for Classic Xamarin for the Selector.GetHandle optimization...
Rolf Bjarne Kvinge [Wed, 24 Nov 2021 01:13:23 +0000 (02:13 +0100)]
[mono] Remove support for Classic Xamarin for the Selector.GetHandle optimization, and add newer platforms. (#61989)

We haven't supported Classic mode for Xamarin for quite a few years now
(monotouch, MonoMac), so that code is not needed anymore. However, we've added
support for more platforms (tvOS, Mac Catalyst), so add support for those.