platform/upstream/dotnet/runtime.git
3 years agoRetry entire test for X.509 TimeoutTests instead of just X509Chain.Build
Kevin Jones [Fri, 25 Sep 2020 16:51:38 +0000 (12:51 -0400)]
Retry entire test for X.509 TimeoutTests instead of just X509Chain.Build

The TimeoutTests had functionality to retry the X509Chain.Build call if
it failed to improve the reliability of the tests. However, retrying
only the Build portion broke some assumptions about how long a chain
build would take.

If Build is invoked for a second time per the retry, however the
previous call to Build primed some of the AIA or CRL/OCSP caches, this
broke the assumption of how long a delayed fetch would take.

Instead, retry the entire test with a new chain every time so that
nothing is in the cache and the timing assumptions remain valid.

3 years agoDisable ArrayBufferWriterTests.Advance with JitStress. (#42674)
Sergey Andreenko [Fri, 25 Sep 2020 16:10:35 +0000 (09:10 -0700)]
Disable ArrayBufferWriterTests.Advance with JitStress. (#42674)

* Disable ArrayBufferWriterTests.Advance with JitStress.

Issue #42517

* Try to disable broader.

3 years agoAdjust for roslyn change on ref parameters and NotNullIfNotNull (#42707)
Julien Couvreur [Fri, 25 Sep 2020 15:27:10 +0000 (08:27 -0700)]
Adjust for roslyn change on ref parameters and NotNullIfNotNull (#42707)

* Adjust for roslyn change on ref parameters

* Adjust for roslyn change on NotNullIfNotNull

3 years agoFix mono_aot_plt_trampoline GC unsafe assumption. (#42685)
monojenkins [Fri, 25 Sep 2020 14:46:32 +0000 (10:46 -0400)]
Fix mono_aot_plt_trampoline GC unsafe assumption. (#42685)

managed->native wrapper does the following under coop:

enter gc safe
native call
exit gc safe

since enter/exit gc safe are icalls they will be called through PLT on AOT builds. First call through a PLT slot will resolve the function using mono_aot_plt_trampoline and it currently assumes GC safe mode, so when hit as part of resolving exit gc safe, it is called under GC safe mode.

This has not showed up to be an issue under coop AOT, but asserts when running under checked build.

Fix will make sure thread is in GC unsafe mode making sure assumption of GC unsafe mode holds.

Co-authored-by: lateralusX <lateralusX@users.noreply.github.com>
3 years agoUpdate docs and comments to reflect the renames around build-test and runtest scripts...
Tomáš Rylek [Fri, 25 Sep 2020 12:28:59 +0000 (14:28 +0200)]
Update docs and comments to reflect the renames around build-test and runtest scripts (#42708)

* Move the script runtesttilstable.sh under src/tests

* Update most references to build-test / runtest in the runtime repo

With this change I can't find any remaining orphaned references to
the old script names except for a few superpmi-related scripts
I need to follow up on separately as I'm not too familiar with
their functionality.

Thanks

Tomas

3 years agoEnable several more IDE analyzer warnings (#42692)
Stephen Toub [Fri, 25 Sep 2020 10:33:07 +0000 (06:33 -0400)]
Enable several more IDE analyzer warnings (#42692)

* Enable IDE0062: Make local functions static

* Enable IDE0079: Remove unnecessary suppression

* Enable IDE0082: Convert typeof to nameof

* Enable IDE0043: Validate format string

* Enable IDE0041: Use is null check

3 years agoFix System.Net.Sockets telemetry (#42188)
Miha Zupan [Fri, 25 Sep 2020 08:16:18 +0000 (10:16 +0200)]
Fix System.Net.Sockets telemetry (#42188)

* Correct NameResolutionTelemetry logic

Taken from c4c9a2f99b7e339388199086d3014041abccc21e

* Enable listening to multiple sources with TestEventListener

* Workaround EventWrittenEventArgs bug when the EventArgs are stored

Workaround https://github.com/dotnet/runtime/issues/42128

* Correct System.Net.Sockets Telemetry

* Avoid using value tuple in TestEventListener

* Remove unnecessary argument to OnCompletedInternal

* Remove redundant Telemetry.IsEnabled check

* Log Connect/Accept start before the initial context capture

* Use SocketHelperBase in Accept tests

* Avoid duplicate events for BeginConnect without ConnextEx support

* Enable Sync Socket tests

* Revert unrelated SocketPal change

* Log the correct ErrorCode in case of socket disposal

* Add more info on TelemetryTest timeout

* Add PlatformSpecific attribute to ConnectFailure test

* Add missing BeginConnect AfterConnect call on sync failure

* Add comment around GetHelperBase

* Correct WaitForEventCountersAsync helper

* Assert against SocketError.TimedOut in ConnectFailed test

* Add EndConnect comment

* Log Failure around sync SocketPal exceptions

* Don't assert that the exception message is empty

* Dispose socket in a different Thread

* Disable Telemetry failure tests for Sync on RedHat7

* Use more descriptive names in MemberData generation

* Avoid using reflection for #42128 workaround

* Remove ConnectCanceled event

3 years agoRe-enable support for using the system libunwind (#42689)
Omair Majid [Fri, 25 Sep 2020 03:05:45 +0000 (23:05 -0400)]
Re-enable support for using the system libunwind (#42689)

We can now build runtime against the system libunwind using:

    ./build.sh -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND

This allows Linux distributions that already ship a compatible version
of libunwind library to use that instead of carrying a duplicate in
.NET. This provides some benefits to them, including smaller build
sizes, slightly faster builds and fewer places to fix any
vulnerabilities

This functionality was already supported in .NET Core 3.1 and has
regressed since.

CoreCLR already handles `-DCLR_CMAKE_USE_SYSTEM_LIBUNWIND`, so no
changes are needed there.

The libraries build doesn't care about this cmake varibale, but cmake
itself fails if the variable is not used:

    EXEC : CMake error : [runtime/src/libraries/Native/build-native.proj]
        Manually-specified variables were not used by the project:

          CLR_CMAKE_USE_SYSTEM_LIBUNWIND

So libraries just needs to check and ignore this variable.

The singlefilehost needs to link against libunwind too. Otherwise the
linker fails to resolve symbols, making the build fail:

    /usr/bin/ld: runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `UnwindContextToWinContext(unw_cursor*, _CONTEXT*)':
      dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:176: undefined reference to `_ULx86_64_get_reg'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:177: undefined reference to `_ULx86_64_get_reg'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:178: undefined reference to `_ULx86_64_get_reg'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:179: undefined reference to `_ULx86_64_get_reg'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:180: undefined reference to `_ULx86_64_get_reg'
    /usr/bin/ld: runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:181: more undefined references to `_ULx86_64_get_reg' follow
    /usr/bin/ld: runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `GetContextPointer(unw_cursor*, ucontext_t*, int, unsigned long**)':
      runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:227: undefined reference to `_ULx86_64_get_save_loc'
    /usr/bin/ld: runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `PAL_VirtualUnwind':
      runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:340: undefined reference to `_ULx86_64_init_local'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:351: undefined reference to `_ULx86_64_step'
    /usr/bin/ld: runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:360: undefined reference to `_ULx86_64_is_signal_frame'
    clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

Fixes: #42661

3 years agoExtend IDynamicInterfaceCastable test to cover public default-implemented methods...
Jeremy Koritzinsky [Fri, 25 Sep 2020 03:05:32 +0000 (20:05 -0700)]
Extend IDynamicInterfaceCastable test to cover public default-implemented methods on interface impl types. (#42544)

* Extend IDynamicInterfaceCastable test suite to validate current behavior around calling a default-implemented public method defined on the interface impl type.

* Change implementation to use Assert.Fail to describe failure.

* Add public modifier.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Fix failures.

3 years agoAdd logging test for SocketsHttpHandler.PlaintextStreamFilter (#42690)
Stephen Toub [Fri, 25 Sep 2020 02:46:57 +0000 (22:46 -0400)]
Add logging test for SocketsHttpHandler.PlaintextStreamFilter (#42690)

* Add logging test for SocketsHttpHandler.PlaintextStreamFilter

* Make ByteLoggingStream more efficient

3 years agoRemove code for GC Poll marking and insertion. (#42664)
Eugene Rozenfeld [Fri, 25 Sep 2020 01:35:01 +0000 (18:35 -0700)]
Remove code for GC Poll marking and insertion. (#42664)

This is a follow-up to
https://github.com/dotnet/runtime/issues/13582#issuecomment-542386711
and
https://github.com/dotnet/runtime/issues/13582#issuecomment-653235564

The code to insert gc polls was added in desktop for gc suspension not based
on hijaking. All platforms we target support hijaking so this code is not exercised
or tested. It also clutters other code and adds a bit of runtime overhead.
This change removes all that code.

There are minimal asm diffs because of a removed call to `fgRenumberBlocks`.

3 years ago[wasm][debugger][tests] Add tests related to hidden sequence points (#42705)
Ankit Jain [Fri, 25 Sep 2020 01:29:45 +0000 (21:29 -0400)]
[wasm][debugger][tests] Add tests related to hidden sequence points (#42705)

- this includes two tests that are not working, with files issues

3 years agoRemove unused file. (#42697)
Kevin Jones [Fri, 25 Sep 2020 00:58:21 +0000 (20:58 -0400)]
Remove unused file. (#42697)

3 years ago[aot] Add support for references to GENERIC_ARRAY_HELPER wrappers. (#42580)
monojenkins [Fri, 25 Sep 2020 00:42:13 +0000 (20:42 -0400)]
[aot] Add support for references to GENERIC_ARRAY_HELPER wrappers. (#42580)

The testcase only fails when AOTed using --aot=soft-debug.

Fixes https://github.com/mono/mono/issues/20421.

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
3 years agoAdd executeable bit to tizen sh files (#42533)
Eric StJohn [Fri, 25 Sep 2020 00:26:35 +0000 (17:26 -0700)]
Add executeable bit to tizen sh files (#42533)

3 years agoFix Activity.Baggage items Order (#42659)
Tarek Mahmoud Sayed [Thu, 24 Sep 2020 23:34:56 +0000 (16:34 -0700)]
Fix Activity.Baggage items Order (#42659)

3 years agoJIT: Remove double-{negation,not} in during morph phase (#32000)
damageboy [Thu, 24 Sep 2020 23:20:09 +0000 (02:20 +0300)]
JIT: Remove double-{negation,not} in during morph phase (#32000)

- fixes #13647
- Deals with arithmetic negation as well as bitwise-not
- Co-authored with @EgorBo holding my hand :)

3 years agoAdd merge-mch command for CI scripting (#42696)
Bruce Forstall [Thu, 24 Sep 2020 23:03:40 +0000 (16:03 -0700)]
Add merge-mch command for CI scripting (#42696)

3 years agoFix illink invocation inside VS (#42678)
Viktor Hofer [Thu, 24 Sep 2020 22:21:13 +0000 (00:21 +0200)]
Fix illink invocation inside VS (#42678)

* Fix illink invocation inside VS

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

* Update illink-sharedframework.targets

3 years agoFix assigning of config as it got swapped somehow (#42695)
Drew Scoggins [Thu, 24 Sep 2020 21:05:17 +0000 (14:05 -0700)]
Fix assigning of config as it got swapped somehow (#42695)

Co-authored-by: Drew Scoggins <andrew.g.scoggins@gmail>
3 years ago[wasm][debugger] Fix line number = 16777215 (#42640)
Thays Grazia [Thu, 24 Sep 2020 19:50:34 +0000 (16:50 -0300)]
[wasm][debugger] Fix line number = 16777215 (#42640)

* Fix line number = 16777215.

* Trying to get the line number before the hidden offset.

* Adding comments.

* Adding test case

* Removing extra new line

* Fixing line number

3 years ago[interp] Refactor finally block invocation (#42208)
monojenkins [Thu, 24 Sep 2020 18:39:47 +0000 (14:39 -0400)]
[interp] Refactor finally block invocation (#42208)

Stop managing a finally_ips list at runtime. It is cumbersome, redundant and has a performance penalty (since we malloc/free for every single finally block invocation).

For every EH clause we were allocating a local slot (exvar_offsets). This was used to store thrown exception for catch blocks, but wasted for finally blocks. Following this commit, we reuse that slot to store the endfinally return ip. When we execute the endfinally instruction we check this local slot and branch to that ip. If it is null, then we know we were called from EH and should bail out of interpreter execution loop. In normal execution, this return ip is set by MINT_CALL_HANDLER. For every leave IL instruction we explicitly generate a MINT_CALL_HANDLER for every finally block.

Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
3 years agosuperpmi.py script improvements (#42668)
Bruce Forstall [Thu, 24 Sep 2020 18:10:22 +0000 (11:10 -0700)]
superpmi.py script improvements (#42668)

* superpmi.py script improvements

1. Simplify and regularize superpmi and mcs tool finding: they are both looked
for first in Core_Root, then in the built product directory, then on the PATH.
2. Improve JIT-EE version determination: first, search for the GUID by parsing
corinfo.h, if found. Otherwise, use "mcs -printJITEEVersion" as before.
3. Improve JIT dll finding: search first in Core_Root, then in the built
product directory.
4. When downloading coredistools, create the Core_Root if it doesn't exist.

With these changes, you can build the "clr.runtime" subset then immediately run
a replay or asmdiffs, without first generating a Core_Root directory. The script
will automatically create the Core_Root directory simply to put coredistools in
it (and also use it as the "current directory" when running superpmi commands).

* Fix bug in altjit processing for 'collect', and 3 code review nits fixed

3 years agoFix SingleFile regression in client configuration (#42176)
Adeel Mujahid [Thu, 24 Sep 2020 17:53:00 +0000 (20:53 +0300)]
Fix SingleFile regression in client configuration (#42176)

* Fix SingleFile regression in client configuration

* Simplify condition

* Pass isSingleFile to GetTypeAndHashSuffix

3 years ago[wasm][debugger] Fixing step over in an async method (#42639)
Thays Grazia [Thu, 24 Sep 2020 17:09:43 +0000 (14:09 -0300)]
[wasm][debugger] Fixing step over in an async method (#42639)

* Fixing step over in an async method.

* Removing debugstore change.

3 years agoAddress additional feedback from number-handling PRs (#42505)
Layomi Akinrinade [Thu, 24 Sep 2020 16:30:29 +0000 (09:30 -0700)]
Address additional feedback from number-handling PRs (#42505)

* Address further feedback from number-handling PRs

* Address review feedback

3 years agoGuard against (de)serializing SerializationInfo instances (#42605)
Layomi Akinrinade [Thu, 24 Sep 2020 16:24:01 +0000 (09:24 -0700)]
Guard against (de)serializing SerializationInfo instances (#42605)

* Guard against (de)serializing SerializationInfo instances

* Address feedback

3 years agoOngoing work on the cmake build. (#42647)
Zoltan Varga [Thu, 24 Sep 2020 16:17:17 +0000 (12:17 -0400)]
Ongoing work on the cmake build. (#42647)

* Fix some warnings.
* Avoid creating netcore/config.make.
* Fix CPU_COUNT test.
* Add missing source file.

3 years ago [Mono] [GC] Fix TotalBytesAllocated and reenable test (#42388)
Nathan Ricci [Thu, 24 Sep 2020 16:15:08 +0000 (12:15 -0400)]
 [Mono] [GC] Fix TotalBytesAllocated and reenable test (#42388)

* Account for bytes in tlab when a thread detaches.

3 years agoExpose StackTraceHiddenAttribute publicly (#42632)
Stephen Toub [Thu, 24 Sep 2020 15:46:09 +0000 (11:46 -0400)]
Expose StackTraceHiddenAttribute publicly (#42632)

* Expose StackTraceHiddenAttribute publicly

* Add hiding tests

3 years agoadd SocketsHttpHandler.PlaintextStreamFilter (#42660)
Geoff Kizer [Thu, 24 Sep 2020 15:37:00 +0000 (08:37 -0700)]
add SocketsHttpHandler.PlaintextStreamFilter (#42660)

3 years agoInterleave GC Info with assembly (#42552)
Carol Eidt [Thu, 24 Sep 2020 15:16:32 +0000 (08:16 -0700)]
Interleave GC Info with assembly (#42552)

* Interleave GC Info with assembly

Output GC info deltas *after* the instruction (or label) that changes it.
Add `COMPlus_JitDisasmWithGC` option to turn on the interleaving with assembly.

Fix #41647

3 years agoUpdate intellisense package version to RC2 (#42220)
Santiago Fernandez Madero [Thu, 24 Sep 2020 13:54:00 +0000 (08:54 -0500)]
Update intellisense package version to RC2 (#42220)

* Update intellisense package version to RC2

* Update intellisense package.

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
3 years agoFix spelling errors in SslStream (#42662)
Tomas Weinfurt [Thu, 24 Sep 2020 13:13:04 +0000 (06:13 -0700)]
Fix spelling errors in SslStream (#42662)

3 years agoPrint help for -? and /? cross-plat (#42396)
Viktor Hofer [Thu, 24 Sep 2020 12:27:24 +0000 (14:27 +0200)]
Print help for -? and /? cross-plat (#42396)

* Print help for -? and /? cross-plat

3 years agoUse function pointers in crossgen2 (#42655)
Jan Kotas [Thu, 24 Sep 2020 09:38:23 +0000 (02:38 -0700)]
Use function pointers in crossgen2 (#42655)

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
3 years agoCompile test framework using R2RTest (#42617)
Jan Vorlicek [Thu, 24 Sep 2020 08:31:54 +0000 (10:31 +0200)]
Compile test framework using R2RTest (#42617)

This change switches crossgening of framework when building coreclr
tests to using R2RTest instead of explicitly invoking crossgen /
crossgen2.
To support that, the R2RTest was slightly updated to support specifying
target architecture, full path to crossgen2 and overriding the output
directory.

3 years ago[mono] Fix LLVM IR emission for Ssse3.AlignRight and Sse2/Sse41.Extract (#42648)
imhameed [Thu, 24 Sep 2020 08:07:13 +0000 (01:07 -0700)]
[mono] Fix LLVM IR emission for Ssse3.AlignRight and Sse2/Sse41.Extract (#42648)

The `mask` parameter to `shufflevector` must be a vector of `i32`s; we
were mistakenly using a vector of `i8`s previously.

`extractelement` requires that supplied index is smaller than the source
vector's length. The underlying instructions only pay attention to the
lower bits of the index, so replicate this behavior manually with
masking at the LLVM IR level.

This change makes JIT/HardwareIntrinsics/X86/Sse2/Sse2_{r,ro} pass with
LLVM JIT. LLVM AOT still makes this test fail for unrelated reasons.

This change makes more subtests in
JIT/HardwareIntrinsics/X86/Ssse3/Ssse3_{r,ro} pass with LLVM JIT. But
there are still other unrelated failures.

3 years ago[wasm][bindings] Fix an api regression introduced in #42486 (#42658)
Larry Ewing [Thu, 24 Sep 2020 04:35:51 +0000 (23:35 -0500)]
[wasm][bindings] Fix an api regression introduced in #42486 (#42658)

* Fix an api regression introduced in #42486

* Update src/mono/wasm/runtime/binding_support.js

a number it is

Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
3 years ago[runtime] Throw a MarshalDirectiveException when returning an array from a pinvoke...
monojenkins [Thu, 24 Sep 2020 03:19:22 +0000 (23:19 -0400)]
[runtime] Throw a MarshalDirectiveException when returning an array from a pinvoke method. (#42631)

Fixes https://github.com/mono/mono/issues/20367.

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
3 years agoAdd IDE warnings to code analysis ruleset (#42566)
Stephen Toub [Thu, 24 Sep 2020 02:26:31 +0000 (22:26 -0400)]
Add IDE warnings to code analysis ruleset (#42566)

- Add all IDEXXXX warnings to ruleset, but as hidden for now
- Enable IDE0073: file header mismatch

3 years agoSupport cp1252 codepage alias (#42599)
Tarek Mahmoud Sayed [Thu, 24 Sep 2020 01:34:33 +0000 (18:34 -0700)]
Support cp1252 codepage alias (#42599)

* Support cp1252 codepage alias

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix teh License comment in the file headers

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoFix use of uninitialized 'altjit' attribute (#42656)
Bruce Forstall [Thu, 24 Sep 2020 00:58:40 +0000 (17:58 -0700)]
Fix use of uninitialized 'altjit' attribute (#42656)

Change the `-altjit` flag to require passing a JIT filename. There are
too many altjits (cross-compile JITs) available now to be able to pick
a good default, so force the user to pick.

3 years agoEnsure Enumerable methods are preserved by System.Linq.Querable (#42603)
Eric Erhardt [Wed, 23 Sep 2020 22:22:05 +0000 (17:22 -0500)]
Ensure Enumerable methods are preserved by System.Linq.Querable (#42603)

* Ensure Enumerable methods are preserved by System.Linq.Querable

When using System.Linq.Queryable against an in-memory collection, and trimming the application, the underlying Enumerable methods need to be preserved by the linker.

Annotating each Queryable method with a DynamicDependency to the corresponding Enumerable method will fix this scenario.

Fix #42536

3 years agofix dwarf-based unwinding to the end of stack (#42620)
Yaroslav Yamshchikov [Wed, 23 Sep 2020 19:26:18 +0000 (22:26 +0300)]
fix dwarf-based unwinding to the end of stack (#42620)

We experience CLR crash on some architectures (at least in x86) in case
of unhandled managed exception. libunwind steps to the very end of a
stack, and if .eh_frame info is correct, it returns with retcode 0 and
ip=0 from unw_step, then PAL calls unw_is_signal_frame with
c->validate==0 which in turn dereferences zeroed ip in access_mem.
libunwind spec says that retcode 0 from unw_step means very end of a
stack, so PAL should not expect any frames, signal or not. It should
convert cursor back to SEH representation and return with TRUE.

3 years agoDelete unused Monitor.Wait argument (#42610)
Jan Kotas [Wed, 23 Sep 2020 19:23:55 +0000 (12:23 -0700)]
Delete unused Monitor.Wait argument (#42610)

* Delete unused Monitor.Wait argument

*  Move Monitor to shared partition

3 years agoReturn null from ClaimsPrincipal.Current if no thread principal. (#42622)
Kevin Jones [Wed, 23 Sep 2020 19:16:57 +0000 (15:16 -0400)]
Return null from ClaimsPrincipal.Current if no thread principal. (#42622)

* Return null from ClaimsPrincipal.Current if no thread principal.

In the .NET Framework, the AppDomain's default PrincipalPolicy is
UnauthenticatedPrincipal. When falling back to the thread's principal,
this would no throw because a GenericPrincipal was returned.
If the policy was changed to NoPrincipal, ClaimsPrincipal.Current would
throw constructing the ClaimsPrincipal since there is no principal.
However that behavior was opt-in.

In .NET Core, the default policy was changed to NoPrincipal, which would
mean unless a principal was explicitly set, Current would always throw.

This changes the behavior to return null instead of throw for
NoPrincipal. This is to continue supporting the existing behavior in
.NET Core 3 of returning null if there is no principal, but continue
to allow falling back to the thread's principal.

* Code review feedback.

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

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoDelete dead code in `genCheckUseBlockInit`. (#42601)
Eugene Rozenfeld [Wed, 23 Sep 2020 18:47:14 +0000 (11:47 -0700)]
Delete dead code in `genCheckUseBlockInit`. (#42601)

3 years agoFix nullable annotation on Socket.BeginSendFile (#42623)
Stephen Toub [Wed, 23 Sep 2020 18:34:29 +0000 (14:34 -0400)]
Fix nullable annotation on Socket.BeginSendFile (#42623)

3 years agoFix to allow entering cooperative GC mode when the thread is in a forbid-suspend...
Koundinya Veluri [Wed, 23 Sep 2020 17:08:45 +0000 (13:08 -0400)]
Fix to allow entering cooperative GC mode when the thread is in a forbid-suspend-for-debugger region (#42587)

- Followup to https://github.com/dotnet/runtime/pull/40060
- In short timing windows if a thread is placed in a pending-suspend-for-debugger state while in a forbid-suspend-for-debugger region, from the above PR it would not suspend for the debugger but it was missed that it can also get stuck in a perpetual spin-wait while entering cooperative GC mode. This causes the thread to not suspend for the debugger (VS times out after waiting) and the thread can only progress by unmarking it for debugger suspension.
- Fixed to break the spin-wait by checking whether the thread is in the forbid region

Fix for https://github.com/dotnet/runtime/issues/42375 in master

3 years agoJIT: initial version of a profile checker (#42481)
Andy Ayers [Wed, 23 Sep 2020 16:06:21 +0000 (09:06 -0700)]
JIT: initial version of a profile checker (#42481)

Adds a new flowgraph checker that tries to verify that the profile data is
self-consistent.

Use `COMPlus_JitProfileChecks=1` to enable in dumps, `=2` to raise asserts
if issues are found.

I plan on using this to start fixing the issues it finds and then perhaps
gradually enable more stringent checking.

3 years agoHTTP stress test improvements (#42313)
Marie Píchová [Wed, 23 Sep 2020 15:41:26 +0000 (17:41 +0200)]
HTTP stress test improvements (#42313)

Fixes:
    stress client double read of content fixed
    fixed stress client hangs at start and stop
    leveraged HttpVersionPolicy
    increased pipeline timeout since we doubled the runs
    fixed base docker images to avoid missing IO.Pipelines Kestrel exception.

Re-hauled tracing:
    added server file logging
    added log file rotation

Minor renames.

Contributes to: #42211 and #42198

3 years agoMake nullable-related checks consistent and faster (#42401)
Steve Harter [Wed, 23 Sep 2020 14:52:41 +0000 (09:52 -0500)]
Make nullable-related checks consistent and faster (#42401)

3 years agoFix singlefilehost build in non-portable mode (#42415)
Omair Majid [Wed, 23 Sep 2020 14:48:12 +0000 (10:48 -0400)]
Fix singlefilehost build in non-portable mode (#42415)

The singilefilehost needs to follow the libraries build in terms of how
it links to OpenSSL: if it's a non-portable build, the singlefilehost
needs to link to OpenSSL via linker arguments.

The installer also needs to have FEATURE_DISTRO_AGNOSTIC_SSL defined
just like it is defined for the libraries build.

Fixes: #41768

3 years agoFix a few Socket.SendFile issues (#42535)
Stephen Toub [Wed, 23 Sep 2020 13:22:58 +0000 (09:22 -0400)]
Fix a few Socket.SendFile issues (#42535)

* Fix a few Socket.SendFile issues

- The string argument in the single-argument overload should be nullable.
- All overloads on Windows should allow a null file path, but they've been throwing an exception
- On Linux, data was silently truncated when sending a file larger than int.MaxValue with BeginSendFile.

* Address PR feedback

3 years agoIntegrate changes in shared files from dotnet/runtimelab:NativeAOT (#42609)
Jan Kotas [Wed, 23 Sep 2020 13:16:12 +0000 (06:16 -0700)]
Integrate changes in shared files from dotnet/runtimelab:NativeAOT (#42609)

- Style analyzer fixes
- ARM64 port

3 years agoFix race condition in Environment.GetEnvironmentVariable (#42608)
Jan Kotas [Wed, 23 Sep 2020 12:55:32 +0000 (05:55 -0700)]
Fix race condition in Environment.GetEnvironmentVariable (#42608)

3 years agoRevert "Make Console.ReadKey() distinguish between CR and LF inputs" (#42470)
Eirik Tsarpalis [Wed, 23 Sep 2020 12:40:03 +0000 (13:40 +0100)]
Revert "Make Console.ReadKey() distinguish between CR and LF inputs" (#42470)

* Revert "Make Console.ReadKey() distinguish between CR and LF inputs (#37491)"

This reverts commit a62bfcbd6e03396e85232a73aeef10df9df5fa4d.

* Account for terminals that have ICRNL disabled

* Add manual tests that validates the current \n ReadKey() behaviour on Unix

3 years ago[master] Update dependencies from dotnet/xharness mono/linker dotnet/arcade Microsoft...
dotnet-maestro[bot] [Wed, 23 Sep 2020 09:59:47 +0000 (09:59 +0000)]
[master] Update dependencies from dotnet/xharness mono/linker dotnet/arcade Microsoft/vstest dotnet/llvm-project dotnet/icu (#42201)

[master] Update dependencies from dotnet/xharness mono/linker dotnet/arcade Microsoft/vstest dotnet/llvm-project dotnet/icu

 - Merge branch 'master' into darc-master-c2f56120-c0a9-49ac-83ec-d0550f2e6a36

 - Fix merge conflict

 - Revert override of local changes to send-to-helix.yml

 - Fix path to ILLink.Tasks.dll

 - Revert override of local changes to send-to-helix.yml

 - Revert override of local changes to send-to-helix.yml

 - Fix path to ILLink.Tasks.dll

 - Fix another path to ILLink.Tasks.dll

3 years agoFix the closure allocations in ActivityTagsCollection (#42606)
Tarek Mahmoud Sayed [Wed, 23 Sep 2020 06:28:04 +0000 (23:28 -0700)]
Fix the closure allocations in ActivityTagsCollection (#42606)

3 years agoadd tests to increase enum serialization code coverage (#40601)
Jackson Miller [Wed, 23 Sep 2020 04:57:04 +0000 (00:57 -0400)]
add tests to increase enum serialization code coverage (#40601)

* add tests to increase enum serialization code coverage

* implement feedback and add test to cover naming policy scenario

* remove unnecessary bound check now that all primitive types are supported

* Revert "remove unnecessary bound check now that all primitive types are supported"

This reverts commit 0a6a345ed3eaf65be8efbb51c6258a8448aaf9c1.

* implement review feedback

remove unnecessary serializer options in test
rename JsonNamingPolicy ToLower -> ToLowerNamingPolicy

* Remove commented-out code

Co-authored-by: David Cantú <dacantu@microsoft.com>
3 years agoRewrite Type.GetTypeFromProgID in C# (#42546)
Jan Kotas [Wed, 23 Sep 2020 01:08:15 +0000 (18:08 -0700)]
Rewrite Type.GetTypeFromProgID in C# (#42546)

- Move CoreRT managed implementation of Type.GetTypeFromProgID to CoreCLR
- Delete dead code and unnecessary levels of indirection
- Add tests for Type.GetTypeFromProgID and Type.GetTypeFromCLSID

3 years agoAlways generate resx default values in ComponentModel.DataAnnotations (#42274)
Eric Erhardt [Tue, 22 Sep 2020 22:12:28 +0000 (17:12 -0500)]
Always generate resx default values in ComponentModel.DataAnnotations (#42274)

Since many resource strings in ComponentModel.DataAnnotations contain messages that will be shown to end-users, we generate the "default value" string into the SR code. When a trimmed app strips the system resources, these strings will be used instead of the resource keys.

Fix #42257

3 years agoRyuJIT: Optimize "x<0" to "x>>31" (#35627)
Egor Bogatov [Tue, 22 Sep 2020 22:07:35 +0000 (01:07 +0300)]
RyuJIT: Optimize "x<0" to "x>>31" (#35627)

* Optimize x<0 to x>>31
* enable for x86, handle "x>=0" case

3 years agoAddress reliability issue with setting ITypeInfo (#42560)
Aaron Robinson [Tue, 22 Sep 2020 21:27:00 +0000 (14:27 -0700)]
Address reliability issue with setting ITypeInfo (#42560)

3 years agoReduce the number of platforms run by the ilasm round-trip test (#42567)
Bruce Forstall [Tue, 22 Sep 2020 20:53:06 +0000 (13:53 -0700)]
Reduce the number of platforms run by the ilasm round-trip test (#42567)

Specifically, don't run on Windows arm32. Also, don't
run on the musl platforms, either; just run on the same set
as most of the JIT pipelines.

3 years agoTweak crossgen2 so that SuperPMI should work (#42555)
David Wrighton [Tue, 22 Sep 2020 17:55:10 +0000 (10:55 -0700)]
Tweak crossgen2 so that SuperPMI should work (#42555)

- Remove unneeded getBuiltinClass for CLASSID_ARGUMENT_HANDLE from SuperPMI
- Tweak crossgen2 single threaded compilation to reliably only use exactly 1 for compilation
  - This allows superpmi to rely on the detail that handles are unique.
  - This assumes that superpmi collection is done with the compilation options `--parallelism 1`

3 years agoFirst steps towards x86 compatible crossgen2 (#42471)
David Wrighton [Tue, 22 Sep 2020 17:54:17 +0000 (10:54 -0700)]
First steps towards x86 compatible crossgen2 (#42471)

- Fix bug in crossgen2 around compilation of type forwarder only assemblies
- Use 64bit x86 crossgen2 when running crossgen2 as part of test build
- Disable inlined pinvoke generation on X86 until failures are understood
- Autolayout alignment should align to 4 byte offsets on X86 platforms
- Convert ArgIterator to use CoreCLR ABI instead of ProjectN ABI
- Align instance fields of classes to the start of the fields of the object, not the start of the object
- Fix hardware intrinsic support for X86
- MDArray address method uses custom calling convention on X86
- X86 JIT expects VM to normalize some single element structures to int, and inptr types
- Enable crossgen2smoke test for x86

With this change the crossgen2smoke test passes when compiled with crossgen2, as do simpler tests which use a crossgen2 compiled variant of the framework libraries. crossgen2smoke + libraries compiled with crossgen2 does not pass due to issues in resource handling.

3 years agoBuild and archive all JITs in the JIT rolling build (#42559)
Bruce Forstall [Tue, 22 Sep 2020 17:12:09 +0000 (10:12 -0700)]
Build and archive all JITs in the JIT rolling build (#42559)

* Build and archive all JITs in the JIT rolling build

* Disable debug info uploading

3 years ago[mono] Add test for wasm loader regression, fix loading from bundle (#42425)
Ryan Lucia [Tue, 22 Sep 2020 16:57:57 +0000 (12:57 -0400)]
[mono] Add test for wasm loader regression, fix loading from bundle (#42425)

* Add LoaderLinkTest

As-is, this will fail on Browser

* Disable LoadFromAssemblyName_ValidTrustedPlatformAssembly on Browser

This test relies on loading corelib from disk via Assembly.Location, none of which works on Browser. It passing historically is a quirk of our previously broken implementation.

* Fix mono netcore bundle loading algorithm

Load after checking the default ALC, non-satellite loads go into the default ALC, satellite loads go into the parent assembly's ALC (following the managed logic)

3 years agoFix createdump on the alpine distro (#42565)
Mike McLaughlin [Tue, 22 Sep 2020 16:36:48 +0000 (09:36 -0700)]
Fix createdump on the alpine distro (#42565)

The stack unwinding in createdump was looping forever on the same IP (different SP) when it
was attempting to unwind a frame that was in the ld module (typically libld*.so or on alpine
ld-musl-x86_64.so). The ld module on Alpine doesn't having any unwind info (GNU_EH_FRAME empty)
causing the libunwind code to loop on the same IP.

This was caused by a recent change in PR #42159 to createdump that included the ld in the
coredump. Createdump wouldn't attempt to unwind IPs in the ld module because it wasn't added
to the module lookup list.

Including the ld module is important to the windbg linux support so it will have to be revisited
in 6.0 by changing the remote unwinder to handle this case of the Alpine ld module.

3 years agoImprove ConnectCallback tests (#42562)
Geoff Kizer [Tue, 22 Sep 2020 16:11:59 +0000 (09:11 -0700)]
Improve ConnectCallback tests (#42562)

* make existing tests run on HTTP2

* add exception test

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years ago[interp] Track MINT_MONO_LDPTR as constants (#42531)
monojenkins [Tue, 22 Sep 2020 15:34:37 +0000 (11:34 -0400)]
[interp] Track MINT_MONO_LDPTR as constants (#42531)

This allows us to optimize out checks like `typeof(T1) == typeof(T2)`, which is very common in bcl.

Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
3 years agoMark some APIs throwing PNSE from runtime as unsupported on Browser (#42310)
Maxim Lipnin [Tue, 22 Sep 2020 15:27:27 +0000 (18:27 +0300)]
Mark some APIs throwing PNSE from runtime as unsupported on Browser (#42310)

* Mark some APIs throwing PNSE from runtime as unsupported on Browser

* Annotate APIs in coreclr part

3 years ago[browser] Reenable marshal library tests (#42574)
Maxim Lipnin [Tue, 22 Sep 2020 15:04:45 +0000 (18:04 +0300)]
[browser] Reenable marshal library tests (#42574)

3 years agoFix argument type in a call to SSLSetEnabledCiphers (#42543)
Jan Vorlicek [Tue, 22 Sep 2020 08:44:08 +0000 (10:44 +0200)]
Fix argument type in a call to SSLSetEnabledCiphers (#42543)

The latest version of macOS clang from XCode 12 beta complains about
data type of the 2nd argument passed to SSLSetEnabledCiphers.
This change fixes it by casting it to the actual argument type.

3 years ago[wasm][debugger][tests] Add some async stepping tests (#42461)
Ankit Jain [Tue, 22 Sep 2020 05:36:56 +0000 (01:36 -0400)]
[wasm][debugger][tests] Add some async stepping tests (#42461)

* [wasm][debugger][tests] Move stepping tests to a separate file

* [wasm][debugger][tests] Add more async stepping tests, some of which are

.. failing.

3 years agoAdd support for associating BrowserDebugHost with parent process (#42541)
Safia Abdalla [Mon, 21 Sep 2020 23:31:34 +0000 (23:31 +0000)]
Add support for associating BrowserDebugHost with parent process (#42541)

3 years agoAdd test case for growing beyond buffer size in Utf8JsonWriter (#28409) (#36917)
Josh Schreuder [Mon, 21 Sep 2020 21:45:22 +0000 (07:45 +1000)]
Add test case for growing beyond buffer size in Utf8JsonWriter (#28409) (#36917)

* Add test case for growing beyond buffer size in Utf8JsonWriter (#28409)

* Update with review feedback

Co-authored-by: Josh Schreuder <josh.schreuder@gmail.com>
3 years agoAnnotate handle indirections with GTF_IND_INVARIANT and add validation to fgDebugChec...
Brian Sullivan [Mon, 21 Sep 2020 18:50:03 +0000 (11:50 -0700)]
Annotate handle indirections with GTF_IND_INVARIANT and add validation to fgDebugCheckFlags (#42021)

* Rename GTF_ICON_PTR_HDL to GTF_ICON_PTR_GLOBAL - Use this whenever we are embedding a pointer to mutable data from the VM state

* Rename GTF_ICON_PSTR_HDL to GTF_ICON_CONST_PTR, use this when the constant is a pointer to immutable data, (e.g. IAT_PPVALUE)

* Use GTF_ICON_TOKEN_HDL only for a constant that is a token handle, other than class, method or field.

* In gtDispConst - print H or I when we have a handle, or O for a field offset
In gtNewStringLiteralNode - Added assert for non-CoreRT case of a IAT_VALUE of a TYP_REF

* In optHoistThisLoop - print if the loop has a single exit or multiple exits
as this can currently significantly limit our hoisting optimization.

* Added assert for later lowering of IAT_PPVALUE in Lowering::LowerDirectCall
and comment in Lowering::LowerNonvirtPinvokeCall where we currently allow this late expansion.

* Added function fgDebugCheckDispFlags to support extra flag checking of GTF_IND_INVARIANT
Disable the GTF_IND_INVARIANT for the cases that currentlt do not set it correctly.

* Added additional support for checking of GTF_IND_NONFAULTING in fgDebugCheckFlags (disabled)
Minor changes with GTF_IND_NONFAULTING
Added assert(!"Check this")
Add check for GTF_ICON_PINVKI_HDL // Eventually remove, as this is immutable

* Changed a GTF_ICON_FIELD_HDL to be invariant in fgMorphField
Added  assert(!"Unreached GTF_IND_INVARIANT") in fgMorphField
Fixed IAT_PPVALUe and modified IAT_PVALUE cases in fgMorphLeaf for GT_FTN_ADDR

* Mark indirection of handles created by gtNewIconEmbHndNode as invariant
This was previously #ifdef out
ran jit-format

* Enable checking of GTF_IND_INVARIANT in fgDebugCheckFlags

* Fix Compiler::fgMorphLeaf for extra fgMorpgTree in GT_FTN_ADDR IAT_VALUE case
Removed #if 0 code

* Reverse the if-the-else block for creating a static field address or value
Remove the unreachable block

* Added asserts to gtNewIndOfIconHandleNode if isInvariant is set incorrectly, set GTF_GLOB_REF for all class static indirections
Check that all class static indirections have GTF_GLOB_REF set
Changed two asserts to be noway_asserts
Changed the indirection that points to the array initialization blob to be a GTF_ICON_CONST_PTR instead of a GTF_ICON_STATIC_HDL.
Changed the indirection that fetches the field offset value for ReadyToRun to be a GTF_ICON_CONST_PTR instead of a GTF_ICON_FIELD_HDL.

* ifdef 0 code to touch the codegen of Generic methods via GTF_DONT_CSE

* Rename of GTF_ICON_PTR_GLOBAL to GTF_ICON_GLOBAL_PTR

* Refactor morph of static field and eliminate the dead code

* Add method header for fgDebugCheckDispFlags
Rename of GTF_ICON_GLOBAL_PTR) for emitarm64.ccp

3 years agoEncode the alt-svc header after pseudo-headers ("All pseudo-header fields MUST appear...
Cory Nelson [Mon, 21 Sep 2020 18:29:23 +0000 (11:29 -0700)]
Encode the alt-svc header after pseudo-headers ("All pseudo-header fields MUST appear in the header field section before regular header fields.") (#42545)

3 years agoAdd CSharpCodeGenerator tests (#33886)
Hugh Bellamy [Mon, 21 Sep 2020 17:58:39 +0000 (18:58 +0100)]
Add CSharpCodeGenerator tests (#33886)

* Add CSharpCodeGenerator tests

3 years agoSupport auto-download of JIT baseline for SuperPMI asm diffs (#42511)
Bruce Forstall [Mon, 21 Sep 2020 17:22:54 +0000 (10:22 -0700)]
Support auto-download of JIT baseline for SuperPMI asm diffs (#42511)

Add `-base_git_hash` to allow specifying the exact baseline hash to use.

Depends on JIT rolling build implemented in https://github.com/dotnet/runtime/pull/42507

Allows running asm diffs with just:

    python superpmi.py asmdiffs

3 years agoAdd CLR JIT rolling build (#42507)
Bruce Forstall [Mon, 21 Sep 2020 17:11:08 +0000 (10:11 -0700)]
Add CLR JIT rolling build (#42507)

Build just the JIT, and upload the resulting JIT DLL to
CLR JIT Azure Storage.

This will be used as a baseline JIT for developer use, such
as assembly diffs.

Linux arm and Linux arm64 are disabled for now, until we can
determine how to properly configure Python on the build machines
with the azure-storage-blob package required for upload of the
JIT to Azure blob storage.

3 years agoFix Enumerable.Take/SkipLast on mutable collections (#42506)
Stephen Toub [Mon, 21 Sep 2020 13:48:21 +0000 (09:48 -0400)]
Fix Enumerable.Take/SkipLast on mutable collections (#42506)

* Fix Take/SkipLast on mutable collections

LINQ operators are lazy and can't factor in the current contents of a mutable list when making decisions about how to subsequently process that list.

* Address PR feedback

3 years agoFix mapping of files from bundle to only map the necessary part (#42402)
Vitek Karas [Mon, 21 Sep 2020 13:20:13 +0000 (06:20 -0700)]
Fix mapping of files from bundle to only map the necessary part (#42402)

Mapping the whole bundle every time leads to VM space starvation. Which mostly matters on 32bit.

3 years agoFix typos in comment (#42367)
Martin Costello [Mon, 21 Sep 2020 09:58:31 +0000 (10:58 +0100)]
Fix typos in comment (#42367)

Fix a handful of typos in a comment for AllocateUninitializedArray<T>().

3 years agoCleanup libraries CMakeLists (#42380)
Jan Vorlicek [Mon, 21 Sep 2020 09:10:44 +0000 (11:10 +0200)]
Cleanup libraries CMakeLists (#42380)

* Cleanup libraries CMakeLists

The Windows CMakeLists.txt was unnecessarily using build configuration
information extracted from an environment variable to set
configuration specific options. Generator expressions are a better way
to handle that.

Besides that, I've also added support for Checked build.

Both of these changes are needed for the single exe host work where
libraries will be built during coreclr build.

3 years agoFix artifact source globbing for extract (#42484)
Matt Mitchell [Mon, 21 Sep 2020 08:27:40 +0000 (01:27 -0700)]
Fix artifact source globbing for extract (#42484)

* Fix artifact source globbing for extract
There was a change the extract AzDO task that fixed a bug where it appeared to be matching some subpaths without globbing.

If you specified foo/x* it would apparently match subpaths of foo. Runtime was relying on this behavior, as the artifact target directory would implicitly get a subdirectory which was the artifact name, but not including that artifact name in the globbing pattern.

Fix this by including ** before the archive.

* Update download-artifact-step.yml

3 years agoemit test for bounds checks against a 0 index (#42295)
nathan-moore [Mon, 21 Sep 2020 06:58:52 +0000 (02:58 -0400)]
emit test for bounds checks against a 0 index (#42295)

* emit test for bounds checks against 0

* formatting

* remove dead code

* formatting

3 years agoFix the mechanism getting Constructed Culture (#42480)
Tarek Mahmoud Sayed [Sat, 19 Sep 2020 22:42:35 +0000 (15:42 -0700)]
Fix the mechanism getting Constructed Culture (#42480)

3 years agoFix Getting default parent span Id with root Parent (#42483)
Tarek Mahmoud Sayed [Sat, 19 Sep 2020 20:16:57 +0000 (13:16 -0700)]
Fix Getting default parent span Id with root Parent (#42483)

3 years agoMemory Leak in Microsoft.Extensions.Caching.Memory when handling exceptions (#42355)
Eric Erhardt [Sat, 19 Sep 2020 15:39:50 +0000 (10:39 -0500)]
Memory Leak in Microsoft.Extensions.Caching.Memory when handling exceptions (#42355)

* Memory Leak in Microsoft.Extensions.Caching.Memory when handling exceptions

When an exception is thrown inside MemoryCache.GetOrCreate, we are leaking CacheEntry objects. This is because they are not being Disposed properly, and the async local CacheEntryStack is growing indefinitely.

The fix is to ensure the CacheEntry objects are disposed correctly. In order to do this, I set a flag to indicate whether the CacheEntry.Value has been set. If it hasn't, Disposing the CacheEntry won't add it to the cache.

Fix #42321

* Fix another memory leak when one cache depends on another cache. The inner cache's entries will reference the outer cache entries through the ScopeLease object.

Null'ing out the CacheEntry._scope field when it is disposed fixes this issue.

3 years agoSemaphoreSlim spelling corrections (#42451)
Frank Bolero [Sat, 19 Sep 2020 11:16:34 +0000 (13:16 +0200)]
SemaphoreSlim spelling corrections (#42451)

* Fixes comment spelling errors in SemaphoreSlim.cs

Words "increments" and "exceeded" where incorrectly spelled.

* Text change for clarity

Changed maxi to maximum to align with the rest of the comments
and variables in the file.

3 years agoFix JS<->WASM string marshaling crash (#42486)
Katelyn Gadd [Sat, 19 Sep 2020 11:04:53 +0000 (04:04 -0700)]
Fix JS<->WASM string marshaling crash (#42486)

Fix JS strings being truncated at the first null when passed to mono
Fix crashes when moving large strings across the JS<->WASM boundary

3 years agoAvoid reusing Regex.Replace Match objects with MatchEvaluator (#42452)
Stephen Toub [Sat, 19 Sep 2020 10:52:30 +0000 (06:52 -0400)]
Avoid reusing Regex.Replace Match objects with MatchEvaluator (#42452)

One of the allocation-related optimizations we made for Regex in .NET 5 was for Regex.Replace and Regex.Split to not allocate unnecessary Match objects.  Previously, every match was producing a Match object which was then used to implement the API's semantics.  But in the case of an API like `Replace(string, string)`, those Match objects never make their way out to user code, so we can avoid creating a new Match object each time and instead only create one Match object for the whole operation and just reuse it over and over.

However, one of the overloads of Regex.Replace accepts a MatchEvaluator, a delegate that's handed the Match object.  The intent is that the callback fishes out from the Match whatever it needs and doesn't hold onto the Match object, that ownership isn't transferred... but it turns out some applications are indeed storing these Match objects and assuming ownership... and the reuse behavior breaks that.

This PR tweaks the caching behavior to be parameterized, only reusing the match object from callers where the Match object is never handed out to user code.

3 years agoFix several BeginXx nullable annotations (#42442)
Stephen Toub [Sat, 19 Sep 2020 10:51:20 +0000 (06:51 -0400)]
Fix several BeginXx nullable annotations (#42442)

AsyncCallback and object state parameters in APM BeginXx methods should always be nullable.  Several in annotated libraries were annotated incorrectly.

3 years ago Use ReadOnlySpan<byte> for parsing FileWatcher responses (#42474)
Jan Kotas [Sat, 19 Sep 2020 04:30:43 +0000 (21:30 -0700)]
 Use ReadOnlySpan<byte> for parsing FileWatcher responses (#42474)

3 years agoA small ref PR in preparation for arm64 apple work. (#42270)
Sergey Andreenko [Sat, 19 Sep 2020 01:20:12 +0000 (18:20 -0700)]
A small ref PR in preparation for arm64 apple work. (#42270)

* Mark some getters as const to avoid build errors.

* use `gtGetStructHandle` if `NO_CLASS_HANDLE` means an error.

* Add `GetStructHnd` to `LclVarDsc`.

A small contirubtion to https://github.com/dotnet/runtime/issues/32648.

* additional asserts

3 years agoUpdate to latest StyleCop.Analyzers and Microsoft.CodeAnalysis.NetAnalyzers (#42413)
Stephen Toub [Sat, 19 Sep 2020 01:04:45 +0000 (21:04 -0400)]
Update to latest StyleCop.Analyzers and Microsoft.CodeAnalysis.NetAnalyzers (#42413)