platform/upstream/dotnet/runtime.git
14 months agoReact to HttpRequestError API changes (#89124)
Miha Zupan [Tue, 18 Jul 2023 23:45:39 +0000 (01:45 +0200)]
React to HttpRequestError API changes (#89124)

* React to HttpRequestError API changes

* Use InvalidResponse for net_http_invalid_response_multiple_status_codes

* Use HttpRequestError.Unknown for the rest

* Add simple tests for the HttpRequestError property

* Fix the inner exception being removed by mistake

14 months ago[main] Update dependencies from dotnet/icu dotnet/emsdk dotnet/hotreload-utils (...
dotnet-maestro[bot] [Tue, 18 Jul 2023 23:18:01 +0000 (18:18 -0500)]
[main] Update dependencies from dotnet/icu dotnet/emsdk dotnet/hotreload-utils (#89075)

* Update dependencies from https://github.com/dotnet/icu build 20230717.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.7.23360.1 -> To Version 8.0.0-preview.7.23367.1

* Update dependencies from https://github.com/dotnet/emsdk build 20230717.1

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-preview.7.23362.1 -> To Version 8.0.0-preview.7.23367.1

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20230717.4

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 8.0.0-alpha.0.23360.1 -> To Version 8.0.0-alpha.0.23367.4

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoImprove GC pause counter naming (#89052)
Andrew Au [Tue, 18 Jul 2023 23:04:16 +0000 (16:04 -0700)]
Improve GC pause counter naming (#89052)

14 months agoExpose the left-handed matrix creation APIs (#88930)
Tanner Gooding [Tue, 18 Jul 2023 22:44:06 +0000 (15:44 -0700)]
Expose the left-handed matrix creation APIs (#88930)

14 months ago[hot_reload] Check for added fields earlier in compute_class_bitmap (#89121)
Aleksey Kliger (λgeek) [Tue, 18 Jul 2023 22:33:52 +0000 (18:33 -0400)]
[hot_reload] Check for added fields earlier in compute_class_bitmap (#89121)

Added fields don't contribute to the class bitmap, and they also might not have their type resolved yet - move the "is from update" check before we need to access the field's type

Fixes #86172

* Add regression test

* [hot_reload] Check for added fields earlier in compute_class_bitmap and in mono_class_create_runtime_vtable

14 months agoImprove choice of IndexOfXx routine for some TryFindNextStartingPosition implementati...
Stephen Toub [Tue, 18 Jul 2023 21:38:16 +0000 (17:38 -0400)]
Improve choice of IndexOfXx routine for some TryFindNextStartingPosition implementations (#89099)

Earlier in .NET 8, we updated the Regex compiler and source generator to be able to vectorize a search for any set, not just simple ones.  When one of the main routines couldn't be used, we emit a specialized IndexOfAny helper that uses SearchValues to search for any matching ASCII character or a Unicode character, and if it encounters a Unicode character, it falls back to a linear scan.  This meant that a bunch of sets that wouldn't previously have taken these paths now do, but some of those sets have more efficient means of searching; for example, for the set `[^aA]` that searches case-insensitive for anything other than an 'A', with these scheme we'll emit a whole routine that uses SearchValues with a fallback, but we could just use IndexOfAnyExcept('A', 'a').  This fixes the compiler / source generator to prefer such helpers instead when available.

14 months agoLight up Ascii.Equality.Equals and Ascii.Equality.EqualsIgnoreCase with Vector512...
Khushal Modi [Tue, 18 Jul 2023 21:18:10 +0000 (14:18 -0700)]
Light up Ascii.Equality.Equals and Ascii.Equality.EqualsIgnoreCase with Vector512 code path (#88650)

* merging with main
Enabling AVX512 for ASCII.Equals

* Correcting defects in the new Equals for AVX512 case

* Correcting defects

* Upgrading ASCII.Equality.EqualsIgnoreCase

* Using intrinsics in AllCharsInVectorAreAscii

* Using intrinsics in AllCharsInVectorAreAscii

* Removing check for AVX512F and adding a check for Vector512 because the library is not using any functions from AVX512F

* Removing check for CompExactlyDependsOn(AVX512F) from AllCharsInVectorAreAscii for Vector 512. Also checking for Vector512 support and not AVX512F in ASCIIEquality.Equals

* Correcting the Tloader.Count512 for ushort

* resolving merge errors

* Adding TLoader method for Vector512 for EqualAndAscii

* Updating Load512 for WideningLoader for performance increase

* addressing review comments

* Addressing review changes. Changing Widen to WidenLower for Load512

14 months agoOpenSSL ENGINE support (#88656)
Krzysztof Wicher [Tue, 18 Jul 2023 20:29:49 +0000 (22:29 +0200)]
OpenSSL ENGINE support (#88656)

* OpenSSL ENGINE support

* Remove trailing spaces on README file

* Address PR feedback

* Test for PNSE and run tests on all platforms supporting OSSL

* Update IsOpenSslSupported

* s/IsOpenSslSupported/OpenSslPresentOnSystem

* Fix OpenSslNotPresentOnSystem on Windows

* Add preventive OpenSslIsAvailable check for better error handling

14 months agoAdd opt-in support for GeneratedComInterface/ComImport RCW interop (#87583)
Jeremy Koritzinsky [Tue, 18 Jul 2023 20:27:37 +0000 (13:27 -0700)]
Add opt-in support for GeneratedComInterface/ComImport RCW interop (#87583)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
14 months ago[mono] Align HOST_TVOS/TARGET_TVOS defines with the rest of the repo (#89085)
Alexander Köplinger [Tue, 18 Jul 2023 20:04:55 +0000 (22:04 +0200)]
[mono] Align HOST_TVOS/TARGET_TVOS defines with the rest of the repo (#89085)

In the mono build we've been setting HOST_IOS/TARGET_IOS when targeting tvOS which differs from the other runtime repo build systems and caused confusion. This aligns the defines so we only set the iOS ones on iOS and not on tvOS.

Also removes mono_dl_get_system_dir() since it was not actually used.

14 months agoReenable a test on iOS/tvOS/Browser that was disabled (#89083)
Alexander Köplinger [Tue, 18 Jul 2023 20:04:37 +0000 (22:04 +0200)]
Reenable a test on iOS/tvOS/Browser that was disabled (#89083)

14 months agoAdd more details in PlatformNotSupportedException (#89112)
Marie Píchová [Tue, 18 Jul 2023 19:32:36 +0000 (21:32 +0200)]
Add more details in PlatformNotSupportedException (#89112)

14 months agoJSON: Add support for Int128, UInt128 and Half (#88962)
David Cantú [Tue, 18 Jul 2023 19:29:40 +0000 (14:29 -0500)]
JSON: Add support for Int128, UInt128 and Half (#88962)

* JSON: Add support for Int128, UInt128 and Half and add Number support for Utf8JsonReader.CopyString(...)

* Remove parsing limits on Read and move Number support of CopyString to an internal helper

* Fix AllowNamedFloatingPointLiterals on Write for Half

* Specify InvariantCulture on TryParse and TryFormat
Fix handling of floating-point literals on HalfConverter
Remove CopyString tests related to Number support

* Add test for invalid number input format

* Fix net6.0 build error about missing Half.TryParse overload

* Move rentedCharBuffer logic to TryParse helper

* Address feedback

* Disable test for OSX

14 months agoUse Span.CopyTo(Span) in BigInteger's add and subtract (#83951), fixes #83457
Alexander Speshilov [Tue, 18 Jul 2023 19:20:19 +0000 (22:20 +0300)]
Use Span.CopyTo(Span) in BigInteger's add and subtract (#83951), fixes #83457

* Use Span.CopyTo(Span) in BigInteger's add and subtract

In BigIntegerCalculator methods Add and Subtract, if sizes of arguments
differ, after processing the part of size of the right (small) argument,
there was loop of add/sub carry value. When the carry value once become
zero, in fact the rest of the larger argument can be copied to the result.

With this commit the second loop is interrupted when carry become zero
and applies fast Span.CopyTo(Span) to the rest part.

This optimization applied only when size of the greatest argument is more
or equal to const CopyToThreshold introduced in this commit. This const
is 8 now.
See #83457 for details.

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
14 months agoFix broken runtime tests build (#89115)
Viktor Hofer [Tue, 18 Jul 2023 18:51:43 +0000 (20:51 +0200)]
Fix broken runtime tests build (#89115)

* Fix broken runtime tests build

Follow-up on https://github.com/dotnet/runtime/pull/89005

* Update build-test-job.yml

* Update sfx-ref.proj

14 months agoEnable SxS workload manifests (#88781)
Jacques Eloff [Tue, 18 Jul 2023 18:47:28 +0000 (11:47 -0700)]
Enable SxS workload manifests (#88781)

14 months agoDisable reflection in source gen tests and fix AOT testing. (#89105)
Eirik Tsarpalis [Tue, 18 Jul 2023 18:36:18 +0000 (19:36 +0100)]
Disable reflection in source gen tests and fix AOT testing. (#89105)

14 months ago[Android] Use NDK toolchain instead of CMake for library mode (#88886)
Steve Pfister [Tue, 18 Jul 2023 18:23:15 +0000 (11:23 -0700)]
[Android] Use NDK toolchain instead of CMake for library mode (#88886)

This change switches from relying on CMake to clang directly for Android library mode. The intent is to keep the number of build dependencies to a minimum.

14 months agoFixing concurrency issue in ManagedWebSocket where calling Dispose could corrupt...
Ivan Zlatanov [Tue, 18 Jul 2023 17:46:59 +0000 (20:46 +0300)]
Fixing concurrency issue in ManagedWebSocket where calling Dispose could corrupt state if there is pending send or receive operation and compression is enabled. (#87966)

14 months agoMark final types as exact (#88163)
Michał Petryka [Tue, 18 Jul 2023 17:46:32 +0000 (19:46 +0200)]
Mark final types as exact (#88163)

Co-authored-by: Andy Ayers <andya@microsoft.com>
14 months agoFold BOX+ISINST to null if possible (#88989)
Egor Bogatov [Tue, 18 Jul 2023 17:30:48 +0000 (19:30 +0200)]
Fold BOX+ISINST to null if possible (#88989)

14 months agoEnable Nullable compilation on the Options source gen (#88973)
Tarek Mahmoud Sayed [Tue, 18 Jul 2023 17:26:56 +0000 (10:26 -0700)]
Enable Nullable compilation on the Options source gen (#88973)

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
14 months agoFix FailedRequests_ConnectionClosedWhileReceivingHeaders_Recorded (#89047)
Anton Firszov [Tue, 18 Jul 2023 17:10:00 +0000 (19:10 +0200)]
Fix FailedRequests_ConnectionClosedWhileReceivingHeaders_Recorded (#89047)

14 months agoFix treating dotnet.wasm or dotnet.native.wasm as native asset (#89079)
Marek Fišera [Tue, 18 Jul 2023 17:02:16 +0000 (19:02 +0200)]
Fix treating dotnet.wasm or dotnet.native.wasm as native asset (#89079)

14 months agounroll byref struct copies (#86820)
Mark Plesko [Tue, 18 Jul 2023 16:57:26 +0000 (09:57 -0700)]
unroll byref struct copies (#86820)

If a struct contains a byref, then it is known to be on the stack/regs (not in the heap), so GC write barriers are not required.  This adds that case to lower*.cpp and attempts to make the code more similar.  I didn't actually factor them (especially with a few subtle differences such as the call to `getUnrollThreshold`).

This partially handles #80086.  It improves the code for common cases, but since the strategy is not always used, the correctness issue in it is not completely handled.  Next step is to apply the fix for that and see how bad the regressions are; this change will reduce the impact.

Example:

``` C#
static Span<int> Copy1(Span<int> s) => s;
```
``` asm
G_M44162_IG01:  ;; offset=0000H
       vzeroupper
;; size=3 bbWeight=1 PerfScore 1.00
G_M44162_IG02:  ;; offset=0003H
       vmovdqu  xmm0, xmmword ptr [rdx]
       vmovdqu  xmmword ptr [rcx], xmm0
;; size=8 bbWeight=1 PerfScore 6.00
G_M44162_IG03:  ;; offset=000BH
       mov      rax, rcx
;; size=3 bbWeight=1 PerfScore 0.25
G_M44162_IG04:  ;; offset=000EH
       ret
;; size=1 bbWeight=1 PerfScore 1.00

; Total bytes of code 15, prolog size 3, PerfScore 9.75, instruction count 5, allocated bytes for code 15 (MethodHash=4d5b537d) for method
```

Platform      | Overall | MinOpts | FullOpts
--------------|---------|---------|---------
linux arm64   |  -5,232 |  -3,260 |   -1,972
linux x64     |  -1,142 |    -750 |     -392
osx arm64     |  -5,732 |  -3,276 |   -2,456
windows arm64 |  -4,416 |  -2,580 |   -1,836
windows x64   |  -8,993 |  -5,772 |   -3,221
linux arm     | -13,518 |  -9,530 |   -3,988
windows x86   |       0 |       0 |        0

14 months agoUpdate script to replace the BDN version being used in the PerfBDN app to the same...
Parker Bibus [Tue, 18 Jul 2023 16:51:03 +0000 (09:51 -0700)]
Update script to replace the BDN version being used in the PerfBDN app to the same version we use for all BDN tests and in BDN extensions. (#89057)

14 months agoUpdate dependencies from https://github.com/dotnet/roslyn build 20230716.1 (#89077)
dotnet-maestro[bot] [Tue, 18 Jul 2023 16:12:30 +0000 (11:12 -0500)]
Update dependencies from https://github.com/dotnet/roslyn build 20230716.1 (#89077)

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-3.23361.9 -> To Version 4.7.0-3.23366.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoBump semver from 7.3.7 to 7.5.4 in /src/mono/sample/wasm/node-webpack (#88833)
dependabot[bot] [Tue, 18 Jul 2023 16:00:44 +0000 (12:00 -0400)]
Bump semver from 7.3.7 to 7.5.4 in /src/mono/sample/wasm/node-webpack (#88833)

Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.5.4.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.5.4)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
14 months ago[wasm] Fix perf pipeline (#89091)
Ankit Jain [Tue, 18 Jul 2023 15:47:12 +0000 (11:47 -0400)]
[wasm] Fix perf pipeline (#89091)

Passing arguments to bdn as `"--wasmArgs=--expose_wasm --module"` broke
with the latest update. Now this gets incorrectly parsed. Instead, what
works is: `--wasmArgs "--expose_wasm --module"`.

14 months agoBuild the shim assemblies as part of libs.sfx (#89005)
Viktor Hofer [Tue, 18 Jul 2023 15:24:35 +0000 (17:24 +0200)]
Build the shim assemblies as part of libs.sfx (#89005)

* Build the shim assemblies as part of libs.sfx

The shims build was intentionally kept out of the libs.sfx subset as
some shims reference out-of-band assemblies that also need to be built.

Since that change was made, the shim assemblies now don't reference all out-of-band
assemblies by default anymore and instead use fine grained dependencies.
Because of that, the number of out-of-band projects referenced and built
as part of the shims build is much smaller (~10 projects).

This fixes issues with ouf-of-band source generators not being able to
target the live targeting pack. These source generators need the shims
(more precisely the netstandard.dll shims) as some of the referenced
Microsoft.CodeAnalysis packages don't provide a .NETCoreApp assembly.

* Add fake assemblies for out-of-band type forward destinations

* Fix issues with nested classes and wrong type destinations

* Disable binplacing

* Make stubs private

* Disable symbols for stubs

* Add build protection to validate API compatibility of shims

14 months ago[workloads] Add linux-arm64 support for wasm and wasi (#89068)
Steve Pfister [Tue, 18 Jul 2023 15:06:19 +0000 (08:06 -0700)]
[workloads] Add linux-arm64 support for wasm and wasi (#89068)

Since https://github.com/dotnet/emsdk/pull/343, we are now able to support native linux-arm64 on wasm. This change adds linux-arm64 to wasm-tools and wasi-experimental workloads.

14 months agoRestructure NegotiateAuthentication implementation (#87930)
Filip Navara [Tue, 18 Jul 2023 14:02:49 +0000 (16:02 +0200)]
Restructure NegotiateAuthentication implementation (#87930)

* Change NegotiateAuthentication implementation to use indirection through NegotiateAuthenticationPal to the actual implementation.

The PAL implementation are merged from different sources to follow the same structure:
- NTAuthentication.Managed.cs -> NegotiateAuthenticationPal.Managed.cs
- NTAuthentication.Common.cs + NegotiateStreamPal.Windows.cs -> NegotiateAuthenticationPal.Windows.cs
- NTAuthentication.Common.cs + NegotiateStreamPal.Unix.cs -> NegotiateAuthenticationPal.Unix.cs

This split allows to delete ContextFlagsPal, SafeDeleteNegoContext, and SafeFreeNegoCredentials abstractions that were used in NegotiateStreamPal.

* Unify impersonation level validation between Windows and Unix pllatforms

* Split managed NTLM and managed SPNEGO implementations; add UseManagedNtlm switch on Unix platforms

* Remove debug cruft

* Fix couple of errors in managed SPNEGO

* Remove debug print

* Fix message sequence in managed NTLM; remove unused method

* Fix fallbacks on macOS GSSAPI

* Cleanup and fallbacks for missing NTLM, GSSAPI

* Adjust tests to assume that NTLM is always available on Unix

* Don't claim NTLM support on Browser

* Revert "Don't claim NTLM support on Browser"

This reverts commit 87d0c56f67a5269d9b334ab17887338ac4cfe49b.

* Attempt to fix the browser tests

* Revert "Attempt to fix the browser tests"

This reverts commit 91d7ce289a7274b682803b1d5dfdf418a5c2120c.

* Browser test suppression

* Respect UseManagedNtlm=false on platforms without NTLM GSSAPI provider

* Update src/libraries/System.Net.Security/src/System/Net/NegotiateAuthenticationPal.Unix.cs

* Revert all the fallback code paths, System.Net.Security.UseManagedNtlm has to be enabled explicitly; NativeAOT on Linux Bionic does that by default because it doesn't have GSSAPI and native shim

14 months agoDisable GCStress for Deserialize due to 88618 (#89072)
Mark Plesko [Tue, 18 Jul 2023 13:43:24 +0000 (06:43 -0700)]
Disable GCStress for Deserialize due to 88618 (#89072)

14 months agoAnnotate Trace.Assert/Fail with [DoesNotReturn{If}] (#89066)
Stephen Toub [Tue, 18 Jul 2023 13:38:21 +0000 (09:38 -0400)]
Annotate Trace.Assert/Fail with [DoesNotReturn{If}] (#89066)

As with Debug.Assert/Fail, by default failures result in fail fasts.  It's possible for other trace listeners to be plugged in instead, but there's no way to model that with nullable reference types.  There's no reason Trace should be on a different plan from Debug, so this moves it to having the same annotations Debug has had for years.

14 months agoImplement HttpRequestError (#88974)
Anton Firszov [Tue, 18 Jul 2023 13:30:47 +0000 (15:30 +0200)]
Implement HttpRequestError (#88974)

Fixes #76644, fixes #82168.

14 months ago[aot] Build cross compilers targeting x64/x86 hosted on arm64 (#89027)
Aleksey Kliger (λgeek) [Tue, 18 Jul 2023 13:22:12 +0000 (09:22 -0400)]
[aot] Build cross compilers targeting x64/x86 hosted on arm64 (#89027)

This PR allows an `osx-arm64` or `osx-x64` machine to produce a `mono-aot-cross` compiler that will run on the following host and create AOT images for the following targets:

| Host | Target | Test App runs |
|--------|--------|--------|
| osx-arm64 | iossimulator-x64 | ✅  |
| osx-arm64 | android-x64 | ✅   |
| osx-arm64 | android-x86 | ✅  - depends on a hack for https://github.com/dotnet/runtime/issues/89039 |

Additionally a `linux-x64` or `linux-arm64` machine can build a `mono-aot-cross` compiler for these host/target pairs:

| Host | Target | Test App runs |
|--------|--------|--------|
| linux-arm64 | android-x64 | :question: |
| linux-arm64 | linux_musl-x64 | :question: |
| linux-arm64 | android-x86 | :question: |

Related to https://github.com/dotnet/runtime/issues/82495

* [aot][ios] Build cross-compilers targeting x64 hosted on arm64

* Use MONO_CROSS_COMPILE instead of host checks

* [android][x86] Build mono-aot-cross hosted on osx-arm64 targeting android-x86

* fix build of mono-aot-cross hosted on linux-arm64 targeting android-x64

* runtime pipeline changes to build arm64 artifacts on x64 hardware

* Fix linux_musl-arm64 builds

---------

Co-authored-by: Jo Shields <directhex@apebox.org>
14 months agoDedup OnWriteResume between {ReadOnly}Memory converters (#89049)
Stephen Toub [Tue, 18 Jul 2023 11:24:19 +0000 (07:24 -0400)]
Dedup OnWriteResume between {ReadOnly}Memory converters (#89049)

14 months agoExtend SocketsHttpHandler Connection and Request telemetry (#88853)
Anton Firszov [Tue, 18 Jul 2023 11:03:39 +0000 (13:03 +0200)]
Extend SocketsHttpHandler Connection and Request telemetry (#88853)

Fixes #63159, fixes #85729.

14 months agoAdd NativeAOT runtime pack builds for osx x64/arm64 (#89018)
Alexander Köplinger [Tue, 18 Jul 2023 10:59:36 +0000 (12:59 +0200)]
Add NativeAOT runtime pack builds for osx x64/arm64 (#89018)

14 months ago[RISC-V][JIT] Fix DevDiv_718151 test (#88404)
Dong-Heon Jung [Tue, 18 Jul 2023 09:59:03 +0000 (18:59 +0900)]
[RISC-V][JIT] Fix DevDiv_718151 test (#88404)

* [RISC-V][JIT] Fix DevDiv_718151 test

* Remove HFA check on RISC-V

* [RISC-V][JIT] Update

- Update PUTARG_SPLIT
- Remove converting in PUTARG_STK

14 months agoRevert "Fix binding logic for dictionaries with complex elements (#89045)" (#89071)
Viktor Hofer [Tue, 18 Jul 2023 09:54:30 +0000 (11:54 +0200)]
Revert "Fix binding logic for dictionaries with complex elements (#89045)" (#89071)

This reverts commit 9fedcc558e8496424ee6af9fd3062c27ea3fd6e7.

14 months agoImprove text for OpenSsl primitives when OpenSSL is not available (#89046)
Kevin Jones [Tue, 18 Jul 2023 09:23:54 +0000 (05:23 -0400)]
Improve text for OpenSsl primitives when OpenSSL is not available (#89046)

* Improve text for OpenSsl primitives when OpenSSL is not available

* Update src/libraries/System.Security.Cryptography/src/Resources/Strings.resx

Co-authored-by: Stephen Toub <stoub@microsoft.com>
---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
14 months agoAdd switch: Do not resolve URLs by defaults for XML (#84169)
Krzysztof Wicher [Tue, 18 Jul 2023 09:13:18 +0000 (11:13 +0200)]
Add switch: Do not resolve URLs by defaults for XML (#84169)

* Add switch: Do not resolve URLs by defaults for XML

* feedback, test

* rename switch per API review

* Apply missed feedback, fix test failure

* Fix typo in IgnoreEmptyKeySequences

Co-authored-by: David Cantú <dacantu@microsoft.com>
* Update src/libraries/System.Private.Xml/tests/TrimmingTests/XmlUrlResolverDefaults.IsNetworkingEnabledByDefault.cs

Co-authored-by: David Cantú <dacantu@microsoft.com>
---------

Co-authored-by: David Cantú <dacantu@microsoft.com>
14 months agoImplement support for `UnsafeAccessor` in the trimmer (#88268)
Vitek Karas [Tue, 18 Jul 2023 07:33:40 +0000 (00:33 -0700)]
Implement support for `UnsafeAccessor` in the trimmer (#88268)

The core of the change is that `UnsafeAccessor` creates a code dependency from the accessor method to the target specified by the attribute. The trimmer needs to follow this dependency and preserve the target. Additionally, because the trimmer operates at the IL level, it needs to make sure that the target will keep its name and some other properties intact (so that the runtime implementation of the `UnsafeAccessor` can still work).

Implementation choices:
* The trimmer will mark the target as "accessed via reflection", this is a simple way to make sure that name and other properties about the target are preserved. This could be optimized in the future, but the savings are probably not that interesting.
* The implementation ran into a problem when trying to precisely match the signature overload resolution. Due to Cecil issues and the fact that Cecil's resolution algorithm is not extensible, it was not possible to match the runtime's behavior without adding lot more complexity (currently it seems we would have to reimplement method resolution in the trimmer). So, to simplify the implementation, trimmer will mark all methods of a given name. This means it will mark more than necessary. This is fixable by adding more complexity to the code base if we think there's a good reason for it.
* Due to the above choices, there are some behavioral differences:
  * Trimmer will warn if the target has data flow annotations, always. There's no way to "fix" this in the code without a suppression.
  * Trimmer will produce different warning codes even if there is a true data flow mismatch - this is because it treats the access as "reflection access" which produces different warning codes from direct access.
  * These differences are fixable, but it was not deemed necessary right now.
* We decided that analyzer will not react to the attribute at all, and thus will not produce any diagnostics around it.

The guiding reason to keep the implementation simple is that we don't expect the unsafe accessor to be used by developers directly, instead we assume that vast majority of its usages will be from source generators. So, developer UX is not as important.

Test changes:
* Adds directed tests for the marking behavior
* Adds tests to verify that `Requires*` attributes behave correctly
* Adds tests to verify that data flow annotations behave as expected (described above)
* The tests are effectively a second validation of the NativeAOT implementation as they cover NativeAOT as well.

Fixes in CoreCLR/NativeAOT:
This change fixes one bug in the CoreCLR/NativeAOT implementation, unsafe accessor on a instance method of a value type must use "by-ref" parameter for the `this` parameter. Without the "by-ref" the accessor is considered invalid and will throw.
This change also adds some tests to the CoreCLR/NativeAOT test suite.

Part of https://github.com/dotnet/runtime/issues/86161.
Related to https://github.com/dotnet/runtime/issues/86438.
Feature design in https://github.com/dotnet/runtime/issues/81741.

14 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 222410...
dotnet bot [Tue, 18 Jul 2023 06:39:28 +0000 (08:39 +0200)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2224107 (#89058)

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2223937

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2223937

14 months agoAddress Sanitizer support in CoreCLR (#74623)
Jeremy Koritzinsky [Tue, 18 Jul 2023 03:32:03 +0000 (20:32 -0700)]
Address Sanitizer support in CoreCLR (#74623)

* Enable AddressSanitizer in CoreCLR, Libs, and Host and update runtime-sanitized to run tests with ASAN on Linux and Mac

* Unify on HAS_ADDRESS_SANITIZER define name

Centralize setting up sanitizer flags.

Remove last usage of CLR_CMAKE_ENABLE_ASAN outside of eng/native

Remove unnecessary diffs

Use the cpuid intrinsic and enable ASAN on InitJitHelpers1.

Add comments for the places where we have ASAN disabled

Undo changes to src/coreclr/jit/CMakeLists.txt

Add docs and fix the docs in the build script.

Add docs for the SkipVCEnvInit hook

* Remove CRT runtime changes. We won't need this when we finally onboard to Windows with some changes they have coming down the pipeline, so remove them for now to reduce the diff of this PR.

* Remove suppression now that we've fixed the underlying issue.

* Remove some Windows-only sanitizer CMake that we won't need when ASAN is ready for us to consume on Windows.

* Set schedule for runtime-sanitized pipeline

* Remove workaround in JIT memory set/copy helpers now that the JIT bug has been fixed.

* Add missing helix queues setup template.

* Fix missing command to build nativeaot runtime tests as nativeaot.

* Add a scenario name to trigger the extended timeout in the libraries test helix configuration.

* Remove extraneous whitespace.

* Fix using the cross-targetting ILC when sanitizers are enabled. Also pass through our TargetOS and TargetArchitecture variables to the publish command for our native sanitizers targets to correctly do their extra logic.

* Disable LSAN on the CustomMain test.

* Disable some tests on sanitized runtimes.

* Copy the sanitizer runtime for OSX NativeAOT runtime tests.

* A little cleanup to try to get the build right now that we are always doing cross-builds on Linux.

* Fix crossgen-corelib.proj syntax.

* Fix cross-os dac builds to not include the host architecture in the output path.

* Split the debugger components into a separate component and make the "unsanitized cross components" build into an "unsanitized debugger components" build as it can't be part of the regular cross-components build

* Always write out the host-arch path on Windows and update the cross-dac build script to expect that.

* Change to use the dynamic runtime on Windows, as ASAN in VS is moving to a dynamic-only model.

* Update docker images to include the sanitizer runtimes in the crossrootfs images.

* Fix explicit image tags

* The unsanitized build should be of the target architecture, not the host architecture. As a result, we still need a cross-arch build for the cross-arch use cases when sanitized, as well as an unsanitized target arch build for the debugger tools.

* Turn off using the sigaltstack for NativeAOT tests that don't use the asansupport.cpp default options

* Make sure the shared ASAN runtime is present for the nativeaot/SmokeTests/SharedLibrary test.

* Disable crossgen2 tests with sanitizers as they don't get us interesting coverage.

* Fix custom default options and disable some more crossgen2-based tests.

* Simplify lookup of asan runtime on mac and fix copying the shared runtime for the SharedLibrary NativeAOT test.

* Disable test that's failing for weird reasons.

* Fix one more alloc-dealloc mismatch that only started to show up after test merging increased allocations in the runtime

* Disable the System.Text.Json test suite on sanitized builds as it causes SO failures on Mac

* Fix test exclusion

* PR feedback.

* Fix mac build

* Do review changes

* Add libbootstrapper object files to the platform manifest now that NativeAOT has

* Disable tests that check size on sanitized builds

* Use the built-in `include_guard` option

* Disable use-after-return checking in ASAN. CoreCLR doesn't do well with parallel stacks.

* Only pass the no UAR flag on C and CXX with Clang (not AppleClang).

14 months ago[mini] Enter GC Unsafe mode in handle_signal_exception (#88436)
Aleksey Kliger (λgeek) [Tue, 18 Jul 2023 03:16:21 +0000 (23:16 -0400)]
[mini] Enter GC Unsafe mode in handle_signal_exception (#88436)

When the runtime needs to turn some kinds of signals into managed
exceptions (for example: SIGINT turns into
`new ExecutionEngineException ("Interrupted (SIGINT)")`, and some
SIGFPE turn into `DivideByZeroException`, and some SIGSEGV turn into a
`NullReferenceException`) instead of unwinding the stack from inside a
signal handler it instead adjusts the normal stack so that when the
signal handler returns, execution will resume in
`handle_signal_exception`.

That means that if the runtime was in GC Safe mode when the signal
was raised, even if the signal handler code transitions to GC Unsafe
mode, by the time the `handle_signal_exception` runs, we will have
undone the GC Unsafe transition and will be back in GC Safe.

That means if the code in `handle_signal_exception` (notably
`mono_handle_exception`) calls anything that tries to do a transition
to GC Safe, we may get an assertion.

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

14 months agoRemove `#if NETCOREAPP` There is nothing net core specific about the assertions...
Mike Voorhees [Tue, 18 Jul 2023 03:07:41 +0000 (23:07 -0400)]
Remove `#if NETCOREAPP`   There is nothing net core specific about the assertions in this test.  No other tests in the `PreserveDependencies` folder have kept attributes inside of `#if NETCOREAPP` (#89041)

`DynamicDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction` is the same scenario and doesn't need the #ifs either

14 months agoFix binding logic for dictionaries with complex elements (#89045)
Layomi Akinrinade [Tue, 18 Jul 2023 02:54:52 +0000 (19:54 -0700)]
Fix binding logic for dictionaries with complex elements (#89045)

14 months agoDisable stackoverflowtester test for win-x86 (#89062)
Bruce Forstall [Tue, 18 Jul 2023 02:53:18 +0000 (19:53 -0700)]
Disable stackoverflowtester test for win-x86 (#89062)

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

14 months agofix pooled array leak (#88810)
Dan Moseley [Tue, 18 Jul 2023 02:52:06 +0000 (21:52 -0500)]
fix pooled array leak (#88810)

* ntlm

* test base

* qpack

* FileSys

* JSON

* interp tests

* fix NTAuthentication leak

* More in JSON

* more tests

* ntlmserver disposable

* more tests

* more tests

* tar tests

* feedback

14 months agoFeedback on regex parser PR (#89060)
Dan Moseley [Tue, 18 Jul 2023 02:27:04 +0000 (21:27 -0500)]
Feedback on regex parser PR (#89060)

14 months agoRemove createdump's DAC dependency for the PAL for NativeAOT (#88802)
Mike McLaughlin [Tue, 18 Jul 2023 02:05:53 +0000 (19:05 -0700)]
Remove createdump's DAC dependency for the PAL for NativeAOT (#88802)

* Remove createdump's DAC dependency for the PAL for NativeAOT

* Code review feedback - use utf16 mini pal functions

* Fix OSX build break

* Code review feedback

14 months agoAvoid unnecessary string allocations in Get/SetMsQuicParameter (#89050)
Stephen Toub [Tue, 18 Jul 2023 01:13:00 +0000 (21:13 -0400)]
Avoid unnecessary string allocations in Get/SetMsQuicParameter (#89050)

14 months agoFix Globalization Tests (#88969)
Tarek Mahmoud Sayed [Mon, 17 Jul 2023 23:28:07 +0000 (16:28 -0700)]
Fix Globalization Tests (#88969)

14 months agoLight up core ASCII.Utility methods with Vector256/Vector512 code paths. (#88532)
anthonycanino [Mon, 17 Jul 2023 22:23:26 +0000 (15:23 -0700)]
Light up core ASCII.Utility methods with Vector256/Vector512 code paths. (#88532)

* Lib upgrade for ToUtf16

* Upgrade NarrowUtf16ToAscii with Vector512

* Complete the upgrade in NarrowUtf16ToAscii method
with Vector512 and Vector256 APIs.

* Adding VectorXX paths to `GetIndexOfFirstNonAscii` functions.

* Adding optimization to Vecto256 VectorContainsNonAsciiChar method.

* Code path refactoring and cleanup.

* Code changes based on the review:
1. turn some variables into explicitly specified const.
2. removed some helper functions and inlined them.

* Resolve comments

* revert the changes at GetIndexOfFirstNonAsciiByte

---------

Co-authored-by: Ruihan-Yin <ruihan.yin@intel.com>
14 months agoTar: Fix PAX regression when handling the size of really long unseekable data streams...
Carlos Sánchez López [Mon, 17 Jul 2023 22:19:08 +0000 (15:19 -0700)]
Tar: Fix PAX regression when handling the size of really long unseekable data streams (#88280)

* Fix regression introduced by https://github.com/dotnet/runtime/pull/84279 preventing PAX entries with really long data streams to get its size correctly stored in the extended attributes when the data stream is unseekable.

* Move tests for large files to a new manual tests project.

14 months agowrap exceptions from callbacks in QuicError.CallbackError (#88614)
Tomas Weinfurt [Mon, 17 Jul 2023 22:08:01 +0000 (16:08 -0600)]
wrap exceptions from callbacks in QuicError.CallbackError (#88614)

* wrap exceptions from callbacks in QuicError.CallbackError

* feedback

14 months agoRegister a callback that tries to load other versions Open LDAP library if the defaul...
Buyaa Namnan [Mon, 17 Jul 2023 21:03:43 +0000 (14:03 -0700)]
Register a callback that tries to load other versions Open LDAP library if the default is failed (#88851)

* Register a callback to AssemblyLoadContext.Default.ResolvingUnmanagedDll event that tries to load other libraries

* Do not throw when library not found

* Check version 2.6 first

14 months agoEnable CA1863 (Use 'CompositeFormat') as suggestion (#89029)
Stephen Toub [Mon, 17 Jul 2023 20:52:57 +0000 (16:52 -0400)]
Enable CA1863 (Use 'CompositeFormat') as suggestion (#89029)

I ran it over runtime, and the only things flagged were for exceptional cases where it's not worth using.  Rather than a bunch of suppressions, I'm just enabling it as info-level.

14 months agoUse a HashSet instead of Dictionary in XNodeValidator (#89030)
Stephen Toub [Mon, 17 Jul 2023 20:52:24 +0000 (16:52 -0400)]
Use a HashSet instead of Dictionary in XNodeValidator (#89030)

14 months agoPrevent Arm64 CrossDac builds running on Arm64. (#88467)
C272 [Mon, 17 Jul 2023 20:43:20 +0000 (20:43 +0000)]
Prevent Arm64 CrossDac builds running on Arm64. (#88467)

* Prevent Arm64 CrossDac builds running on Arm64.

Currently, when building the CLR on win-arm64, CrossDac builds for
Linux with an (incorrect) host arch of x64 are attempted, failing
the build. This patch prevents those builds running on systems with
an identical host architecture to the cross target.

* Revert to simpler strategy of simply ignoring when arch != x86|x64.

14 months agoAdd collection literal support for immutable collections (#88470)
Stephen Toub [Mon, 17 Jul 2023 20:31:17 +0000 (16:31 -0400)]
Add collection literal support for immutable collections (#88470)

* Add collection literal support for immutable collections

Add the CollectionBuilderAttribute and use it on the supported immutable collections

* Address feedback

14 months ago[wasm][debugger] Check client version to send debugger message (#89025)
Thays Grazia [Mon, 17 Jul 2023 19:51:50 +0000 (16:51 -0300)]
[wasm][debugger] Check client version to send debugger message (#89025)

* Checking that BrowserDebugProxy is waiting for this new format to avoid incompatibility

* Fix compilation error

* fix message format

* Fix indentation

14 months agoDelete `VerifyExpectModifiedAttributesWork`. This test has bit rotted since being...
Mike Voorhees [Mon, 17 Jul 2023 19:41:20 +0000 (15:41 -0400)]
Delete `VerifyExpectModifiedAttributesWork`.  This test has bit rotted since being made netfx only and now fails due to etw feature removal logic no longer existing. (#89017)

This test dates back to earlier days when the linker had few mechanisms that modified bodies and UnityLinker had many.  I added this test to make sure that test framework support for this attribute didn't break since we depended on it.  Now days, the linker has many mechanisms that modify bodies and `[ExpectBodyModified]` is heavily used in tests.  I don't think there is any value in updating this test to use a different code pattern that results in needing `[ExpectBodyModified]`.

14 months agoDelete com removal tests (#89012)
Mike Voorhees [Mon, 17 Jul 2023 19:40:33 +0000 (15:40 -0400)]
Delete com removal tests (#89012)

14 months agoRemove the ignore from `CustomStepCanResolveTypesAfterSweep` (#89016)
Mike Voorhees [Mon, 17 Jul 2023 19:39:53 +0000 (15:39 -0400)]
Remove the ignore from `CustomStepCanResolveTypesAfterSweep` (#89016)

This ignore is pointless. `#if` cannot be used to ignore a test. Tests are collected from whatever version of `Mono.Linker.Tests.Cases` is handy.  It could be a net7 build.  It could be net471.

14 months agoAdd JsonSourceGenerationOptions.UseStringEnumConverter (#88984)
Eirik Tsarpalis [Mon, 17 Jul 2023 19:27:48 +0000 (20:27 +0100)]
Add JsonSourceGenerationOptions.UseStringEnumConverter (#88984)

* Add JsonSourceGenerationOptions.UseStringEnumConverter.

* Fix failing tests in browser-wasm

14 months ago[Mono] Add coreclr_shutdown to mono (#88594)
Giridhar Trivedi [Mon, 17 Jul 2023 19:21:40 +0000 (00:51 +0530)]
[Mono] Add coreclr_shutdown to mono  (#88594)

* [Mono] Add coreclr_shutdown to mono

   There was a crash seen in netcordbg due to unavailability of coreclr_shutdown in mono. Implemented it for mono.

---------

Co-authored-by: Giridhar Trivedi <giridhar.trivedi@ibm.com>
14 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230714...
dotnet-maestro[bot] [Mon, 17 Jul 2023 18:26:12 +0000 (13:26 -0500)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230714.2 (#88948)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.11.0-beta1.23363.2 -> To Version 3.11.0-beta1.23364.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoUpdate host RID in missing runtime/framework URL (#88359)
Elinor Fung [Mon, 17 Jul 2023 18:22:01 +0000 (11:22 -0700)]
Update host RID in missing runtime/framework URL (#88359)

14 months agoIntrinsify Array GetArrayDataReference for SZ arrays (#87374)
Michał Petryka [Mon, 17 Jul 2023 18:06:43 +0000 (20:06 +0200)]
Intrinsify Array GetArrayDataReference for SZ arrays (#87374)

14 months agoStandardize `AddBodySubstituterStep` (#89013)
Mike Voorhees [Mon, 17 Jul 2023 17:51:07 +0000 (13:51 -0400)]
Standardize `AddBodySubstituterStep` (#89013)

14 months agoRelaxing IsConnected Check for Datagram Sockets (#87916)
Ahmet Ibrahim Aksoy [Mon, 17 Jul 2023 17:38:25 +0000 (20:38 +0300)]
Relaxing IsConnected Check for Datagram Sockets (#87916)

* Relaxing IsConnected Check for Datagram Sockets

* Adding Listener inside Test

* Add relaxing to every Connect Path and invert condition to SocketType.Stream

* Make test theory and pass ipv4 ipv6 data

* Add LoopbacksAndAny

* Fix forgotten usage of parameter

* Handle OSX case

* Review feedback

14 months agoAdd SocketsHttpHandler requests-queue-duration metrics (#88981)
Miha Zupan [Mon, 17 Jul 2023 17:21:26 +0000 (19:21 +0200)]
Add SocketsHttpHandler requests-queue-duration metrics (#88981)

* Add SocketsHttpHandler requests-queue-duration metrics

* Use the IsDefaultPort helper in more places

* PR feedback

* Simplify queueStartingTimestamp logic in Http3Connection

14 months agoEnable ExtendedProtectionPolicy in generic System.Net.Security build (#88871)
Filip Navara [Mon, 17 Jul 2023 17:18:28 +0000 (19:18 +0200)]
Enable ExtendedProtectionPolicy in generic System.Net.Security build (#88871)

* Enable ExtendedProtectionPolicy in generic System.Net.Security build (used on browser)

* Update tests

14 months agoRevert "[wasm][debugger] Remove usage of GeneratedRegex (#86911)" (#89022)
Thays Grazia [Mon, 17 Jul 2023 17:09:57 +0000 (14:09 -0300)]
Revert "[wasm][debugger] Remove usage of GeneratedRegex (#86911)" (#89022)

This reverts commit 3fc0f5fd610f73f0397cf40f68bf6e13787a8f2c.

14 months agoUpdate dependencies from https://github.com/dotnet/runtime build 20230714.11 (#88997)
dotnet-maestro[bot] [Mon, 17 Jul 2023 16:34:00 +0000 (11:34 -0500)]
Update dependencies from https://github.com/dotnet/runtime build 20230714.11 (#88997)

Microsoft.NET.ILLink.Tasks , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , System.Text.Json
 From Version 8.0.0-preview.7.23359.3 -> To Version 8.0.0-preview.7.23364.11

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoFix naming conflict resolution algorithm for linear interface hierarchies. (#88916)
Eirik Tsarpalis [Mon, 17 Jul 2023 16:12:07 +0000 (17:12 +0100)]
Fix naming conflict resolution algorithm for linear interface hierarchies. (#88916)

14 months agoAscii.Equals: remove redundant OR (#88993)
Adam Sitnik [Mon, 17 Jul 2023 16:07:27 +0000 (18:07 +0200)]
Ascii.Equals: remove redundant OR (#88993)

both inputs are equal here so if one of them is non ASCII, then the other one is too

14 months agoSimplify KeyAnalyzer (#88709)
Marc Brooks [Mon, 17 Jul 2023 15:14:13 +0000 (10:14 -0500)]
Simplify KeyAnalyzer (#88709)

The assignment `bool canSwitchIgnoreCaseToCaseSensitive = ignoreCase;` can just be `bool canSwitchIgnoreCaseToCaseSensitive = true;` since we're just tested that value a couple lines up

14 months agoRemove runtime-ioslike-mono and runtime-ioslike-coreclr pipelines (#88999)
Milos Kotlar [Mon, 17 Jul 2023 14:36:48 +0000 (16:36 +0200)]
Remove runtime-ioslike-mono and runtime-ioslike-coreclr pipelines (#88999)

14 months agoAdded QuicException.TransportErrorCode (#88550)
Alexander Radchenko [Mon, 17 Jul 2023 14:21:36 +0000 (20:21 +0600)]
Added QuicException.TransportErrorCode (#88550)

* Added QuicException.TransportErrorCode

* Code review by Tomas Weinfurt @wfurt

* @ManickaP Marie Píchová code review

* @ManickaP Marie Píchová code review

* @ManickaP Marie Píchová code review

* Feedback about error code casts

---------

Co-authored-by: ManickaP <mapichov@microsoft.com>
14 months agoRemove extra checks for known types in log formatter (#89000)
David Fowler [Mon, 17 Jul 2023 14:21:20 +0000 (10:21 -0400)]
Remove extra checks for known types in log formatter (#89000)

Turns out the JIT will not box in tier 1, this was trying to optimize tier 0 code.

14 months agoFix HTTP/1.1 concurrent request content read race condition (#86715)
Miha Zupan [Mon, 17 Jul 2023 14:11:14 +0000 (16:11 +0200)]
Fix HTTP/1.1 concurrent request content read race condition (#86715)

14 months agoAdd support for tvOS in os detection (#88988)
Milos Kotlar [Mon, 17 Jul 2023 14:05:35 +0000 (16:05 +0200)]
Add support for tvOS in os detection (#88988)

14 months agoConfigure SocketsHttpHandler for HttpClientFactory with IConfiguration (#88864)
Natalia Kondratyeva [Mon, 17 Jul 2023 13:33:18 +0000 (15:33 +0200)]
Configure SocketsHttpHandler for HttpClientFactory with IConfiguration (#88864)

Adds UseSocketsHttpHandler extension method for IHttpClientBuilder to set SocketsHttpHandler as a primary handler for a named HttpClient. Adds ISocketsHttpHandlerBuilder to configure the handler from IConfiguration and/or via a callback.

The API is .NET 5.0+ only.

Fixes #84075

14 months agoJIT: Optimize logical right shifts for byte values on XArch (#86841)
Miha Zupan [Mon, 17 Jul 2023 13:22:53 +0000 (15:22 +0200)]
JIT: Optimize logical right shifts for byte values on XArch (#86841)

14 months agousing the same configuration used by BlazorDevServer (#88919)
Thays Grazia [Mon, 17 Jul 2023 13:12:55 +0000 (10:12 -0300)]
using the same configuration used by BlazorDevServer (#88919)

14 months ago[wasm] Move code around in WBT in preparation for fixes, and cleanups (#88980)
Ankit Jain [Mon, 17 Jul 2023 12:29:31 +0000 (08:29 -0400)]
[wasm] Move code around in WBT in preparation for fixes, and cleanups (#88980)

* WBT: Move some common methods to TestUtils.cs

* WBT: Add new project type specific base classes for the tests

.. derived from `BuildTestBase.

* WBT: Move blazor specific code from BuildTestBase into

.. BlazorWasmProjectProvider, and BlazorWasmTestBase. This commit avoids
doing any cleanup, and just moves code around.

* WBT: Move more code from BuildTestBase to the respective provider, and test classes

* WBT: use field for buildenvironment

* Move blazor files to Blazor/

* move WasmTemplateTests.cs

* fix build

* Move StatFiles to provider

* Fix build

* fix build

* Fix wasi build

* WBT: Update list of tests

* Fix UnixFilePermissions test to account for the emscripten cache package

14 months agoPoolable / Resettable CBOR Readers (#88104)
Alexander Radchenko [Mon, 17 Jul 2023 09:09:32 +0000 (15:09 +0600)]
Poolable / Resettable CBOR Readers (#88104)

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
14 months agoDon't crash the trim analyzer if it finds unrecognized nodes in the input (#88836)
Vitek Karas [Mon, 17 Jul 2023 09:06:05 +0000 (02:06 -0700)]
Don't crash the trim analyzer if it finds unrecognized nodes in the input (#88836)

New versions of the compiler will introduce new nodes and values. The analyzer can never be 100% in sycn with the compiler, so it needs to be able to gracefully handle nodes it doesn't know anything about.

Change the several throws to just Debug.Fail. For end-users if we hit unrecognized node, we will effectively ignore that part of the code. So not 100% precise, but the analyzer will never be 100% regardles.

This is in response to #88684, but we can't add tests for it yet because the necessary compiler changes are in Preview 6, the repo is still on Preview 5.

14 months ago[mono][tests] Add support for mobile devices in processinfo3 test (#88655)
Milos Kotlar [Mon, 17 Jul 2023 08:56:35 +0000 (10:56 +0200)]
[mono][tests] Add support for mobile devices in processinfo3 test (#88655)

* Add support for devices in processinfo3 test

* Add support for android portable RID OS

14 months agoRun NativeAOT tests when ILLink changes (#88934)
Vitek Karas [Mon, 17 Jul 2023 08:06:52 +0000 (01:06 -0700)]
Run NativeAOT tests when ILLink changes (#88934)

NativeAOT uses code from ILLinker - specifically we share lot of tests. So if these change we want to make sure it didn't break their usage in NativeAOT.

The comment change in the tests is to trigger this new rule in the CI - but we can keep the comment regardless.

14 months ago[NativeAOT] Fix GCDesc computation (#88927)
SingleAccretion [Mon, 17 Jul 2023 07:04:13 +0000 (10:04 +0300)]
[NativeAOT] Fix GCDesc computation (#88927)

* Fix GCDesc computation

https://github.com/dotnet/runtime/pull/86877 appears to have introduced a bug in the GCDesc computation.

Consider the following structure layout (we are on 32 bit):

 struct {
     int X1;
     int X2;
     Object Obj;
     int X3;
 }

Crucially, the object reference in this struct is placed at a non-zero offset, which means that in an
array GCDesc, sizeof(X1 + X2) aka 8 will be added to the "base size" of the object. Since we have one
and only series (of GC pointers), it will also be the last. Its "skip" was computed as:

 bitfield.Count (4) - last (3) = 1

Which is clearly incorrect, as we need to skip 3 pointers when considering the shifted array layout:

 <Obj, X3][X1, X2, Obj, X3][X1, X2, Obj, X3]...
     |            |
     [Correct skip]

In effect, for the last series, we must consider the skip to include the delta we have included into
the base size, which code before #86877 did, although wrongly - for MD arrays - as well. This change
restores a fixed version of it.

* Add a test

Verified to fail (hit a GC assert) before and pass after.

* (actually make it compile)

14 months agoUse optimized GetOffset in Range GetOffsetAndLength (#87317)
Jesper Meyer [Mon, 17 Jul 2023 03:39:54 +0000 (05:39 +0200)]
Use optimized GetOffset in Range GetOffsetAndLength (#87317)

14 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230714.2 (#88947)
dotnet-maestro[bot] [Mon, 17 Jul 2023 02:41:17 +0000 (21:41 -0500)]
Update dependencies from https://github.com/dotnet/arcade build 20230714.2 (#88947)

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23362.5 -> To Version 8.0.0-beta.23364.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months ago[main] Update dependencies from dotnet/roslyn (#88188)
dotnet-maestro[bot] [Mon, 17 Jul 2023 02:40:24 +0000 (21:40 -0500)]
[main] Update dependencies from dotnet/roslyn (#88188)

* Update dependencies from https://github.com/dotnet/roslyn build 20230629.1

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-2.23319.4 -> To Version 4.7.0-3.23329.1

* Update dependencies from https://github.com/dotnet/roslyn build 20230710.7

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-2.23319.4 -> To Version 4.7.0-3.23360.7

* Update dependencies from https://github.com/dotnet/roslyn build 20230711.9

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-2.23319.4 -> To Version 4.7.0-3.23361.9

* Disable InlineArrayInvalid due to https://github.com/dotnet/runtime/issues/88861

* Disable InlineArrayValid also due to

Issue: https://github.com/dotnet/runtime/issues/88957

```
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(184,28): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(185,28): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(201,20): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(202,20): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(209,36): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(210,40): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(232,40): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(233,44): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(245,20): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(246,20): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(253,36): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(254,40): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(259,20): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(260,20): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(294,29): error CS0306: The type 'Span<object>' may not be used as a type argument [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(294,29): error CS0193: The * or -> operator must be applied to a pointer [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(295,31): error CS0306: The type 'Span<object>' may not be used as a type argument [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(295,30): error CS0193: The * or -> operator must be applied to a pointer [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(309,14): error CS0306: The type 'Span<object>' may not be used as a type argument [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(309,13): error CS0193: The * or -> operator must be applied to a pointer [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(429,43): error CS1061: '(object, short)' does not contain a definition for 'o' and no accessible extension method 'o' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs(430,47): error CS1061: '(object, short)' does not contain a definition for 's' and no accessible extension method 's' accepting a first argument of type '(object, short)' could be found (are you missing a using directive or an assembly reference?) [/__w/1/s/src/tests/Loader/classloader/InlineArray/InlineArrayValid.csproj] [/__w/1/s/src/tests/build.proj]
/__w/1/s/src/tests/Common/dir.traversal.targets(25,5): error : (No message specified) [/__w/1/s/src/tests/build.proj] [/__w/1/s/src/tests/build.proj]
```

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
14 months ago[mono] Some UnsafeAccessorAttribute support for methods and constructors (#88925)
Aleksey Kliger (λgeek) [Mon, 17 Jul 2023 00:25:35 +0000 (20:25 -0400)]
[mono] Some UnsafeAccessorAttribute support for methods and constructors (#88925)

* first cut at UnsafeAccessorKind.Constructor

* Implement UnsafeAccessorKind.Method and StaticMethod

* remove debug output

* change some asserts to BadImageFormatException

* enable some tests

* move CallAmbiguousMethod to a separate test case

* Fixup error checking; forbid generics

* match CoreCLR: callvirt for instance methods call for static

* fixups to pass new tests from https://github.com/dotnet/runtime/pull/88268

* Make CallCtorAsMethod tests work

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
14 months agoFix behavior of default interfaces interacting with constraints (#88932)
David Wrighton [Sun, 16 Jul 2023 22:10:55 +0000 (15:10 -0700)]
Fix behavior of default interfaces interacting with constraints (#88932)

* Fix stack overflow caused by incorrect handling of class load levels

* Address code review feedback on the test