platform/upstream/dotnet/runtime.git
2 years agoFixed work with QUIC_BUFFER (#69351)
Marie Píchová [Tue, 17 May 2022 14:17:47 +0000 (16:17 +0200)]
Fixed work with QUIC_BUFFER (#69351)

2 years agoAdd some assertions to Stream.Read in System.Text.Encoding.CodePages (#69414)
Eric Erhardt [Tue, 17 May 2022 13:27:07 +0000 (08:27 -0500)]
Add some assertions to Stream.Read in System.Text.Encoding.CodePages (#69414)

* Add some assertions to Stream.Read in System.Text.Encoding.CodePages

BaseCodePageEncoding is relying on Stream.Read to read a full buffer of data in a single read. This is safe to assume because the only stream ever used is an UnmanagedMemoryStream, which will just copy the data to the buffer.

Adding some asserts to the code to make this assumption explicit.

2 years agoMake json source generation cancellable (#69332)
CyrusNajmabadi [Tue, 17 May 2022 13:19:12 +0000 (06:19 -0700)]
Make json source generation cancellable (#69332)

* Make json generation cancellable

* Simplify

* no var

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
2 years agoOptimize ManifestResourceStream.Read(Span<byte>) (#69412)
Eric Erhardt [Tue, 17 May 2022 10:55:34 +0000 (05:55 -0500)]
Optimize ManifestResourceStream.Read(Span<byte>) (#69412)

ManifestResourceStream is derived from UnmanagedMemoryStream. UnmanagedMemoryStream optimizes Read(Span<byte>), but only if the instance is concretely an UnmanagedMemoryStream. This is to protect in case the derived Stream overriddes Read(byte[], int, int) prior to the Read(Span<byte>) overload being introduced.

Optimize ManifestResourceStream by overriding Read(Span<byte>) and call ReadCore, so the Stream.Read(Span<byte>) logic of using a pooled byte[] buffer isn't used.

2 years agoAllow the inliner to substitute for small arguments (#69068)
Jakob Botsch Nielsen [Tue, 17 May 2022 10:19:18 +0000 (12:19 +0200)]
Allow the inliner to substitute for small arguments (#69068)

Since we no longer have contextual nodes to indicate small arguments,
this should be safe to do. For register arguments it does not matter and
for stack arguments it is handled in codegen (for macOS arm64).

2 years agoUse intrinsic for genLog2() (#69333)
Kunal Pathak [Tue, 17 May 2022 03:30:02 +0000 (20:30 -0700)]
Use intrinsic for genLog2() (#69333)

* Use intrinsic for genLog2()

* Use correct macro

* Fix non-msvc build

* fix 32-bit build

* just do for TARGET_64BIT

* Review comments

2 years agoAddress some System.Formats.Tar TODOs (infra and syscalls) (#69107)
Carlos Sanchez [Tue, 17 May 2022 02:45:30 +0000 (19:45 -0700)]
Address some System.Formats.Tar TODOs (infra and syscalls) (#69107)

* Fix Design time build errors by removing src project as dependency of the test project.

* Add Browser to target platform identifiers. Ensure Browser can consume the Unix specific ArchivingUtils file too.

* Remove nullable enable from csproj since it's now default

* Use FileStream constructor with FileMode.CreateNew to detect and throw if destination file exists when creating archive.

* No error checking on syscalls that do not set errno.

* Add RDev field in FileStatus and retrieve it with stat/lstat so devmajor and devminor get their correct values.

* Simplify some File.Open calls with direct FileStream constructor calls. Simplify FileStreamOptions objects too.

* Implement and consume p/invokes to retrieve uname from uid and gname from gid.

* size_t variables should not be checked for negative values

* FileStream calls simplified to File.OpenRead

* Remove check for RDev > 0

* Use dictionary to preserve repeated unames and gnames mapped to uids and gids

* Missing documentation in pal_uid.h new PALEXPORT methods.

* Adjust syscalls to thread-safe ones. Start with stackalloc, then use loop.

* Make dicts readonly and non-nullable, use TryGetValue

* Reuse 'GetNameFromUid' from pal_networking.c, move to pal_uid.c, use similar logic for Gid method. Simplify Interop.Sys method.

* Remove unnecessary comment

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
* Put TargetFrameworks back in the first position of the PropertyGroup.

* Address eerhardt suggestions

* Update src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntry.File.Tests.Unix.cs

* Clarify in pal_uid.h methods comments that new memory is returned

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
2 years agoDelete ClrDirectoryEnumerator (#69400)
Adeel Mujahid [Tue, 17 May 2022 01:43:57 +0000 (04:43 +0300)]
Delete ClrDirectoryEnumerator (#69400)

* Delete unused PAL functions

* Delete ClrDirectoryEnumerator

2 years agoAdd support for marshalling signed/unsigned boolean types. (#69402)
Aaron Robinson [Tue, 17 May 2022 01:38:26 +0000 (18:38 -0700)]
Add support for marshalling signed/unsigned boolean types. (#69402)

2 years agoCleanup some X509 PAL allocations
Kevin Jones [Tue, 17 May 2022 00:33:55 +0000 (20:33 -0400)]
Cleanup some X509 PAL allocations

2 years agoAdd correct assembly context name to InvalidCastException message (#69346)
Jan Kotas [Mon, 16 May 2022 23:57:47 +0000 (16:57 -0700)]
Add correct assembly context name to InvalidCastException message (#69346)

* Add correct assembly context name to InvalidCastException message

Fixes #69341

* Move GetNameForDiagnostics to assemblybinder.cpp/assemblybinder.h

2 years agoFix LibraryImportGenerator.UnitTests.Compiles.ValidateSnippetsFallbackForwarder ...
Elinor Fung [Mon, 16 May 2022 23:23:34 +0000 (16:23 -0700)]
Fix LibraryImportGenerator.UnitTests.Compiles.ValidateSnippetsFallbackForwarder (#69398)

2 years agoFix ASAN violation under Samsung's netcoredbg (#69339)
Mike McLaughlin [Mon, 16 May 2022 22:11:36 +0000 (15:11 -0700)]
Fix ASAN violation under Samsung's netcoredbg (#69339)

* Fix ASAN violation under Samsung's netcoredbg

Fixes issue https://github.com/dotnet/runtime/issues/62281

The wrong holder was being used in DacDbiInterfaceImpl::GetNativeVarData(); change to NewArrayHolder.

Added new/delete operators to Exception so when it is thrown from the DAC and caught/deleted in DBI, the
correct C++ allocator is used. When the DAC is called by DBI, g_pAllocator points to the DBI allocator.

* Code review feedback

2 years agoWorkaround crash in Microsoft.DiaSymReader.Native (#68990)
Mike McLaughlin [Mon, 16 May 2022 22:10:16 +0000 (15:10 -0700)]
Workaround crash in Microsoft.DiaSymReader.Native (#68990)

* Workaround crash in Microsoft.DiaSymReader.Native

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

The fix is to check if the module has a portable PDB in the debug directory
and use the well-tested managed portable PDB source/line number code.

Add support for in-memory embedded PDBs.

2 years agoMove MsQuicStream._streamId into MsQuicStream.State (#69382)
Radek Zikmund [Mon, 16 May 2022 20:58:57 +0000 (22:58 +0200)]
Move MsQuicStream._streamId into MsQuicStream.State (#69382)

* Move StreamId into State

* Code review feedback

2 years agoremove internal socket exception from NameResolution (#69270)
Tomas Weinfurt [Mon, 16 May 2022 20:44:30 +0000 (13:44 -0700)]
remove internal socket exception from NameResolution (#69270)

2 years agoavoid allocationg ApplicationProtocol in common case (#69098)
Tomas Weinfurt [Mon, 16 May 2022 20:43:42 +0000 (13:43 -0700)]
avoid allocationg ApplicationProtocol in common case (#69098)

* avoid allocationg ApplicationProtocol in common case

* ReadOnlySpan

* feedback from review

2 years agoRemoval of IBC infrastructure (#68717)
Aaron Robinson [Mon, 16 May 2022 20:18:53 +0000 (13:18 -0700)]
Removal of IBC infrastructure (#68717)

* Removal of IBC infrastructure

* Crossgen2 - remove tuning flag.

2 years agoDetect truncated GZip streams (#61768)
mfkl [Mon, 16 May 2022 20:07:48 +0000 (03:07 +0700)]
Detect truncated GZip streams (#61768)

* System.IO.Compression tests: add StreamTruncation_IsDetected

* System.IO.Compression: detect and throw on truncated streams

* account for edge case

* account for edge case in async version

* rename nonZeroInput to nonEmptyInput

* remove else to improve codegen

* run StreamTruncation_IsDetected for all three types of compression streams

* fixup test build and run

* add stream corruption test

* review feedback - cosmetics

* make BrotliStream detect truncation

* make StreamCorruption_IsDetected run for gzip only

other types of stream can't detect corruption properly

* skip byte corruption which results in correct decompression

* code style

* add zlib corruption test, no skipping needed

* clarify why we skip bytes in gzip test

* add and use truncated error data message

Co-authored-by: Marcin Krystianc <marcin.krystianc@gmail.com>
2 years agoRemove CngKeyLite
Kevin Jones [Mon, 16 May 2022 18:32:29 +0000 (14:32 -0400)]
Remove CngKeyLite

The class is no longer used after consolidating cryptographic assemblies.

2 years ago[wasm] Fix debug proxy when used with blazor (#69342)
Ankit Jain [Mon, 16 May 2022 17:45:53 +0000 (13:45 -0400)]
[wasm] Fix debug proxy when used with blazor (#69342)

Due to recent debug proxy changes, when trying to debug a blazor app, it
fails with:
```
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidOperationException: No output has been recevied from the application.
         at Microsoft.AspNetCore.Builder.DebugProxyLauncher.LaunchAndGetUrl(IServiceProvider serviceProvider, String devToolsHost)
         at Microsoft.AspNetCore.Builder.WebAssemblyNetDebugProxyAppBuilderExtensions.<>c.<<UseWebAssemblyDebugging>b__0_1>d.MoveNext()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
```

This is because it's looking for specific lines in output. And also, it
fails if it gets an empty line.

This commits fixes the output to match what blazor expects. And
essentially, disables firefox debug proxy when the host is directly
used, which is only by blazor right now.

This will change in the future though, and blazor side can be patched to
work better.

2 years agoRemove most usages of *wprintf* family of functions (#68237)
Aaron Robinson [Mon, 16 May 2022 16:53:31 +0000 (09:53 -0700)]
Remove most usages of *wprintf* family of functions (#68237)

* Remove most usage of *wprintf* family of functions

* Revert updates to Windows only source

* Make constants for integer max string lengths

2 years agoUpdate ActiveIIssue on NtlmSignatureTest (#69389)
Filip Navara [Mon, 16 May 2022 16:51:41 +0000 (18:51 +0200)]
Update ActiveIIssue on NtlmSignatureTest (#69389)

2 years ago[wasm][debugger] Refactor: narrow down SdbHelper responsibility (#66821)
Ilona Tomkowicz [Mon, 16 May 2022 15:53:54 +0000 (17:53 +0200)]
[wasm][debugger] Refactor: narrow down SdbHelper responsibility (#66821)

* Refactor.

* Applied @radical's suggestions about expression body.

* On refactor-createjobj-66068: Applied @radical's https://github.com/radical/runtime/commit/69f5cea4dfe30f3dbd74333b1b23fd8feb665e18.

* Revert test fix and separate it to another PR.

* Reverted whitespaces.

* Overlooked whitespaces - undo.

* Made static what can be static.

* Removed whitespaces.

* Removed whitespaces.

* Blocked tests failing on Firefox.

2 years agoAdd `IntPtr` conversion APIs for some runtime handles (#69363)
Aaron Robinson [Mon, 16 May 2022 14:40:22 +0000 (07:40 -0700)]
Add `IntPtr` conversion APIs for some runtime handles (#69363)

* Add conversion APIs for runtime handles

2 years agoOnly fold Type.op_Equality calls before morphing args (#69367)
Jakob Botsch Nielsen [Mon, 16 May 2022 14:36:35 +0000 (16:36 +0200)]
Only fold Type.op_Equality calls before morphing args (#69367)

Otherwise we may discard setup nodes.

Fix #68513

2 years agoFix KeepNativeSymbols to work on mono as well (#66594)
Omair Majid [Mon, 16 May 2022 12:27:40 +0000 (08:27 -0400)]
Fix KeepNativeSymbols to work on mono as well (#66594)

When packaging .NET on s390x through source-build, we want to keep debug
symbols enabled in the build. The package manager (debbuild, rpmbuild,
etc) generally strips the binaries to create distro-standard
-debug/-debuginfo packages. This was supported in coreclr via
--keepnativesymbols flag, but wasn't supported in mono (ie, s390x). Fix
that.

2 years agosupport only Ordinal comparison inside WildcardPathSegment (#69079)
Badre BSAILA [Mon, 16 May 2022 12:11:53 +0000 (14:11 +0200)]
support only Ordinal comparison inside WildcardPathSegment (#69079)

2 years agoUpdate signing of JS files (#69366)
Juan Hoyos [Mon, 16 May 2022 10:01:07 +0000 (03:01 -0700)]
Update signing of JS files (#69366)

Fixes part of #69317

2 years agoAdd OpenTelemetry with Geneva exporter to test server (#69304)
Radek Zikmund [Mon, 16 May 2022 08:28:13 +0000 (10:28 +0200)]
Add OpenTelemetry with Geneva exporter to test server (#69304)

2 years agoFix UTF8 string marshalling regression (#69360)
Jan Kotas [Sun, 15 May 2022 18:57:22 +0000 (11:57 -0700)]
Fix UTF8 string marshalling regression (#69360)

* Fix UTF8 string marshalling regression

We need to compensate for the differences in lifetime management patterns used by built-in marshalling system vs. the publicly explosed marshallers.

Fixes #69349

* Call Marshal.FreeCoTaskMem in the AOT compiler built-in marshalling

* Use Marshal.StringToCoTaskMemUni in Utf16StringMarshaller implementation

2 years agoRevert "Add IL Emit support for MethodInfo.Invoke() and friends" (#69373)
Jan Kotas [Sun, 15 May 2022 18:24:49 +0000 (11:24 -0700)]
Revert "Add IL Emit support for MethodInfo.Invoke() and friends" (#69373)

* Revert "Fix Assembly.GetCallingAssembly() (#69225)"

This reverts commit 8420dae8e84e03b7658a21f4b18831a8a2f0db79.

* Revert "Add IL Emit support for MethodInfo.Invoke() and friends (#67917)"

This reverts commit 5195418426468d13b042ae079c65aa05595295b4.

2 years agoFix typo in 'parameter'. (#69370)
Bradley Grainger [Sun, 15 May 2022 15:27:46 +0000 (08:27 -0700)]
Fix typo in 'parameter'. (#69370)

2 years agoImplement constant-folding for `VNF_BitCast` (#68979)
SingleAccretion [Sun, 15 May 2022 09:56:58 +0000 (12:56 +0300)]
Implement constant-folding for `VNF_BitCast` (#68979)

A few small diffs in tests where we now form new constants
for "long/int <-> double/float>" reinterpretations.

Completes the support for "VNF_BitCast" and removes the SIMD
quirk from "VNForLoadStoreBitCast".

2 years agoImprove some use of Regex (#68961)
Stephen Toub [Sat, 14 May 2022 21:55:38 +0000 (17:55 -0400)]
Improve some use of Regex (#68961)

- Use IsMatch instead of Match(...).Success
- Use EnumerateMatches when Index/Length are needed but not captures
- Remove Regex that could just be IndexOf

2 years agoFix buffer overrun in dbgutil (#69358)
Jan Kotas [Sat, 14 May 2022 20:55:12 +0000 (13:55 -0700)]
Fix buffer overrun in dbgutil (#69358)

Fixes #69353

2 years agoDelete a few unused definitions from coreclr pal (#69357)
Adeel Mujahid [Sat, 14 May 2022 20:07:13 +0000 (23:07 +0300)]
Delete a few unused definitions from coreclr pal (#69357)

2 years agoDelete incorrect asserts (#69354)
SingleAccretion [Sat, 14 May 2022 19:15:13 +0000 (22:15 +0300)]
Delete incorrect asserts (#69354)

* Delete incorrect asserts

In an "OBJ(LCL_VAR_ADDR)" argument, the underlying local can be of any type/HFA-ness.

* Add tests

2 years agoDo not fold mismatched `OBJ(ADDR(LCL_VAR))` (#69271)
SingleAccretion [Sat, 14 May 2022 18:35:20 +0000 (21:35 +0300)]
Do not fold mismatched `OBJ(ADDR(LCL_VAR))` (#69271)

* Do not fold mismatched OBJ(ADDR(LCL_VAR))

The transforms in question could fold, e. g. "OBJ<8>(ADDR(LCL_VAR<16>))"
to just the "LCL_VAR", necessitating workarounds in block morphing that
had to rematerialize the block node to restore IR's validity.

It is better to simply not create questionable IR in the first place.

* Add a test

* Re-enable tests

* Fix regressions

By using layout compatibility in "gtNewStructVal" instead of handle equality.

This is safe to do because "gtNewStructVal" is only used in contexts of block
copies (as opposed to call arguments).

2 years ago[mono][llvm] More LLVM 14.x changes. (#69239)
Zoltan Varga [Sat, 14 May 2022 16:08:59 +0000 (12:08 -0400)]
[mono][llvm] More LLVM 14.x changes. (#69239)

* Add a type to the 'sret' parameter attribute.
* Add helper functions for creating pointer types and pointer casts.

2 years agoAvoid unnecessary or duplicate PackageReferences - 7.0 Preview4 SDK work (#69260)
Viktor Hofer [Sat, 14 May 2022 07:50:35 +0000 (09:50 +0200)]
Avoid unnecessary or duplicate PackageReferences - 7.0 Preview4 SDK work (#69260)

* [WIP - Validation] Update the SDK to Preview4

* Avoid duplicate PackageReference

* Fix duplicated PackageReference

* Remove duplicate PackageRefs

* Update llvm-init.proj

* Update global.json

* Update xunit.props

2 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 177079...
dotnet bot [Sat, 14 May 2022 07:45:23 +0000 (00:45 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1770798 (#69337)

2 years agoEnsure non-numeric types don't implement the numeric only generic math interfaces...
Tanner Gooding [Sat, 14 May 2022 04:46:08 +0000 (21:46 -0700)]
Ensure non-numeric types don't implement the numeric only generic math interfaces (#69331)

2 years agoAdd windows runtime packs as a workload (#68981)
Steve Pfister [Sat, 14 May 2022 04:12:09 +0000 (00:12 -0400)]
Add windows runtime packs as a workload (#68981)

At certain points in time internally, the sdk will rev its version and insert into VS. It's at this point the sdk version will be ahead of the runtime version as we have not published anything into nuget. In MAUI and WinUI scenarios, this creates a bit of a pickle as the sdk will try to download a new version of the windows runtime pack, but it will not be available.

To get around this limitation, we are introducing a workload that will be inserted into VS where you can optionally install Windows runtime packs.

2 years agoUse more specific types in Interop.WideCharToMultiByte signature (#69338)
Jan Kotas [Sat, 14 May 2022 02:55:25 +0000 (19:55 -0700)]
Use more specific types in Interop.WideCharToMultiByte signature (#69338)

2 years ago[mono] Fix parsing the 'nunbox-arbitrary-trampolines' aot argument. (#69319)
Rolf Bjarne Kvinge [Sat, 14 May 2022 00:06:14 +0000 (02:06 +0200)]
[mono] Fix parsing the 'nunbox-arbitrary-trampolines' aot argument. (#69319)

2 years agoExpose the RuntimeFeature.NumericIntPtr member for C# 11 (#69322)
Tanner Gooding [Fri, 13 May 2022 21:52:07 +0000 (14:52 -0700)]
Expose the RuntimeFeature.NumericIntPtr member for C# 11 (#69322)

2 years agoenable NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds (#69264)
Tomas Weinfurt [Fri, 13 May 2022 21:36:10 +0000 (14:36 -0700)]
enable NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds (#69264)

2 years agoDo not sign the .js files (#69317)
Ankit Jain [Fri, 13 May 2022 21:08:41 +0000 (17:08 -0400)]
Do not sign the .js files (#69317)

* Do not sign the .js files

We want to avoid the js files in wasm templates from getting the
signature block in user visible files.

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

* Update eng/Signing.props

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years agoUse static abstract members on two occasions. (#69278)
Theodore Tsirpanis [Fri, 13 May 2022 20:28:02 +0000 (23:28 +0300)]
Use static abstract members on two occasions. (#69278)

2 years agoFix a typo (#69145)
Andrew Au [Fri, 13 May 2022 19:55:22 +0000 (12:55 -0700)]
Fix a typo (#69145)

2 years agoAdd DateOnly and TimeOnly support to System.Text.Json (#69160)
Eirik Tsarpalis [Fri, 13 May 2022 17:31:28 +0000 (18:31 +0100)]
Add DateOnly and TimeOnly support to System.Text.Json (#69160)

* Add DateOnly and TimeOnly support to System.Text.Json

* Constrain DateOnly supported formats to calendar dates only.

* Update src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
* Replace NETx_OR_GREATER with NETCOREAPP

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
2 years agoFix handling of custom type marshaller pinning with a different type than the native...
Jeremy Koritzinsky [Fri, 13 May 2022 16:45:01 +0000 (09:45 -0700)]
Fix handling of custom type marshaller pinning with a different type than the native type. (#69214)

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
2 years agoRemove ActiveIssue for S.S.C.Xml tests that rely on DSA key generation
Kevin Jones [Fri, 13 May 2022 16:05:59 +0000 (12:05 -0400)]
Remove ActiveIssue for S.S.C.Xml tests that rely on DSA key generation

MacOS cannot generate DSA keys, so make a pre-generated key and use that.

Only used the fixed key on macOS so other platforms continue to test with a random key.

2 years agoAdd versioning info to clrgc (#69295)
Juan Hoyos [Fri, 13 May 2022 15:47:46 +0000 (08:47 -0700)]
Add versioning info to clrgc (#69295)

2 years agofix typo in LoggerFactoryExtensions (#69303)
havalli [Fri, 13 May 2022 14:49:07 +0000 (16:49 +0200)]
fix typo in LoggerFactoryExtensions (#69303)

2 years agoEnable System.Globalization.Native for NativeAOT (#69297)
Jan Kotas [Fri, 13 May 2022 14:36:09 +0000 (07:36 -0700)]
Enable System.Globalization.Native for NativeAOT (#69297)

Fixes #68889

2 years agoFixed System.Text.Json failures on x86 android (#69248)
Meri Khamoyan [Fri, 13 May 2022 14:27:51 +0000 (18:27 +0400)]
Fixed System.Text.Json failures on x86 android (#69248)

#49936

2 years agoShare code between source-generated and built-in Utf8 string marshallers (#69043)
Jan Kotas [Fri, 13 May 2022 13:48:06 +0000 (06:48 -0700)]
Share code between source-generated and built-in Utf8 string marshallers (#69043)

2 years agoAdd regex test that reuses RegexMatchTests data for captures (#69252)
Stephen Toub [Fri, 13 May 2022 11:25:51 +0000 (07:25 -0400)]
Add regex test that reuses RegexMatchTests data for captures (#69252)

* Add regex test that reuses RegexMatchTests data for captures

An additional test to help validate that all of the engines are producing the same captures information.

* Address PR feedback

2 years agoGet StreamID while still in the MsQuic callback (#69301)
Radek Zikmund [Fri, 13 May 2022 10:48:07 +0000 (03:48 -0700)]
Get StreamID while still in the MsQuic callback (#69301)

2 years agoMethods on primitives 65707 (#66654)
Ilona Tomkowicz [Fri, 13 May 2022 10:26:12 +0000 (12:26 +0200)]
Methods on primitives 65707 (#66654)

* Prepared tests for calling method on primitive types.

* Added support for most methods on primitives.

* Corrected other tests - TBool is supported.

* Corrected test to match current exception texts.

* Fixed evaluation with enums.

* Fixed another error message to match.

* Fixed firefox test on EvaluateMethodsOnPrimitiveTypesReturningPrimitives.

* Revert moving ContinueWith() out of the try block.

* Removed comment that is not longer true after 2fef3c218b5bca5494797e1134da64e62d433418.

* Applied radical's suggestions.

2 years agoSubstitute GT_RET_EXPR in inline candidate arguments (#69117)
Jakob Botsch Nielsen [Fri, 13 May 2022 07:38:09 +0000 (09:38 +0200)]
Substitute GT_RET_EXPR in inline candidate arguments (#69117)

Also rename GTF_CALL_M_LATE_DEVIRT -> GTF_CALL_M_HAS_LATE_DEVIRT_INFO

2 years agoSupport Requires on type in NativeAot (#68978)
Tlakaelel Axayakatl Ceja [Fri, 13 May 2022 05:25:17 +0000 (22:25 -0700)]
Support Requires on type in NativeAot (#68978)

Support Requires on type in NativeAot
- Adds new overload for MessageOrigin creation that uses MethodIL and an offset as parameters. Eventually, this will be used to produce warnings
- Share methods used in linker/analyzer for asking questions about members being in RequiresScope, members Requiring and Requires warning generation. These methods include handling of Requires on a type.
- The ReflectionMethodBodyScanner on field access now verifies for requires on type, since implicitly can call the static constructor
- Updated the mismatch attribute rules to take into account Requires on type
- Added support for RequiresAssemblyFilesAttribute, now the code checks for RAF and warns about it
- Added support to check and retrieve attributes in a property
- Added overloads to IsInRequiresScope that verify associated properties
- Add RequiresOnStaticConstructor id

2 years agoUpdate LibraryImportGenerator unit tests with interpolated string arguments (#69285)
Elinor Fung [Fri, 13 May 2022 04:25:12 +0000 (21:25 -0700)]
Update LibraryImportGenerator unit tests with interpolated string arguments (#69285)

2 years agoAdd missing (uint) cast in regex generated code (#69198)
Stephen Toub [Fri, 13 May 2022 03:42:16 +0000 (23:42 -0400)]
Add missing (uint) cast in regex generated code (#69198)

Avoids a possible bounds check

2 years agoNormalize Nil PublicKeyToken to an empty array (#69169)
Vladimir Sadov [Fri, 13 May 2022 02:40:35 +0000 (19:40 -0700)]
Normalize Nil PublicKeyToken to an empty array (#69169)

* Normalize Nil PublicKeyToken to an empty array

* Fix tests

* Do not parse assembly name from metadata

* Force PublicKey bit on assembly names fetched from definitions.

* better comment

* PR feedback.

2 years agoConvert RsaPaddingProcessor to statics
Kevin Jones [Fri, 13 May 2022 02:06:07 +0000 (22:06 -0400)]
Convert RsaPaddingProcessor to statics

The RsaPaddingProcessor is now entirely static methods so we do not need to keep instances cached.

2 years ago[wasm] Misc debugger improvements (#68988)
Ankit Jain [Fri, 13 May 2022 01:59:59 +0000 (21:59 -0400)]
[wasm] Misc debugger improvements (#68988)

* [wasm] Move the browser provisioning stuff to a new targets file

.. from `DebuggerTestSuite.csproj`. This will allow other projects to
use this too.

* [wasm][debugger] Handle failure to connect to the browser

* [wasm] Improve the browser path lookup

so it can be used outside the debugger tests project too. For example,
with Wasm.Build.Tests+playwright .

* [wasm][debugger] Throw exceptions from tasks correctly

.. using `ExceptionDispatchInfo.Capture` so we get the original stack
trace.

* [wasm][debugger] General improvements in debug proxy

- like logging
- updated API to make it easier to use by other projects, like the
  upcoming wasm-app-host .

* [wasm][debugger] Add support for setting an automatic breakpoint

.. on the first line of the entrypoint method (`Main`). This will be
useful for debugging with the upcoming wasm-app-host, along with the use
of `wait-for-debugger`.

Implemented by @thaystg .

* [wasm][debugger] Add support for wait_for_debugger

If requested, then it will cause invocation of `main` to be delayed till
a debugger is attached.

Implemented by @thaystg

* [wasm] Cleanup in Wasm.Build.Tests

.. in the lead up to wasm-app-host tests.

* [wasm] Update the default paths used to trigger builds on CI

.. to include templates, and provisioning props.

* disable non-wasm builds

* [wasm][debugger] Fix path to artifacts dir

* [wasm] Emit message with bundle path

* [wasm][templates] Make the project use the target dir's name as the

.. project name, instead of always creating `browser.dll`, and
`console.dll`.

* [wasm][debugger] Use a single static instance of HttpClient

.. as recommended by the documentation.

* Revert "disable non-wasm builds"

This reverts commit 7b8b60d58c886e7e66cf2fea910f1feb4d6374f1.

* Address review feedback, and improve the autogenerated bpid

2 years agoUse PopCount in DriveInfoInternal.Windows.cs. (#69279)
Theodore Tsirpanis [Fri, 13 May 2022 01:15:09 +0000 (04:15 +0300)]
Use PopCount in DriveInfoInternal.Windows.cs. (#69279)

2 years agoCollect more info for host tests (#69282)
Elinor Fung [Fri, 13 May 2022 00:20:17 +0000 (17:20 -0700)]
Collect more info for host tests (#69282)

2 years agoEnable nullable=enable by default for anything except tests (#69256)
Viktor Hofer [Thu, 12 May 2022 23:44:33 +0000 (01:44 +0200)]
Enable nullable=enable by default for anything except tests (#69256)

* Set nullable=enable for source generators

* Only add NullableAttribute.cs for C# projects

* Update Directory.Build.props

2 years agoFix memory leak at AssemblyLoadContext unload (#69263)
Jan Vorlicek [Thu, 12 May 2022 23:32:05 +0000 (01:32 +0200)]
Fix memory leak at AssemblyLoadContext unload (#69263)

I have found there was a small memory leak when unloading
AssemblyLoadContext. A customer had a quite extreme testing case that
ran millions of iterations of creating an AssemblyLoadContext, loading
some assemblies into it and then unloading it. After 80 million
iterations on their machine with 8GB memory, the testing app was getting
out of memory.

Using PerfView, I was able to locate the source of the leak. It was a
missing destruction of the Module::m_pJitInlinerTrackingMap.

2 years agoAdd Akhil to fabricbot-config (#69276)
Eric StJohn [Thu, 12 May 2022 23:28:28 +0000 (16:28 -0700)]
Add Akhil to fabricbot-config (#69276)

* Add Akhil to fabricbot-config

* Make names alphabetical

2 years agoGenerate the DAC table on Windows with MSVC linker directives instead of resource...
Jeremy Koritzinsky [Thu, 12 May 2022 21:53:12 +0000 (14:53 -0700)]
Generate the DAC table on Windows with MSVC linker directives instead of resource injection (#68065)

2 years ago[wasm] Wasm.Build.Tests: Capture test output with xunit, so the output is cleaner...
Ankit Jain [Thu, 12 May 2022 20:19:09 +0000 (16:19 -0400)]
[wasm] Wasm.Build.Tests: Capture test output with xunit, so the output is cleaner, and the (#69201)

* [wasm] Capture test output with xunit, so the output is cleaner, and the

.. test results have the full text.

* [wasm] Wasm.Build.Tests: remove unncessary output

.. like test args. And add some start/end banners for tests, since they
can be long running.

* Don't use _testOutput in the test programs

* fixup

2 years agoFix CoreLib fast up-to-date check (#69240)
Viktor Hofer [Thu, 12 May 2022 19:56:02 +0000 (21:56 +0200)]
Fix CoreLib fast up-to-date check (#69240)

* Fix CoreLib fast up-to-date check

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

CoreLib's fast up-to-date check was broken because the output pdb was
moved into a different folder. Changing this to use a copy task instead
and consolidate the two targets into one.

I couldn't find a publicly exposed property that allows to change the
pdb's output path, hence I decided to copy.

2 years agoSimplify `fgMorphMultiregStructArg` (#68853)
SingleAccretion [Thu, 12 May 2022 19:51:38 +0000 (22:51 +0300)]
Simplify `fgMorphMultiregStructArg` (#68853)

* Remove invalid code from "fgMorphMultiregStructArg"

In an "OBJ(ADDR(LCL_VAR))" construction, it is legal for the "OBJ" to not match "LCL_VAR",
exactly, and the code in multi-reg argument morphing already handles this correctly.

So, just remove the asserts and the second-guessing of the "type" array.

2 years agoTreat `INDEX_ADDR`s as non-null (#69209)
SingleAccretion [Thu, 12 May 2022 18:54:14 +0000 (21:54 +0300)]
Treat `INDEX_ADDR`s as non-null (#69209)

* Treat INDEX_ADDRs as non-null

If they range check that is.

* Also use IsBoundsChecked in more places

2 years agoAdd a few RegexGenerator tests for valid string arguments (#69221)
Stephen Toub [Thu, 12 May 2022 18:11:54 +0000 (14:11 -0400)]
Add a few RegexGenerator tests for valid string arguments (#69221)

2 years agoARM64 - Consolidate 'msub' and 'madd' logic (#68363)
Will Smith [Thu, 12 May 2022 18:09:20 +0000 (11:09 -0700)]
ARM64 - Consolidate 'msub' and 'madd' logic (#68363)

* Changed GT_MADD to not emit msub

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Added break

* Added lowering pass

* Updates to lowering

* Removing morph transformation

* Minor format

* Removed GT_MSUB. Using simple containment to emit msub.

* Removed GT_MSUB case

* Removed extra code

* Updated comment

* Formatting

* Minor change

* Combining GT_MADD changes

* Added extra set flag checks

* Added extra set flag checks

* Creating helper functions

* Fixing build

* Fixing build

* Fixing build and better codegen

* Should produce zero diffs

* Formatting

* Update lowerarmarch.cpp

2 years agoRemove properties that are already set globally (#69255)
Viktor Hofer [Thu, 12 May 2022 18:01:53 +0000 (20:01 +0200)]
Remove properties that are already set globally (#69255)

2 years agoJIT: Remove "promoted parameter" tailcall limitation (#69034)
Jakob Botsch Nielsen [Thu, 12 May 2022 17:58:10 +0000 (19:58 +0200)]
JIT: Remove "promoted parameter" tailcall limitation (#69034)

This is allowed for explicit tailcalls so it seems unlikely that there
are any actual problems with allowing this.

2 years agoUnify SendContent cancellation between HTTP3 and HTTP2 (#67954)
Radek Zikmund [Thu, 12 May 2022 17:35:05 +0000 (10:35 -0700)]
Unify SendContent cancellation between HTTP3 and HTTP2 (#67954)

* Unify SendContent cancellation between HTTP3 and HTTP2

* Fix comment

* Add Unit tests

* Fix flaky test

* Don't propagate cancellation for duplex content

* fixup! Fix flaky test

* Cancel body on all exceptions (except cancellation)

* Revert unwanted changes

* fixup! Merge remote-tracking branch 'upstream/main' into 60253-HTTP3-cancellation

* Apply suggestions from code review

Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
2 years agofix invalid Host header for link-local IPv6 (#69203)
Tomas Weinfurt [Thu, 12 May 2022 17:16:03 +0000 (10:16 -0700)]
fix invalid Host header for link-local IPv6 (#69203)

* fix invalid Host headr for link-local IPv6

* feedback from review

2 years agoVarious refactorings to share more code with future generators (#67997)
Jeremy Koritzinsky [Thu, 12 May 2022 17:04:09 +0000 (10:04 -0700)]
Various refactorings to share more code with future generators (#67997)

2 years agoMark all assets from System.Runtime and System.Threading.Overlapped references privat...
Marek Fišera [Thu, 12 May 2022 17:02:39 +0000 (19:02 +0200)]
Mark all assets from System.Runtime and System.Threading.Overlapped references private (#69191)

2 years agomake sure NetworkInfo works without IPv6 on Linux (#69172)
Tomas Weinfurt [Thu, 12 May 2022 16:54:19 +0000 (09:54 -0700)]
make sure NetworkInfo works without IPv6 on Linux (#69172)

* make sure NetworkInfo works without IPv6 on Linux"

* remove unneeded reference

2 years agoUpdate NoTargets.SDK and remove unnecessary properties being set (#69242)
Viktor Hofer [Thu, 12 May 2022 16:18:01 +0000 (18:18 +0200)]
Update NoTargets.SDK and remove unnecessary properties being set (#69242)

Update NoTargets.SDK and remove unnecessary properties being set

2 years agoFirst version - just make sure all heaps sweep rather than compact if special_sweep_p...
Peter Sollich [Thu, 12 May 2022 15:44:01 +0000 (17:44 +0200)]
First version - just make sure all heaps sweep rather than compact if special_sweep_p is set by one heap. (#69177)

The issue was that in SVR GC, some GC threads would not be able to obtain a region for gen 0, and thus set special_sweep_p, but later on, this setting would be ignored when GC threads voted whether to sweep or compact. So we ended up compacting anyway, not getting a gen 0 region for some heaps, and verify_regions failing.

Fix is simply to always do sweep when special_sweep_p is set.

This still doesn't make ASP.NET work with tight hard limits - more work is needed.

2 years agoDisable HardwareIntrinsics NotSupported test on arm64 (#69241)
Jakob Botsch Nielsen [Thu, 12 May 2022 14:18:41 +0000 (16:18 +0200)]
Disable HardwareIntrinsics NotSupported test on arm64 (#69241)

2 years agoFix entry point for string marshalling tests with ownership transfer (#69226)
Elinor Fung [Thu, 12 May 2022 13:53:18 +0000 (06:53 -0700)]
Fix entry point for string marshalling tests with ownership transfer (#69226)

2 years agoUpdate to a newer Roslyn compiler (#69211)
Stephen Toub [Thu, 12 May 2022 13:40:19 +0000 (09:40 -0400)]
Update to a newer Roslyn compiler (#69211)

2 years agoFix Assembly.GetCallingAssembly() (#69225)
Steve Harter [Thu, 12 May 2022 13:09:19 +0000 (08:09 -0500)]
Fix Assembly.GetCallingAssembly() (#69225)

2 years agoRevert "49936 text json failures" (#69243)
Meri Khamoyan [Thu, 12 May 2022 12:55:03 +0000 (16:55 +0400)]
Revert "49936 text json failures" (#69243)

* Revert "49936 text json failures (#68758)"
This reverts commit 43dd0a74ab524278620d8c6a9d33a9b73b2d2228.

2 years agoStop running both normal and no_tiered_compilation scenarios for coreclr PRs (#69178)
Jakob Botsch Nielsen [Thu, 12 May 2022 12:13:09 +0000 (14:13 +0200)]
Stop running both normal and no_tiered_compilation scenarios for coreclr PRs (#69178)

2 years agoEnable corelib source generator in design time (#69235)
Viktor Hofer [Thu, 12 May 2022 11:33:16 +0000 (13:33 +0200)]
Enable corelib source generator in design time (#69235)

This should be fixed with the usage of an incremental source generator and VS2022, based on https://github.com/dotnet/runtime/pull/50741#issuecomment-814495815.

2 years agoFix `impBoxPatternMatch` (#68382)
SingleAccretion [Thu, 12 May 2022 11:26:39 +0000 (14:26 +0300)]
Fix `impBoxPatternMatch` (#68382)

2 years agoI noticed some initalization were missing at the beginning of ProcessStressLog()...
Peter Sollich [Thu, 12 May 2022 10:38:16 +0000 (12:38 +0200)]
I noticed some initalization were missing at the beginning of ProcessStressLog(). (#69176)

The effect is that some command line options appear sticky, e.g. if you give a filter, run, and rerun without it, it will still take effect

2 years agoDisable k-nucleotide-9 in llvmfullaot (#69173)
Jakob Botsch Nielsen [Thu, 12 May 2022 08:50:50 +0000 (10:50 +0200)]
Disable k-nucleotide-9 in llvmfullaot (#69173)