platform/upstream/dotnet/runtime.git
2 years agoFix EncryptDecrypt test (#72874)
Dan Moseley [Tue, 26 Jul 2022 22:36:01 +0000 (16:36 -0600)]
Fix EncryptDecrypt test (#72874)

* Fix EncryptDecrypt test

* more retries

2 years agoMake TypeBuilder.CreateType return non nullable (#72180)
Josie Bigler [Tue, 26 Jul 2022 22:33:45 +0000 (17:33 -0500)]
Make TypeBuilder.CreateType return non nullable (#72180)

* Make TypeBuilder.CreateType return non nullable

There is no situation when TypeBuilder.CreateType will return null when
being called by user-code.

issue #68840

* Update tests for null check after module.CreateGlobalFunctions()

* Check not null for additional CreateType Unit Tests

* Remove ! from DispatchProxyGenerator CreateType()

* Update Ref for non-null CreateType

* Change CreateTypeInfo to return non-null.

* Refactored CreateTypeInfo().AsType() to be CreateType()

* Annotate failing Mono Assert.Null

2 years agoTear down pending HTTP connection when the originating request completes (#71785)
Anton Firszov [Tue, 26 Jul 2022 22:11:56 +0000 (00:11 +0200)]
Tear down pending HTTP connection when the originating request completes (#71785)

Resolves #66297

2 years agoFix Idna Test (#72817)
Tarek Mahmoud Sayed [Tue, 26 Jul 2022 21:15:19 +0000 (21:15 +0000)]
Fix Idna Test (#72817)

* Fix Idna Test

* Update src/libraries/System.Globalization.Extensions/tests/IdnMapping/Data/Unicode_9_0/Unicode_9_0_IdnaTest.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFinds logger field in related types (#71308)
Steve Dunn [Tue, 26 Jul 2022 21:12:21 +0000 (22:12 +0100)]
Finds logger field in related types (#71308)

2 years agoAdd pod names into the area-owners.json file to support querying by pod (#72564)
Jeff Handley [Tue, 26 Jul 2022 20:52:16 +0000 (13:52 -0700)]
Add pod names into the area-owners.json file to support querying by pod (#72564)

* Add pod names into the area-owners.json file to support querying by pod

* Keep teams in the list of area owners

* Add Eric Erhardt to System.Globalization

2 years agoChange RegexGenerator to produce limited implementation for C# < 11 (#72860)
Stephen Toub [Tue, 26 Jul 2022 20:48:46 +0000 (16:48 -0400)]
Change RegexGenerator to produce limited implementation for C# < 11 (#72860)

Today the RegexGenerator fails to produce any code for GeneratedRegex if the LangVersion is 10 or lower.  However, that restriction only exists because the code generated for a regex implementation contains use of language features only available in C# 11 and newer.  Rather than failing outright for 10 or lower, we can just fall back to the limited support implementation that just caches an instance of the regex.  That still provides some value and makes it easier to transition between language versions.

2 years agoEnabling some tests back onto the Interpreted engine (#72639)
Jose Perez Rodriguez [Tue, 26 Jul 2022 20:45:55 +0000 (15:45 -0500)]
Enabling some tests back onto the Interpreted engine (#72639)

2 years agoEnable the ConvertToLibraryImport diagnostic by default (#72819)
Jeremy Koritzinsky [Tue, 26 Jul 2022 20:24:06 +0000 (13:24 -0700)]
Enable the ConvertToLibraryImport diagnostic by default (#72819)

2 years agoConsolidate importer spilling code V2 (#72744)
SingleAccretion [Tue, 26 Jul 2022 19:30:12 +0000 (22:30 +0300)]
Consolidate importer spilling code V2 (#72744)

* Consolidate importer spilling code (#72291)

* Add tests

* Fix losing GLOB_REF on the LHS

The comment states we don't need it, which is incorrect.

Diffs are improvements because we block forward substitution of
calls into "ASG(BLK(ADDR(LCL_VAR<field>, ...)))", which allows
morph to leave the "can be replaced with its field" local alone.

* Prospective fix

Spill "glob refs" on stores to "aliased" locals.

* Delete now-not-necessary code

* Fix up asserts

* Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts

* Don't manually spill for 'st[s]fld'

* Revert 'Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts'

* Fix assignments done via return buffers

The mistake in logic was that the only trees which could modify
unaliased locals are assignments, which is not true, calls can
do that as well.

One day we will move the return buffer handling out of importer,
but until then, special handling is required.

An alternative fix would have been to bring back the explicit
"impSpillLclRefs" to "stloc/starg" code, but that would contradict
the overall goal of consolidating the spilling logic.

2 years ago[QUIC] Remove connection state from QuicStream (#72599)
Marie Píchová [Tue, 26 Jul 2022 18:07:03 +0000 (20:07 +0200)]
[QUIC] Remove connection state from QuicStream (#72599)

* Removed connection state, updated mqsuic and fixed exceptions

* Feedback

* Feedback

2 years agoSystem.Text.Json - Emit XML comments for public source-generated APIs (#72761)
Jake Yallop [Tue, 26 Jul 2022 17:54:51 +0000 (18:54 +0100)]
System.Text.Json - Emit XML comments for public source-generated APIs (#72761)

* Emit XML comments for public source-generated APIs

* Rename tildeIndex to backTickIndex for consistency

* Simplify XML comments

* Update JsonTypeInfo<T> XML comment

2 years agoFix for #70007, fallback to old implementation if optimized way fails (#70073)
Carsten Schuette [Tue, 26 Jul 2022 17:40:42 +0000 (19:40 +0200)]
Fix for #70007, fallback to old implementation if optimized way fails (#70073)

* Fallback to old implementation if optimized way to query process name fails (#70007)

* Add helper tool that reads the parent process name and writes it to the console (#70007)

* Add test

* Revert "Add helper tool that reads the parent process name and writes it to the console (#70007)"

This reverts commit fa3addb0dd6c61b8cc238238e106ad8f3b6da9ae.

* Remove extra newline

Co-authored-by: David Cantú <dacantu@microsoft.com>
2 years agoAdd analyzer support to validate the stateless marshaller shapes (#72643)
Jeremy Koritzinsky [Tue, 26 Jul 2022 17:16:37 +0000 (10:16 -0700)]
Add analyzer support to validate the stateless marshaller shapes (#72643)

2 years agoFix missing shifting of Match._textxx fields (#72728)
Stephen Toub [Tue, 26 Jul 2022 16:40:00 +0000 (12:40 -0400)]
Fix missing shifting of Match._textxx fields (#72728)

This regressed during the work to support spans.  The Match._textxx fields were set based on the span positions rather than the input string positions, so if the input string had a non-zero beginning value, these fields would be off by that amount.  That then impacts NextMatch, as these values are fed into it.

While fixing this, I noticed that the _textstart field was wholely unnecessary and deleted it.  I also noticed we were unnecessarily passing around some values that weren't needed (e.g. a runtextbeg value that would always be 0), and re-storing the _regex object that can't ever change, and addressed those.

2 years agoAdd CertificateRevocationListBuilder
Jeremy Barton [Tue, 26 Jul 2022 16:36:53 +0000 (09:36 -0700)]
Add CertificateRevocationListBuilder

The type can create CRLs, and can load the RevocationList aspect of an existing CRL into a new builder,
but there is not support at this time for inspecting a CRL.

2 years agoClarify the purpose of the official discord (#72861)
Michał Petryka [Tue, 26 Jul 2022 16:31:15 +0000 (18:31 +0200)]
Clarify the purpose of the official discord (#72861)

2 years agoMake RateLimiterOptions follow Options pattern (#72530)
William Godbe [Tue, 26 Jul 2022 16:28:13 +0000 (09:28 -0700)]
Make RateLimiterOptions follow Options pattern (#72530)

* Update ConcurrencyLimiterOptions.cs

* Update FixedWindowRateLimiterOptions.cs

* Update FixedWindowRateLimiterOptions.cs

* Update FixedWindowRateLimiterOptions.cs

* Update SlidingWindowRateLimiterOptions.cs

* Update TokenBucketRateLimiterOptions.cs

* Update ConcurrencyLimiter.cs

* Update FixedWindowRateLimiter.cs

* Update SlidingWindowRateLimiter.cs

* Update TokenBucketRateLimiter.cs

* Update ChainedLimiterTests.cs

* Update ConcurrencyLimiterOptions.cs

* Update FixedWindowRateLimiterOptions.cs

* Update SlidingWindowRateLimiterOptions.cs

* Update TokenBucketRateLimiterOptions.cs

* Update RateLimitPartition.cs

* Update System.Threading.RateLimiting.cs

* Update ChainedLimiterTests.cs

* Update ConcurrencyLimiter.cs

* Update FixedWindowRateLimiter.cs

* Update SlidingWindowRateLimiter.cs

* Update TokenBucketRateLimiter.cs

* Update ConcurrencyLimiterOptions.cs

* Update FixedWindowRateLimiterOptions.cs

* Update SlidingWindowRateLimiterOptions.cs

* Update ChainedLimiterTests.cs

* Update ChainedLimiterTests.cs

* Fix tests

* Update ConcurrencyLimiter.cs

* Update FixedWindowRateLimiter.cs

* Update SlidingWindowRateLimiter.cs

* Update TokenBucketRateLimiter.cs

* Update FixedWindowRateLimiter.cs

* Update SlidingWindowRateLimiter.cs

* Update TokenBucketRateLimiter.cs

* Update FixedWindowRateLimiterTests.cs

* Update SlidingWindowRateLimiterTests.cs

* Update TokenBucketRateLimiterTests.cs

* Update TokenBucketRateLimiter.cs

* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/ConcurrencyLimiter.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/ConcurrencyLimiter.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update FixedWindowRateLimiter.cs

* Update SlidingWindowRateLimiter.cs

* Fixup

* Whitespace

* ArgumentNullException

* React to test change

* Fix tests

* Another test fix

* Feedback

* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/ConcurrencyLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/FixedWindowRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/FixedWindowRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/SlidingWindowRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/SlidingWindowRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Update src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiterOptions.cs

Co-authored-by: Brennan <brecon@microsoft.com>
* Fix checks, add test

Co-authored-by: Brennan <brecon@microsoft.com>
2 years ago[wasm] optimize WebSocket perf for small buffers (#72800)
Pavel Savara [Tue, 26 Jul 2022 14:47:26 +0000 (16:47 +0200)]
[wasm] optimize WebSocket perf for small buffers (#72800)

* use MemoryHandle instead of ArraySegment marshaling to improve WS performance for small buffers
* re-use responseStatus buffer

2 years agoRemove Http3RequestStream from _activeRequest when response is read/aborted. (#72670)
Radek Zikmund [Tue, 26 Jul 2022 14:43:30 +0000 (16:43 +0200)]
Remove Http3RequestStream from _activeRequest when response is read/aborted. (#72670)

* Remove Http3RequestStream from _activeRequest when response is read/aborted.

* Add time limit in test

* Wait for both sides to be completed

* Code review feedback

2 years agoFix running HTTP stress tests on local docker (#72844)
Natalia Kondratyeva [Tue, 26 Jul 2022 14:28:16 +0000 (16:28 +0200)]
Fix running HTTP stress tests on local docker (#72844)

2 years ago[iOS] Enable System.Data.Common tests (#72554)
Mitchell Hwang [Tue, 26 Jul 2022 13:50:03 +0000 (09:50 -0400)]
[iOS] Enable System.Data.Common tests (#72554)

* [libs] Reenable TokenForEmptyFilter Microsoft.Extensions.FileProviders.Physical Test

* [iOS] Enable System.Data.Common Tests

2 years agoEmit warning instead of an error in package compat (#72518)
Viktor Hofer [Tue, 26 Jul 2022 13:35:36 +0000 (15:35 +0200)]
Emit warning instead of an error in package compat (#72518)

Based on the discussed in https://github.com/open-telemetry/opentelemetry-dotnet/issues/3448, we are now emitting a warning instead of an error on unsupported target frameworks. We still explicitly indicate that this is an unsupported scenario but don't actively block consumers anymore and also indicate how to suppress the warning.

2 years ago[wasm] improve startup (#72275)
Pavel Savara [Tue, 26 Jul 2022 11:52:15 +0000 (13:52 +0200)]
[wasm] improve startup (#72275)

- streaming wasm instantiation
- more parallel download of DLLs
- new hook `downloadResource` and `config.assets[].resolvedUrl `
- improved `locateFile` allows to run dotnet with another working directory
- call `init_crypto` in blazor startup sequence

Co-authored-by: Marek Fišera <mara@neptuo.com>
2 years agoRemoving the PublishAot check from the SDK (#72820)
Lakshan Fernando [Tue, 26 Jul 2022 11:42:25 +0000 (04:42 -0700)]
Removing the PublishAot check from the SDK (#72820)

2 years agoJIT: Fix creating small-typed LCL_VAR nodes in fgMakeTemp (#72771)
Jakob Botsch Nielsen [Tue, 26 Jul 2022 11:25:48 +0000 (13:25 +0200)]
JIT: Fix creating small-typed LCL_VAR nodes in fgMakeTemp (#72771)

Fix #72763

2 years agoFix HttpListenerRequestUriBuilder.GetPath's search for `?` (#72794)
Stephen Toub [Tue, 26 Jul 2022 11:12:45 +0000 (07:12 -0400)]
Fix HttpListenerRequestUriBuilder.GetPath's search for `?` (#72794)

It's intended to only be searching in the path, but earlier logic may have detected the path to start beyond 0.

2 years agoBail second pass redirection after catch in thread abort on Unix (#72705)
Juan Hoyos [Tue, 26 Jul 2022 09:42:12 +0000 (02:42 -0700)]
Bail second pass redirection after catch in thread abort on Unix (#72705)

The redirection stub was never implemented, leading to crashes in scenarios like Debugger Function Evaluations. Instead of rethrowing the exception after the catch clause, this allows the ThreadAbortException to flow as any usual exception and hopefully surface through other points that call mechanisms like Thread::HandleThreadAbort. This is a behavior difference between Unix and non-Unix plaforms with some observable side effects, but Thread.Abort is not supported in core. Most commonly the debugger is the major scenario where ThreadAbort gets used, and this prevents the crash.

2 years agoRepresent field RVA data with a dedicated node (#72826)
Michal Strehovský [Tue, 26 Jul 2022 06:20:16 +0000 (15:20 +0900)]
Represent field RVA data with a dedicated node (#72826)

We were using the general purpose `ReadOnlyDataBlobNode` but that meant that whenever we needed to refer to one, we had to read the RVA data into a freshly allocated array and then see if there's a node with that data.

Removes 200 MB of allocations while compiling the Techempower benchmark.

2 years agoFix MemoryCache test failures due to race (#72821)
Dan Moseley [Tue, 26 Jul 2022 04:40:06 +0000 (22:40 -0600)]
Fix MemoryCache test failures due to race (#72821)

2 years ago[wasm] Move some defaults out of the templates (#72626)
Larry Ewing [Mon, 25 Jul 2022 21:08:25 +0000 (16:08 -0500)]
[wasm] Move some defaults out of the templates (#72626)

* Move some defaults out of the template
* Fix build for template tests, and satellite assembly tests

- Running with `node` fails when relinking, or AOT'ing in Debug config
- this seems to be when linking is done with `-O0`
  - it seems to work fine with emsdk `3.1.7` though
  - For `Debug` config we automatically set `_WasmDevel=true`, which
  then sets `-O0`

  - This is not seen on CI, since we don't run non-template tests in
  `Debug`. But for local runs, we do.
  - The template tests are explicitly run for Debug, and Release, and
  they break because of this
  - So, setting `_WasmDevel=false` for now, till this gets fixed

- Also, set `OutputType=Exe` in the project file itself, so it gets set
before `Microsoft.NET.Sdk` gets imported, or early enough.

* Wasm.Build.Tests: add relinking tests for templates

* Revert unintended change

* Fix WasmTemplateTests on windows

* Wasm.Build.Tests: Explicitly allow web server port in chrome, on windows

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

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoJIT: add more inlining bail out checks (#72795)
Andy Ayers [Mon, 25 Jul 2022 21:03:23 +0000 (14:03 -0700)]
JIT: add more inlining bail out checks (#72795)

When inlining, new temp allocation may fail, and callers of methods
that allocate new temps must do suitable checks.

Add a few that were missing.

Fixes #64787.

2 years ago[iOS] Enable Diagnostics.Tracing tests (#72545)
Steve Pfister [Mon, 25 Jul 2022 20:32:45 +0000 (13:32 -0700)]
[iOS] Enable Diagnostics.Tracing tests (#72545)

This change modifies System.Diagnostics.Tracing tests to enable the diagnostics runtime component feature.  Additionally, the AppleAppBuilder task was modified to read the `AotDataFile` path that is produced when aot'ing assemblies.  Previously, we would assume they were located in the publish directory.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoRe-enable the ability to use in-build signing (#72690)
Matt Mitchell [Mon, 25 Jul 2022 20:20:25 +0000 (13:20 -0700)]
Re-enable the ability to use in-build signing (#72690)

Re-enable in-build signing (as an option, not on by default yet). In constrast to how in-build signing was performed previously for any installer artifacts, the new in-build signing uses the same exact approach as post-build signing does today. Pass all top-level artifacts and wixpacks as ItemsToSign, and let the signing infrastructure do all the unpacking and repacking.

Also increase the timeout in the prepare-artifacts stage.

2 years agoEnable NI_Vector256_Create on AVX1 (#72522)
Egor Bogatov [Mon, 25 Jul 2022 19:03:44 +0000 (21:03 +0200)]
Enable NI_Vector256_Create on AVX1 (#72522)

2 years agoImprove String.EndsWith for OrdinalIgnoreCase (#72750)
Egor Bogatov [Mon, 25 Jul 2022 19:03:24 +0000 (21:03 +0200)]
Improve String.EndsWith for OrdinalIgnoreCase (#72750)

2 years agowhen building on Ubuntu, avoid warning on shlibdeps libSystem.IO.Compression.Native...
Miriam España Acebal [Mon, 25 Jul 2022 18:49:12 +0000 (20:49 +0200)]
when building on Ubuntu, avoid warning on shlibdeps libSystem.IO.Compression.Native.so contains an unresolvable reference to symbol log2: it's probably a plugin (#72785)

2 years agoDispose of IncrementalHash in CmsSigner
Kevin Jones [Mon, 25 Jul 2022 18:14:54 +0000 (14:14 -0400)]
Dispose of IncrementalHash in CmsSigner

2 years agofix project references, transient dependency doesn't work great on windows (#72787)
Pavel Savara [Mon, 25 Jul 2022 17:17:20 +0000 (19:17 +0200)]
fix project references, transient dependency doesn't work great on windows (#72787)

2 years ago[wasm-ep] Implement DiagnosticServer and startup sessions for WebAssembly (#72482)
Aleksey Kliger (λgeek) [Mon, 25 Jul 2022 17:16:38 +0000 (13:16 -0400)]
[wasm-ep] Implement DiagnosticServer and startup sessions for WebAssembly (#72482)

Add a diagnostic server for WebAssembly.  Enable by building the runtime with `/p:WasmEnablePerfTracing=true` or `/p:WasmEnableThreads=true`.

To configure a project to start the diagnostic server, add this to the .csproj:
```xml
      <WasmExtraConfig Include="diagnostic_options" Value='
{
  "server": { "suspend": false, "connect_url": "ws://localhost:8088/diagnostics" }
}' />
```

The `connect_url` should be a WebSocket url serviced by `dotnet-dsrouter server-websocket` **from this branch** https://github.com/lambdageek/diagnostics/tree/wasm-server

Note that setting `"suspend": true` will hang the browser tab until a diagnostic tool such as `dotnet-trace collect` connects to the dsrouter.

---

Implement creating VFS file based sessions at runtime startup.  Add the following to a .csproj:

```xml
    <WasmExtraConfig Include="diagnostic_options" Value='
{
  "sessions": [ { "collectRundownEvents": "true", "providers": "WasmHello::5:EventCounterIntervalSec=1" } ]
}' />
```

That will create and start one or more EventPipe sessions that will store their results into the VFS.

The startup session can be retrieved via `MONO.diagnostics.getStartupSessions()`.  Each session `s` should be stopped via `s.stop()` and the data can then be extraced in a `Blob` using `s.getTraceBlob()`.

This is orthogonal to the diagnostic server support.  You don't need `dotnet-dsrouter` running on the host.  But you do need access to JavaScript on the main thread.

---

Notes/Issues:

* Tree shaking: I verified that if threads are not available, all the TypeScript diagnostics code is removed.
* Right now the server is not very robust to `dotnet-dsrouter` stopping, or starting after the runtime starts.  The ideal order is to start `dotnet-dsrouter` first, and then open the browser
* Unrelated housekeeping fixes:
   * Tell `wasm.proj` about all the subdirectories with .ts files - makes incremental builds notice changes in subdirectories.
   * Add a rollup `dependencies` property to quiet a warning about `node/buffer`
   * There's a mock implementation of a "websocket" that was used for protocol testing. I verified that tree-shaking removes this in thread-enabled Release builds.
   * Bump `PTHREAD_POOL_SIZE` to `4` and set `PTHREAD_POOL_SIZE_STRICT=2` (returns `EAGAIN` from `pthread_create` if the pool needs to grow).  The previous setting `PTHREAD_POOL_SIZE_STRING=1` (warn and try to grow the pool) seemed to lead to hangs.  Usually that means the main thread is creating a thread and immediately calling `pthread_join` without returning to JS. We should investigate separately.
   * The only implemented diagnostic server commands are `CollectTracing2`, `StopCollecting` and `ResumeRuntime`. None of the `Dump`, `Process` and `Profiler` commands are implemented and the server will crash if it receives them.  It should be relatively straightforward to return a "command unsupported" reply (which would allow clients to gracefully disconnect), but it's not done yet.
* In some error states the runtime kills the browser tab with the following in a terminal window (if Chrome is started from a terminal: `FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory`). This probably means we're hitting a loop somewhere that rapidly exhausts JIT memory, but it's difficult to investigate when the JS console dies, too (happens with chrome stable v103 and chrome beta v104).

Fixes https://github.com/dotnet/runtime/issues/69674, contributes to https://github.com/dotnet/runtime/issues/72481

---

* [wasm] Enable the tracing component if threading is supported

* add a way to specify EP sessions in the MonoConfig

   Currently not wired up to the runtime

* Add a mechanism to copy startup configs into the runtime and session IDs out

* checkpoint. Do more from JS

The issue is that once we're setting up streaming sessions, we will need to send back a DS IPC reply with the session id before we start streaming.  So it's better to just call back to JS when we start up and setup all the EP sessions from JS so that when we return to C everything is all ready.

* checkpoint: starting a session at startup works

* checkpoint add a controller and a webworker for DS

* checkpoint: diagnostic server

* fix eslint

* [diagnostic_server] wasm-specific fn_table

   We won't be using the native C version

* [wasm-ep] disable DS connect ports in C, too

   we will implement DS in JS

* Start diagnostic server pthread

Clean up some of the old WIP code - we will probably not send configuration strings from the diagnostic server back to the main thread.

* checkpoint: try to start the server

   It doesn't work right now because the MessagePort is not created until the server thread attaches to Mono, which doesn't happen because it's started before Mono.

Also it doesn't yet send a resume event, so the main thread just blocks forever

* Add a mock WebSocket connection to simulate the remote end

   Start the diagnostic server and have it perform the open/advertise steps with the mock.

* wasm-mt: use a PThreadSelf struct instead of a raw MessagePort

* Move all the EP and diagnostic server modules to one directory

* Refactor; remove dead code; rationalize controller

the flow is now:

```
main -{creates pthread}->              server
  .                                      server creates event listener
  .  <-{sends diagnostic MessagePort}-   .
main creates event listener              .
  .  -{posts "start" message}->          .
  .                                      begins server loop
```

after the server loop is running, the main thread will get a "resume_startup" message once the diagnostic server receives the right command from the websocket.

next TODO: the runtime needs to send a "attach to runtime" message which will signal the server that it can attach to the runtime (in native) and start calling EP session creation functions.

* checkpoint: start adding queue from streaming thread to DS thread

We can't set up a shared MessagePort very easily (we need to bounce through the main thread but it probably won't be able to process our message until it's too late).

Also Atomics.waitAsync isn't available on many browsers (Chrome only).

So we use emscripten's dispatch mechanism to trigger an event in the diagnostic thread to wake up and service the streaming thread's queue. Right now the queue is dumb so we trigger on every write.  and also the write is synchronous.

But it's simple to think about and it's implementable.

* [wasm] Incremental build and rollup warnings cleanups

- Add 'node/buffer' as an extrenal dependency. This doesn't do anything except quiet a rollup warning about the import.
- Add all the .ts files, and the tsconfig files (except node_modules) to the rollup inputs, to make sure we re-run rollup when anything changes.

* WIP: work on wiring up DS protocol commands (mock); resume hack

- start adding commands so that we can strt some sessions from DS
- we can't avoid a busy loop in ds_server_wasm_pause_for_diagnostics_monitor.
  we can't make the main thread pause until we get a resume command
  until after we're able to start an EP session (DS client won't send
  a resume command until we send an EP session ID back).  If the DS
  pauses until it can attach to the runtime, and the runtime pauses
  until DS tells it to resume, the main thread pause has to be after
  we get EP and DS initialized.  But that means it can't be async.  So
  we'll just have to busy wait on a condition variable in native.

* WIP: set up a WasmIpcStream, create EP sessions from DS

Seems to create the session, but not seeing write events
yet. possibly due to not flushing?

* WIP: starting to stream works; needs PTHREAD_POOL_SIZE bump

Looks like we can send the initial nettrace header some events.

We're starting more threads, so we need a bigger thread pool.

Also PTHREAD_POOL_SIZE_STRICT=1 (the default - warn if worker pool needs to grow,
but still try to grow it) seems to deadlock the browser-eventpipe
sample.

Set PTHREAD_POOL_SIZE_STRICT=2 (don't try to allocate a worker, make
pthread_create fail with EAGAIN) instead so we get some kind of
exception instead in other circumstances.

Set the pool size to 4.

* cleanup browser-eventpipe sample

* call mono_wasm_event_pipe_early_startup_callback from event_pipe init

  instead of from the rundown_execution_checkpoint_2 function

* if diagnostics server isn't enabled, don't try to initialize it

* checkpoint: start parsing binary commands

* checkpoint: Can parse a CollectTracing2 command and attempt to create a
session!

* [wasm-ep] use the new PromiseController<T>

* get back to the server loop quicker by queueing the parsing in the microtask

* update mock for binary ADVR_V1 message

* sample: don't suspend, and use a mock url

* wasm_ipc_stream: wire up close command

   Use a sentinal "buf" value (-1) to signal that the writer closed the stream

* Send proper OK messages in replies to binary protocol commands

* (testing) turn off the file session for now

* remove em_asm(console.log); simplify wasm EP init

   Just call the EP JS callback directly from native

* remove debug output

* cleanup wasm ipc stream impl

* put diagnostics mocks behind a const flag

* don't build wasm-specific DS if threads are disabled

* refactor and cleanup

- Move the IPC parsing and serialization into separate files
- Try to have one responsibility per class
- update comments and docs

* help treeshaking

verified that all the DS and EP JS code is dropped if monoWasmThreads is false.

* update DS design notes

* use PromiseController in more places

* fix Windows build

* add MONO_WASM prefix to console logging outputs

* improve debug output for DS server

   keep track of open/advertise counts and print them when receiving replies

* bugfix: don't confuse buf_addr for the value stored in it

   the buf_addr is always the same for a given queue. the value in it is what we need to check to see if it's the sentinel value

* fix bug in queue_push_sync main thread detection

* merge fixup

* fix rollup warning when making the crypto worker

* add MONO_WASM: prefix to logging

* make diagnostic server mocking friendlier

   Allow each test project to specify its own mock script.

   Also provide TypeScript declarations for the mocking interfaces

   Also always use binary protocol commands - don't send json for mocks.

* disable mocking in the sample project by default

* fixup after merge

* review feedback

   - improve diagnostics mock README
   - note that mocking just uses ES6 modules, testing with CJS is not supported right now.
   - fix iteration over listeners when dispatching a one-shot event in the EventTargt polyfill
   - use U32 getter in EP session creation

2 years agoDelete dead code from and fix `getSIMDStructFromField` (#71226)
SingleAccretion [Mon, 25 Jul 2022 17:04:57 +0000 (20:04 +0300)]
Delete dead code from and fix `getSIMDStructFromField` (#71226)

* Clean out dead code from "getSIMDStructFromField"

The only pattern possible here is "FIELD(ADDR(LCL_VAR))".

* Fix the field type issue

* Fix the field offset issue

* Add tests

2 years agoEnable NJulianRuleTest (#72707)
Tarek Mahmoud Sayed [Mon, 25 Jul 2022 16:27:13 +0000 (09:27 -0700)]
Enable NJulianRuleTest (#72707)

2 years ago[mono][llvm] Fix generation of LLVM IR for OP_SSE_CVTII. (#72731)
Zoltan Varga [Mon, 25 Jul 2022 16:02:53 +0000 (12:02 -0400)]
[mono][llvm] Fix generation of LLVM IR for OP_SSE_CVTII. (#72731)

2 years agoInclude EventLog.Messages in WindowsDesktop pack (#72280)
Viktor Hofer [Mon, 25 Jul 2022 16:02:26 +0000 (18:02 +0200)]
Include EventLog.Messages in WindowsDesktop pack (#72280)

* Include EventLog.Messages in WindowsDesktop pack

The System.Diagnostics.EventLog.Messages assembly is missing from the WindowsDesktop transport package. Adding it to the package.

2 years agoJIT: teach VN to fold type comparisons (#72136)
Andy Ayers [Mon, 25 Jul 2022 15:45:17 +0000 (08:45 -0700)]
JIT: teach VN to fold type comparisons (#72136)

Teach VN to fold some comparisons involving calls to `TypeHandleToRuntimeType`.

Closes #71909.

2 years agoTryAddWithoutValidation ViaHeaderValue (#72741)
feiyun0112 [Mon, 25 Jul 2022 15:24:41 +0000 (23:24 +0800)]
TryAddWithoutValidation ViaHeaderValue (#72741)

* TryAddWithoutValidation ViaHeaderValue

* checking for 0

2 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 190001...
dotnet bot [Mon, 25 Jul 2022 15:11:28 +0000 (08:11 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1900011 (#72729)

2 years agoExpands a list of always trimmed mobile+web CA with few recently added (#72678)
Marek Safar [Mon, 25 Jul 2022 14:17:07 +0000 (16:17 +0200)]
Expands a list of always trimmed mobile+web CA with few recently added (#72678)

* Expands a list of aggressively trimmed CA with few recently added ones

* Add also UnscopedRefAttribute

2 years agoFix SendAsync_GetWithInvalidHostHeader_ThrowsException (#72779)
Radek Zikmund [Mon, 25 Jul 2022 14:02:00 +0000 (16:02 +0200)]
Fix SendAsync_GetWithInvalidHostHeader_ThrowsException (#72779)

2 years agoEnsure `GetCorElementType` returns value type for enums on Mono runtime (#72685)
mathieubourgeois [Mon, 25 Jul 2022 13:16:29 +0000 (09:16 -0400)]
Ensure `GetCorElementType` returns value type for enums on Mono runtime (#72685)

`Type.GetTypeCode` on Mono was calling `GetCorElementType`, which, when invoked on an enum nested in a generic class, would return `TypeCode.Object` instead of `TypeCode.Int32`. Matching to CoreClr, we change `GetCorElementType` to return `VALUETYPE` for enums to fix the issue. The original issue would also provoke Enum parsing to trigger an assert in a debug runtime and go through a slower, rare path for parsing as well.

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

2 years agoRevert "Detect truncated GZip streams (#61768)" (#72742)
Stephen Toub [Mon, 25 Jul 2022 13:10:39 +0000 (09:10 -0400)]
Revert "Detect truncated GZip streams (#61768)" (#72742)

* Revert "Detect truncated GZip streams (#61768)"

This reverts commit e71a46b90451a4f6892a199b4e6098f25f72de05.

* Add regression test

2 years ago[wasm][debugger] Fix test regressions (#72751)
Ankit Jain [Mon, 25 Jul 2022 12:12:37 +0000 (08:12 -0400)]
[wasm][debugger] Fix test regressions (#72751)

* [wasm][debugger] Fix test regressions

```
DebuggerTests.BreakpointTests.StepThroughOrNonUserCodeAttributeWithUserBp(justMyCodeEnabled: False, debuggingFunction: "Debugger.stepInto", evalFunName: "RunStepThrough", functionNameCheck1: "StepThrougUserBp", line1: 841, col1: 8, functionNameCheck2: "RunStepThrough", line2: 848, col2: 4) [FAIL]
..
Expected: DebuggerAttribute.StepThrougUserBp
Actual:   DebuggerAttribute.StepThroughUserBp
```

And
```
[xUnit.net 00:08:39.10]     DebuggerTests.BreakpointTests.StepThroughOrNonUserCodeAttributeResumeWithBp(justMyCodeEnabled: False, evalFunName: "RunStepThrough", decoratedFunName: "StepThrougBp") [FAIL]
  Failed DebuggerTests.BreakpointTests.StepThroughOrNonUserCodeAttributeResumeWithBp(justMyCodeEnabled: False, evalFunName: "RunStepThrough", decoratedFunName: "StepThrougBp") [80 ms]
  Error Message:
   Assert.True() Failure
Expected: True
Actual:   False
  Stack Trace:
     at DebuggerTests.DebuggerTestBase.SetBreakpointInMethod(String assembly, String type, String method, Int32 lineOffset, Int32 col, String condition) in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 1096
   at DebuggerTests.BreakpointTests.StepThroughOrNonUserCodeAttributeResumeWithBp(Boolean justMyCodeEnabled, String evalFunName, String decoratedFunName) in /_/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs:line 668
--- End of stack trace from previous location ---
```

Caused by:
```
commit 9d6396deb02161f5ee47af72ccac52c2e1bae458
Author: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date:   Sun Jul 24 06:24:28 2022 +0300

    Fix typos (#72709)
```

* Missing typo fixes.

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
2 years agoFix ARM64 Unix debugging (#72735)
Juan Hoyos [Mon, 25 Jul 2022 08:33:43 +0000 (01:33 -0700)]
Fix ARM64 Unix debugging (#72735)

2 years ago[mono] Include dynamic methods in stacktrace (#72732)
Vlad Brezae [Mon, 25 Jul 2022 07:46:23 +0000 (10:46 +0300)]
[mono] Include dynamic methods in stacktrace (#72732)

Same as coreclr

2 years agoFix ReflectionCachesUpdateHandler_CachesCleared test in aggressive trim mode (#72682)
Eric Erhardt [Mon, 25 Jul 2022 06:25:38 +0000 (00:25 -0600)]
Fix ReflectionCachesUpdateHandler_CachesCleared test in aggressive trim mode (#72682)

The test uses a reflection pattern that isn't recognized by the trimmer. Changing it to use one that is recognized by the trimmer so it doesn't remove the type being tested.

Fix #57456

2 years agoAvoid transformation from multiplication to left shift in case of 64 bit value (...
Alhad Deshpande [Mon, 25 Jul 2022 05:35:44 +0000 (11:05 +0530)]
Avoid transformation from multiplication to left shift in case of 64 bit value (#71189)

2 years agoAvoid some unnecessary static readonly arrays (#72727)
Stephen Toub [Sun, 24 Jul 2022 22:50:09 +0000 (18:50 -0400)]
Avoid some unnecessary static readonly arrays (#72727)

* Avoid some unnecessary static readonly arrays

* Address PR feedback

* Address PR feedback

2 years agoReplace a static readonly in[] in System.Data.Common (#72743)
Stephen Toub [Sun, 24 Jul 2022 20:36:55 +0000 (16:36 -0400)]
Replace a static readonly in[] in System.Data.Common (#72743)

There are a small number of values, all within the byte range.

2 years agoFixed stress error System.Exception: Completed unexpectedly (#72734)
Marie Píchová [Sun, 24 Jul 2022 18:07:37 +0000 (20:07 +0200)]
Fixed stress error System.Exception: Completed unexpectedly (#72734)

2 years agoAvoid unnecessary return val copying in tailcall-via-help (#72720)
Jakob Botsch Nielsen [Sun, 24 Jul 2022 17:37:50 +0000 (19:37 +0200)]
Avoid unnecessary return val copying in tailcall-via-help (#72720)

The initial implementation of this did not handle the fact that retbuf
can point to GC heap during reflection invoke. It was fixed in #39815,
but the way it was fixed was by copying it into a local. This changes
the fix so that we simply report the return value pointer as a byref
throughout the mechanism, which simplifies the JIT's handling and is a
perf improvement as well.

2 years agoRevert "Consolidate importer spilling code (#72291)" (#72738)
Jan Kotas [Sun, 24 Jul 2022 13:26:55 +0000 (06:26 -0700)]
Revert "Consolidate importer spilling code (#72291)" (#72738)

This reverts commit c624626419e125cdd3cd1f3814da92a54e416b25.

2 years agoFix nativeaot arm64 build on macOS (#72733)
Adeel Mujahid [Sun, 24 Jul 2022 13:01:17 +0000 (16:01 +0300)]
Fix nativeaot arm64 build on macOS (#72733)

2 years ago[main] Update dependencies from dotnet/arcade (#72672)
dotnet-maestro[bot] [Sun, 24 Jul 2022 12:40:11 +0000 (08:40 -0400)]
[main] Update dependencies from dotnet/arcade (#72672)

2 years ago[QUIC] Return connection dispose in H3loopback connection (#72713)
Marie Píchová [Sun, 24 Jul 2022 12:39:19 +0000 (14:39 +0200)]
[QUIC] Return connection dispose in H3loopback connection (#72713)

* Return connection dipose in H3loopback connection

* Fixed QuicError

2 years agoFix typos (#72709)
Adeel Mujahid [Sun, 24 Jul 2022 03:24:28 +0000 (06:24 +0300)]
Fix typos (#72709)

2 years ago[main] Update dependencies from dotnet/linker (#72597)
dotnet-maestro[bot] [Sat, 23 Jul 2022 22:31:15 +0000 (18:31 -0400)]
[main] Update dependencies from dotnet/linker (#72597)

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22369.1 -> To Version 7.0.100-1.22370.2

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

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22369.1 -> To Version 7.0.100-1.22371.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoConsolidate importer spilling code (#72291)
SingleAccretion [Sat, 23 Jul 2022 17:59:35 +0000 (20:59 +0300)]
Consolidate importer spilling code (#72291)

* Add tests

* Fix losing GLOB_REF on the LHS

The comment states we don't need it, which is incorrect.

Diffs are improvements because we block forward substitution of
calls into "ASG(BLK(ADDR(LCL_VAR<field>, ...)))", which allows
morph to leave the "can be replaced with its field" local alone.

* Prospective fix

Spill "glob refs" on stores to "aliased" locals.

* Delete now-not-necessary code

* Fix up asserts

* Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts

* Don't manually spill for 'st[s]fld'

* Revert 'Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts'

2 years agoDelete lvVerTypeInfo (#71597)
SingleAccretion [Sat, 23 Jul 2022 15:48:41 +0000 (18:48 +0300)]
Delete lvVerTypeInfo (#71597)

2 years agoImprove performance of RegistryKey.GetValue (#66918)
Stephen Toub [Sat, 23 Jul 2022 11:01:04 +0000 (07:01 -0400)]
Improve performance of RegistryKey.GetValue (#66918)

Reduces typical number of syscalls as well as avoids allocation (or uses the ArrayPool otherwise).

Also updates Corelib's copy of RegistryKey to match (with things like perf key support removed).

2 years agoUpdate some more dependencies pulling in Newtonsoft.Json 9.0.1 (#72662)
Jakob Botsch Nielsen [Sat, 23 Jul 2022 07:50:44 +0000 (09:50 +0200)]
Update some more dependencies pulling in Newtonsoft.Json 9.0.1 (#72662)

This time I've verified that Newtonsoft.Json 9.0.1 is no longer present
in any project.assets.json files.

2 years agoImprove reliability of WarningsAsErrors replacement (#72070)
Levi Broderick [Sat, 23 Jul 2022 07:50:02 +0000 (00:50 -0700)]
Improve reliability of WarningsAsErrors replacement (#72070)

* Improve reliability of WarningsAsErrors replacement

* PR feedback

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2 years agoFix ClonedServer_ActsAsOriginalServer test (#72698)
Stephen Toub [Sat, 23 Jul 2022 02:45:25 +0000 (22:45 -0400)]
Fix ClonedServer_ActsAsOriginalServer test (#72698)

We recently introduced a configuration of the pipe stream tests where named pipes are constructed with PipeOptions.None.  And in that configuration, the ClonedServer_ActsAsOriginalServer has started sporadically hanging.  It appears that the GetNamedPipeHandleStateW function called by NamedPipeClientStream.NumberOfServerInstances takes some lock that ReadFileW also holds while doing a synchronous read; as such, if the wrong interleaving of operations occurs, the queued work item that performs a read can end up blocking the assert check of NumberOfServerInstances from completing, and the test deadlocks.  The fix is simply to move the assert until after the write that satisifes the read.

2 years ago`LibraryImport` generator `AllowUnsafeBlocks` diagnostic (#72650)
Aaron Robinson [Sat, 23 Jul 2022 01:57:36 +0000 (18:57 -0700)]
`LibraryImport` generator `AllowUnsafeBlocks` diagnostic (#72650)

* LibraryImport generator AllowUnsafeBlocks diagnostic

2 years agoInclude libnethost.pdb in implementation packages (#72688)
Elinor Fung [Sat, 23 Jul 2022 01:19:14 +0000 (18:19 -0700)]
Include libnethost.pdb in implementation packages (#72688)

2 years agoAdd markdown readme for Microsoft.Extensions.DependencyModel (#72660)
MSDN.WhiteKnight [Sat, 23 Jul 2022 01:00:11 +0000 (06:00 +0500)]
Add markdown readme for Microsoft.Extensions.DependencyModel (#72660)

2 years agoFix debugger funceval deadlock (#72179)
Noah Falk [Fri, 22 Jul 2022 23:52:27 +0000 (16:52 -0700)]
Fix debugger funceval deadlock (#72179)

Fixes #60565

Visual Studio devs reported that debugger funcevals were deadlocking because the
PinnedHeapHandleTableCrst was held while threads were suspended. This change
refactors that code path so that the AllocateHandles() operation where the lock is held
gets split into two parts and the GC allocation where the debugger could suspend is
outside the region where the critical section is held.

In the old code the PinnedHeapHandleTable was synchronized by one of two different locks, either the AppDomainHandleTable lock or the GlobalStringLiteralMap. In the new code AppDomainHandleTable lock is renamed to PinnedHeapHandleTable lock and this lock is always what synchronizes the PinnedHeapHandleTable code. In the string literal code path the GlobalStringLiteralMap is taken first and the PinnedHeapHandleTable lock is taken second, but the PinnedHeapHandleTable is no longer reliant on that outer GlobalStringLiteralMap lock for correctness.

In terms of testing I can verify under a debugger that I can suspend in the GC allocation point and the PinnedHeapHandleTable lock isn't held. This doesn't of course prevent other locks from being held so at best it is a partial fix for the issue. Nobody had a known repro so I wasn't able to verify anything more specifically. I also confirmed the race cases on the InterlockedExchange paths worked how they were intended by forcing them with a native debugger.

2 years agoRespect ForceUTF8Encoding when encoding an X500DN
Kevin Jones [Fri, 22 Jul 2022 23:14:44 +0000 (19:14 -0400)]
Respect ForceUTF8Encoding when encoding an X500DN

The managed implementation did not respect the ForceUTF8Encoding flag when encoding a distinguished name. This changes the encoding to start respecting the flag, as Windows does.

2 years agoSupport ICU on Windows Server 2019 (#72656)
Tarek Mahmoud Sayed [Fri, 22 Jul 2022 23:10:48 +0000 (16:10 -0700)]
Support ICU on Windows Server 2019 (#72656)

2 years agoTighten nullable annotations on RegistryKey.GetValue (#72679)
Stephen Toub [Fri, 22 Jul 2022 21:48:03 +0000 (17:48 -0400)]
Tighten nullable annotations on RegistryKey.GetValue (#72679)

* Tighten nullable annotations on RegistryKey.GetValue

* Use nameof in attributes

2 years agoAdd X509AuthorityKeyIdentifierExtension
Jeremy Barton [Fri, 22 Jul 2022 21:45:53 +0000 (14:45 -0700)]
Add X509AuthorityKeyIdentifierExtension

Additionally fixes the recently added SubjectAltNames extension to use a shared OID instance.

2 years agoUtilize new C# support for nameof in attributes in same signature (#72686)
Stephen Toub [Fri, 22 Jul 2022 21:44:53 +0000 (17:44 -0400)]
Utilize new C# support for nameof in attributes in same signature (#72686)

nameof can now be used in attributes on and in method signatures to refer to parameter names in the same signature.

2 years agoChange PipeStream's sync I/O cancellation support to avoid blocking CancellationToken...
Stephen Toub [Fri, 22 Jul 2022 21:41:55 +0000 (17:41 -0400)]
Change PipeStream's sync I/O cancellation support to avoid blocking CancellationTokenSource.Cancel (#72612)

* Change PipeStream's sync I/O cancellation support to avoid blocking CancellationTokenSource.Cancel

In a degenerate case, where cancellation is requested between the cancellation being registered and the I/O being performed, and where the thread performing the I/O is delayed significantly, the thread calling CTS.Cancel to cancel the operation could be blocked waiting for the callback cancellation loop which is in turn waiting for the I/O to be performed.

This changes the implementation to not block Cancel by instead queueing the cancellation handling.

It also factors the whole implementation of the async-over-sync support into a helper class, setting us up to reuse it elsewhere as needed (and cleaning up the PipeStream code to avoid duplication).

* Address PR feedback

* Address PR feedback (and a few other tweaks)

2 years agoAdd support for static default interface methods (#72661)
Michal Strehovský [Fri, 22 Jul 2022 21:32:44 +0000 (06:32 +0900)]
Add support for static default interface methods (#72661)

We were only supporting default interface methods in the sense of non-abstract virtuals. We now also support overrides.

What's missing is support for diamond/reabstraction. I thin we need to make throwing stubs that we can dispatch to - it doesn't look like the strategy used in the VM (`callsiteCalloutHelper`) can be used for prejit. I don't want to increase the scope of this pull request, so we invalidate the entire method that has such dispatch.

2 years agoDisable ThrowDuringProcessLog_ShutsDownGracefully test (#72680)
Eric Erhardt [Fri, 22 Jul 2022 20:41:09 +0000 (14:41 -0600)]
Disable ThrowDuringProcessLog_ShutsDownGracefully test (#72680)

This test has been failing a few times a day. Disabling until it can be investigated to pass consistently.

See #71242

2 years agoFix DivRem bug (#72115)
Drew Kersnar [Fri, 22 Jul 2022 19:49:49 +0000 (14:49 -0500)]
Fix DivRem bug (#72115)

2 years agoAdd missing nullability annotation in CodeDom (#72532)
Dustin Campbell [Fri, 22 Jul 2022 19:22:12 +0000 (12:22 -0700)]
Add missing nullability annotation in CodeDom (#72532)

The `CodeTypeReference` constructors allow a `null` type name to be
provided, but one constructor was missed during annotation.

2 years agoDisable failing System.Text.Json tests on Android x86 and on Browser with threading...
Simon Rozsival [Fri, 22 Jul 2022 18:54:00 +0000 (20:54 +0200)]
Disable failing System.Text.Json tests on Android x86 and on Browser with threading enabled (#72664)

* Disable tests failing on Android x86

* Disable test projects timing out on multi-threaded Browser lanes

* Disable more tests on Android x86

* Replace conditional fact with active issue

* Fix build

* Disable 5 additional failing Android x86 tests

2 years agoPipeReaderStream.ReadInternal throws AggregateException unexpectedly (#70248)
Badre BSAILA [Fri, 22 Jul 2022 18:36:02 +0000 (20:36 +0200)]
PipeReaderStream.ReadInternal throws AggregateException unexpectedly (#70248)

* PipeReaderStream.ReadInternal throws AggregateException unexpectedly

* add unit test

* assert on error message

* Update src/libraries/System.IO.Pipelines/tests/PipeReaderStreamTests.nonnetstandard.cs

simplify task throwing exception

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoBump Intellisense package version to Preview6 (#72631)
Carlos Sanchez [Fri, 22 Jul 2022 18:08:29 +0000 (11:08 -0700)]
Bump Intellisense package version to Preview6 (#72631)

2 years agoFix Globalization tests (#72653)
Lakshan Fernando [Fri, 22 Jul 2022 16:05:57 +0000 (09:05 -0700)]
Fix Globalization tests (#72653)

* Fix Globalization tests

* enable test in rolling runs

2 years agoRemove wrong cgroups assert (#72372)
Jan Vorlicek [Fri, 22 Jul 2022 15:51:17 +0000 (17:51 +0200)]
Remove wrong cgroups assert (#72372)

* Remove wrong cgroups assert

When detecting the current cgroup version on Linux, checked and
debug builds assert when the filesystem type of /sys/fs/cgroup is
neither TMPFS_MAGIC nor CGROUP2_SUPER_MAGIC. This change removes
the assert and considers it as "no cgroup support".
Release builds already have this behavior.

Close #62960

* Update the nativeaot version too

2 years agoHTTP/3 Improved message for failing QUIC connection (#72374)
Corcodel Iulia [Fri, 22 Jul 2022 15:31:22 +0000 (18:31 +0300)]
HTTP/3 Improved message for failing QUIC connection (#72374)

* [#70949 issue] Made test and added inner exception for uninformative
message

* Apply suggestions from code review

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
* Solving the rest of the coding review

* Update src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs

Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
Co-authored-by: iuliaco <t-icorcodel@microsoft.com>
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
2 years agoAdd `UnscopedRefAttribute` (#72499)
Aaron Robinson [Fri, 22 Jul 2022 14:48:56 +0000 (07:48 -0700)]
Add `UnscopedRefAttribute` (#72499)

2 years ago[NativeAOT] Some cleanup of assembly helpers in hijack area. (#72542)
Vladimir Sadov [Fri, 22 Jul 2022 14:44:21 +0000 (07:44 -0700)]
[NativeAOT] Some cleanup of assembly helpers in hijack area. (#72542)

* remove RhpReversePInvokeAttachOrTrapThread  (dead code)

* remove RhpWaitForGC

* removing some dead code

* remove unused extraStack parameter to PUSH_PROBE_FRAME

* make all working variants of RhpGcProbeHijack to have the same shape

* fix Unix build, tweak some comments

* check the trap flag in RhpGcProbeHijack

* add a stub for RhpGcStressHijack on Unix

* save flags for windows x64 should not have rdx

* not saving scratch registers on win-arm64

* PUSH_PROBE_FRAME on arm64

* couple comments

* make RhpGcProbeHijack responsible for setting PTFF_SAVE_  bits

* revert `RhpReversePInvokeAttachOrTrapThread2` change

* fix indentation

* made 32bit RhpGcStressHijack similar to 64bit counterparts
(as much as can be done without trying to compile and test)

* Renamed `RhpGcProbe` --> `RhpWaitForGC`

2 years agoDelete ConservativelyReportedRegion and CallingConventionConverterHelpers (#72659)
Jan Kotas [Fri, 22 Jul 2022 14:06:02 +0000 (07:06 -0700)]
Delete ConservativelyReportedRegion and CallingConventionConverterHelpers (#72659)

2 years agoTemplates outputs ejs instead of cjs (#71951)
Yusuke Yamada [Fri, 22 Jul 2022 13:18:15 +0000 (22:18 +0900)]
Templates outputs ejs instead of cjs (#71951)

2 years agoFix potential out-of-bounds array accesses in System.Data.Operators (#72654)
Stephen Toub [Fri, 22 Jul 2022 13:09:54 +0000 (09:09 -0400)]
Fix potential out-of-bounds array accesses in System.Data.Operators (#72654)

2 years ago[QUIC] Support for OpenSSL build of MsQuic on Windows (Attempt 2) (#72609)
Radek Zikmund [Fri, 22 Jul 2022 12:40:38 +0000 (14:40 +0200)]
[QUIC] Support for OpenSSL build of MsQuic on Windows (Attempt 2) (#72609)

* Initial OpenSSL MsQuic support

* Don't check Windows version when OpenSSL is used

* Update src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
* Gracefully close the API handle before unloading the library

* Minor formatting change

* Update src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
2 years agoFix #72614. (#72630)
Eirik Tsarpalis [Fri, 22 Jul 2022 11:08:44 +0000 (14:08 +0300)]
Fix #72614. (#72630)

2 years agoAdditional tests for Generics in System.Text.Json.SourceGeneration (#72449)
Ilya Pospelov [Fri, 22 Jul 2022 10:17:17 +0000 (13:17 +0300)]
Additional tests for Generics in System.Text.Json.SourceGeneration (#72449)

* generic types tests

* test nested generic class serialization