platform/upstream/dotnet/runtime.git
3 years agoFix comment causing formatting leg in CI to fail (#44197)
Stephen Toub [Tue, 3 Nov 2020 15:23:03 +0000 (10:23 -0500)]
Fix comment causing formatting leg in CI to fail (#44197)

3 years agodisable MockQuicStreamConformanceTests.Parallel_ReadWriteMultipleStreamsConcurrently...
Tomas Weinfurt [Tue, 3 Nov 2020 13:25:02 +0000 (05:25 -0800)]
disable MockQuicStreamConformanceTests.Parallel_ReadWriteMultipleStreamsConcurrently (#44184)

* disable MockQuicStreamConformanceTests.Parallel_ReadWriteMultipleStreamsConcurrently

* Update QuicStreamConnectedStreamConformanceTests.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoFix/remove TODO-NULLABLE in System.Private.Xml (#44149)
Krzysztof Wicher [Tue, 3 Nov 2020 13:18:46 +0000 (14:18 +0100)]
Fix/remove TODO-NULLABLE in System.Private.Xml (#44149)

* Fix/remove TODO-NULLABLE in System.Private.Xml

* update contract for System.Xml.ReaderWriter

* follow up changes

3 years agoFill out hardware intrinsics linker substitutions for unsupported platforms (#44156)
Eric Erhardt [Tue, 3 Nov 2020 11:36:45 +0000 (05:36 -0600)]
Fill out hardware intrinsics linker substitutions for unsupported platforms (#44156)

Fix #44146

3 years agoFix race condition in timeout handling and GetAsync_ContentCanBeCanceled (#44169)
Stephen Toub [Tue, 3 Nov 2020 10:55:04 +0000 (05:55 -0500)]
Fix race condition in timeout handling and GetAsync_ContentCanBeCanceled (#44169)

There are three issues here.

Two tests issues:
1. When the client times out, it could do so while the server is still reading the request or sending the response, in which case the server can fail and cause the test to fail.  The server failure needs to be ignored.
2. when the client times out, it could do so before it even initiates the request, in which case the test would hang while the server waits indefinitely for a request that'll never arrive.  The server waiting needs to factor in the client's completion.

And one product issue:
1. The timeout handling we added in .NET 5 has a race condition that can, in extreme conditions (e.g. a unit test trying to force the interleaving) result in us not throwing the appropriate TimeoutException.  There are two different timer mechanisms used, the one based on Timer inside of CancellationTokenSource, and then the use of Envrionment.TickCount64 to track how much time has progressed.  Their quantums are different, so it's possible for the timer to fire due to the timeout expiring but Environment.TickCount64 not ticking over, at which point we'll read it and determine that the cause of the cancellation wasn't for a timeout.  The fix is to use the pending requests token source to check whether it or the timeout occurred, rather than using the time elapsed to determine which of the two occurred.

3 years agoMove serializable types for xml serialization generator tests to separate assembly...
Santiago Fernandez Madero [Tue, 3 Nov 2020 02:03:21 +0000 (18:03 -0800)]
Move serializable types for xml serialization generator tests to separate assembly (#44164)

* Move serializable types for xml serialization generator tests to separate assembly

* Add comment explaining why we need a separate assembly

3 years agoAdd stream conformance tests for standalone streams (#44069)
Stephen Toub [Tue, 3 Nov 2020 01:53:00 +0000 (20:53 -0500)]
Add stream conformance tests for standalone streams (#44069)

* Nullable-enable stream conformance tests

* Add standalone stream conformance tests

* Address PR feedback

3 years agoUse actual nint/nuint in Latin1Utility (#44162)
Stephen Toub [Tue, 3 Nov 2020 01:28:13 +0000 (20:28 -0500)]
Use actual nint/nuint in Latin1Utility (#44162)

3 years agoFix asserts that were always true due to a missed neg. (#44095)
Sergey Andreenko [Tue, 3 Nov 2020 01:26:04 +0000 (15:26 -1000)]
Fix asserts that were always true due to a missed neg. (#44095)

* Fix asserts that were always true due to missed neg.

* Ensure we don't assert for HWIntrinsics that already had the imm operand marked contained

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
3 years agoFix an assert which is hit when compiling Microsoft.CodeAnalysis.dll with llvmonly...
Zoltan Varga [Tue, 3 Nov 2020 00:47:33 +0000 (19:47 -0500)]
Fix an assert which is hit when compiling Microsoft.CodeAnalysis.dll with llvmonly. (#44092)

3 years agoRemove some unsafe code from System.Xml (#43379)
Levi Broderick [Tue, 3 Nov 2020 00:24:23 +0000 (16:24 -0800)]
Remove some unsafe code from System.Xml (#43379)

* Remove private DoubleToInt64Bits

* Remove unsafe IntToString implementation

* Remove unsafe AdjustLineInfo implementation

* Remove unsafe GetStringAligned implementation

* Remove unsafe code from BinHexDecoder

* Remove unsafe MemoryMarshal usage from CodeIdentifier

* Remove unsafe Base64Decoder implementation

* Remove unsafe code in GetSingle and GetDouble

* Remove unsafe code from CheckText

3 years agoMove the exclusion of unregister01/03 into general CoreCLR group (#44163)
Tomáš Rylek [Mon, 2 Nov 2020 23:30:42 +0000 (00:30 +0100)]
Move the exclusion of unregister01/03 into general CoreCLR group (#44163)

3 years ago[interp] Fix pinvoke passing of valuetype on wasm (#44129)
Vlad Brezae [Mon, 2 Nov 2020 23:10:22 +0000 (01:10 +0200)]
[interp] Fix pinvoke passing of valuetype on wasm (#44129)

For valuetypes, a stackval used to contain a pointer to the valuetype data, while currently the valuetype data is stored directly in the stackval.

3 years agoChanging Windows_NT -> Windows for enabling TargetPlatformMoniker feature of the...
Anirudh Agnihotry [Mon, 2 Nov 2020 22:25:58 +0000 (14:25 -0800)]
Changing Windows_NT -> Windows for enabling TargetPlatformMoniker  feature of the sdk for platform specific tfms. (#43651)

* eng change

* coreclr change

* libraries change

* tests change

* installer & mono change

* py files changed

* .md change

* .yml change

* remove redundant targetos property

* Windows_NT -> windows after ninja change

* fixing runtime build failure

3 years agoJSON continuation tests (#42393)
devsko [Mon, 2 Nov 2020 21:37:52 +0000 (22:37 +0100)]
JSON continuation tests (#42393)

* Repro #42070

* formatting

* namespace

* Fix

* never forget the header

* More tests
- Test continuation at every position inside the tested object
- Many member with primitive and nullable types
- One more level of nested object
- All combinations of class/struct for tested and nested object
- tested and nested object with parametrized ctor for some properties

* Addressed feedback

* refactoring

* Test with original repro data from #42070

* custom converter to ensure the padding is written in front of the tested object

* rename

* test data moved to Strings.resx

* Using test data from SR

* Generalize continuation tests for payloads of any length
Tweak the payload and expect `JsonException`

* merge

* Test deserialize with Utf8JsonReader and ReadOnlySequence

* Again with value typed nested object

* Add tests for splitted whitespaces

* Addressed feedback
Added dictionary test

* Validate line and position of failure in tweaked payloads
more tweaks

* Fixed comment

Co-authored-by: Layomi Akinrinade <laakinri@microsoft.com>
3 years agoRemove stale !s and TODO-NULLABLEs, plus those for indexer nullability tracking ...
Stephen Toub [Mon, 2 Nov 2020 21:13:53 +0000 (16:13 -0500)]
Remove stale !s and TODO-NULLABLEs, plus those for indexer nullability tracking (#44136)

3 years agoAdd property to reuse Android App signing key (#44085)
Mitchell Hwang [Mon, 2 Nov 2020 20:36:05 +0000 (15:36 -0500)]
Add property to reuse Android App signing key (#44085)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoStrip release builds on wasm. Avoid linking against libicudata.a, its not needed...
Zoltan Varga [Mon, 2 Nov 2020 20:25:31 +0000 (15:25 -0500)]
Strip release builds on wasm. Avoid linking against libicudata.a, its not needed. (#43951)

Fix warnings.

3 years agoSlight cleanup in hostpolicy (#44157)
Elinor Fung [Mon, 2 Nov 2020 20:22:46 +0000 (12:22 -0800)]
Slight cleanup in hostpolicy (#44157)

3 years agoUpdate Brotli to v1.0.9 (#44107)
Clinton Ingram [Mon, 2 Nov 2020 20:16:17 +0000 (12:16 -0800)]
Update Brotli to v1.0.9 (#44107)

* sync brotli source

* update runtime project

3 years agoRemove OSX_arm64 from platform group all (#44160)
Steve MacLean [Mon, 2 Nov 2020 19:44:18 +0000 (14:44 -0500)]
Remove OSX_arm64 from platform group all (#44160)

3 years agoSet the MSVC RuntimeLibrary properties for ASM_MASM when we use MASM. (#44155)
Jeremy Koritzinsky [Mon, 2 Nov 2020 17:45:54 +0000 (09:45 -0800)]
Set the MSVC RuntimeLibrary properties for ASM_MASM when we use MASM. (#44155)

3 years agoAdd NativeMainSource alternative to Android Sample App (#44076)
Mitchell Hwang [Mon, 2 Nov 2020 17:44:46 +0000 (12:44 -0500)]
Add NativeMainSource alternative to Android Sample App (#44076)

* Add NativeMainSource alternative to Android Sample

* Move nativeMainSource from parameter to property

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoFix incorrect handling of character range and capitalization in regex (#42282)
Prashanth Govindarajan [Mon, 2 Nov 2020 17:40:15 +0000 (09:40 -0800)]
Fix incorrect handling of character range and capitalization in regex (#42282)

* Bug fix and unit test

* Address comments

* An elegant fix and unit tests

* Remove old code

* Fix the unit tests

* sq

* sq

* Address comments and add test case

* Skip the unit tests on net framework

* Debug commit for CI

* Try to get more error info

* Run validation as a unit test.

Skip it on non-ICU environments

3 years agoDelete duplicate Buffer.Memmove implementations and avoid unnecessary pinning (#44118)
Stephen Toub [Mon, 2 Nov 2020 16:21:49 +0000 (11:21 -0500)]
Delete duplicate Buffer.Memmove implementations and avoid unnecessary pinning (#44118)

* Delete duplicate Buffer.Memmove implementations and avoid unnecessary pinning

We have several versions of Buffer.Memmove, including one implemented around `byte*` and one implemented around `ref byte`.  We can delete the former and just use the latter everywhere.  In doing so, we can also remove a few wrapper helpers, and reduce pinning in places where those wrappers were pinning to get pointers only to eventually end up in the ref-based implementation, anyway.

* Use ThrowHelper in more places

3 years agoAdd issues.targets CG2 entries for issue #44054 (#44142)
Tomáš Rylek [Mon, 2 Nov 2020 16:16:46 +0000 (17:16 +0100)]
Add issues.targets CG2 entries for issue #44054 (#44142)

3 years agoEnable using the Ninja generator instead of Visual Studio on Windows builds. (#41897)
Jeremy Koritzinsky [Mon, 2 Nov 2020 15:50:01 +0000 (07:50 -0800)]
Enable using the Ninja generator instead of Visual Studio on Windows builds. (#41897)

* Move DacTableGen out of the CMake build and into tools-local.

* Attempt: usenmakefiles means ninja.

* Make changes to Windows build to support non-VS generators like ninja.

* Use CMake 3.16 PCHs.

* Remove explicit process count.

* Build and run DacTableGen via the .NET CLI we pull down for the build instead of via CMake.

* Update configurecompiler.cmake to specify language (needed for Ninja).

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Get Ninja build working again.

* Pass configuration to cmake configure step for Ninja build.

* Rename flag

* Fix configure step for cross-arch native build

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Support building via Ninja for coreclr via an MSBuild property

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Implement support for opening the CoreCLR solution in VS via the -vs flag.

* Fix setting generator to Ninja.

* Merge libraries gen-buildsys-win.bat with runtime gen-buildsys.cmd to share windows cmake configure infra.

* Enable building libraries native build with ninja.

* Centralize setting CMAKE_SYSTEM_VERSION for windows builds.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Update host build to use shared gen-buildsys.cmd

* Fix multi-config generator detection.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Exit with success when we build successfully.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Enable and fix up Ninja build for hosts.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Only link delayimp.lib on Windows

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Remove "overriding /W3 with /W1" warning in Ninja build of hosts by turning on /W3 and disabling any new warnings we hit.

* Reduce command line override warnings by adopting the MSVC_RUNTIME_LIBRARY abstraction feature in CMake 3.14+ (below the minimum requirement on Windows).

* Use the delayed expansion syntax to correctly pass in the config to cmake.

* Move all usages of MSVC runtime library selection to the CMake abstraction to reduce console spew about overridden flags.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Condition the rest of the compiler options correctly so they don't show up as invalid parameter warnings for assembly builds.

* Correctly build DIALib and DacTableGen as AnyCPU

* Fix WRITE_BARRIER_CHECK define

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Fix passing arch for MSBuild build.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Configure ASM compiler command line format in configurecompiler.cmake and use CMake's assembly compilation step to build ASM files for ARM/ARM64 instead of manually building them and adding the generated files as additional sources.

* Cleanup after fixing ARM/ARM64 support.

* Rename variable

* Condition PCH's for C++-only as needed to fix using them on non-Windows (where we compile C as C instead of as C++).

* Fix CoreCLR native test build on windows to point to new gen-buildsys location.

* Add missing compilation options in Ninja build that are implicitly defined in the MSBuild build.

* Disable analyzers for DacTableGen. Remove /MAP linker flag (that's for local testing).

* Upgrade to CMake 3.16.4

* Don't warn on unused variables in CMake (these usually vary on platform/config)

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Manually compile ARM and ARM64 asm files when using the VS generator since it doesn't support emitting MARMASM item types in projects (and as a result cannot compile ARM or ARM64 asm without assistance).

* Enable CMake policy in test build to use CMAKE_MSVC_RUNTIME_LIBRARY variable.

* Update initially disabled warnings in host.

* Add -ninja arg to root scripts to enable using Ninja.

* Enable using Ninja in CoreCLR CI.

* Try to fix passing the -ninja arg in yaml.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Add ninja to the Windows invocation

* Fix 2-phase cross targeting to do one phase at a time and initialize the VC++ environment for the correct build tools each time instead of interleaving them and relying on Visual Studio to handle the differing targets.

* Restore old /Ox optimization setting for Release.

* Fix typos, don't pass exception flags to C files.

* Remove unneeded pragma.

* Fix .pgd file installation.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Add mention of the `-ninja` flag in the Building CoreCLR documentation.

Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
* Mention installation locations for Ninja and warn while building if CMake is older than 3.16.0.

* Update docs/workflow/requirements/windows-requirements.md

3 years agoSet GC_SUSPEND based on the target os not the host os. (#44093)
Zoltan Varga [Mon, 2 Nov 2020 15:47:15 +0000 (10:47 -0500)]
Set GC_SUSPEND based on the target os not the host os. (#44093)

* Set GC_SUSPEND based on the target os not the host os.

* Add ENABLE_LLVM_RUNTIME cmake option.

3 years agoFix equality check for unset variables (#44099)
Larry Ewing [Mon, 2 Nov 2020 15:44:29 +0000 (09:44 -0600)]
Fix equality check for unset variables (#44099)

3 years agoUse slightly smaller code for String.Concat(object, object, ...) (#44133)
Stephen Toub [Mon, 2 Nov 2020 15:04:55 +0000 (10:04 -0500)]
Use slightly smaller code for String.Concat(object, object, ...) (#44133)

C#, IL, and asm are all a bit smaller.  We don't need to set the arguments to Empty if they're null, as the called function checks for null.

3 years agoDelete dead AppendSpanFormattable method from ValueStringBuilder (#44135)
Stephen Toub [Mon, 2 Nov 2020 15:03:30 +0000 (10:03 -0500)]
Delete dead AppendSpanFormattable method from ValueStringBuilder (#44135)

3 years agoRemove some unused icalls. (#44128)
Zoltan Varga [Mon, 2 Nov 2020 08:46:35 +0000 (03:46 -0500)]
Remove some unused icalls. (#44128)

3 years ago(MQ cleanup) Remove size_t from managed Brotli code (#44043)
Levi Broderick [Mon, 2 Nov 2020 02:57:26 +0000 (18:57 -0800)]
(MQ cleanup) Remove size_t from managed Brotli code (#44043)

* Remove size_t from managed Brotli code

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoRemove unsafe code from String.Join (#44126)
Stephen Toub [Mon, 2 Nov 2020 02:18:01 +0000 (21:18 -0500)]
Remove unsafe code from String.Join (#44126)

* Remove unsafe code from String.Join

- Use a span for the separator to share the same code across a char separator and string separator, rather than using pointers.
- Consolidate argument validation for the value/startIndex/count overloads into one shared helper
- Change indexing to use standard 0 to values.Length for loop to eliminate bounds checking on span accesses

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

3 years agoRemove last remnants of IExpando support. (#44122)
Aaron Robinson [Sun, 1 Nov 2020 23:11:16 +0000 (15:11 -0800)]
Remove last remnants of IExpando support. (#44122)

3 years agoFix type generator test failures (#44041)
David Wrighton [Sun, 1 Nov 2020 22:54:35 +0000 (14:54 -0800)]
Fix type generator test failures (#44041)

- Fix issue where method token referred to derived type but method was actually defined on base type
  - Previously the methods did not carry enough state to determine when to emit the owner type of the method, and which exact type was the owning type. The new logic computes it from the token in the presence of a proper instantiation context, which allows for correct operation.

- Fix issue where constrained dispatch on a method of a valuetype would not put in the correct owner type
  - Issue fixed by determining if the token resolves to a method on the same type as the eventual target method, or if it needs to have a specific owning type specified

In general these issues where both caused by confusion around exactly the correct owning type, and it turned out that computation could not be computed within the signature emitter code, but instead needed to be computed in the JIT at point of use. Fortunately, we had a structure `MethodWithToken` that is used in these (and only these situations). Finally, I also made a pass through the emitter and related logic to remove various band-aids that had built up over the last few years to make all the tests and applications pass. I believe that the new logic should be correct in the general case.

Bonus tweak...  Use parallelism when compiling the framework composite images with crossgen2, and fix bug in composite image generation where mangled symbol names might conflict.

Fixes #43466 and fixes #43467

3 years agoAdd optimized String.Join for IList<string> (#44032)
John Call [Sun, 1 Nov 2020 17:37:08 +0000 (09:37 -0800)]
Add optimized String.Join for IList<string> (#44032)

* Support IList<string>

* Revert API change

* Feedback

* Use ReadOnlySpan

* Feedback

* Fix comment

* address feedback

* Add test for List<string> optimization

* Remove StartIndex and Count in core

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoDelete unnecessary seek from SetLengthInternal on Unix (#44097)
Jan Kotas [Sun, 1 Nov 2020 14:08:42 +0000 (06:08 -0800)]
Delete unnecessary seek from SetLengthInternal on Unix (#44097)

Also, improve test coverage for FileStream.SetLength

3 years agoAvoid linking against libicudata.a, its not needed. (#44105)
Zoltan Varga [Sun, 1 Nov 2020 07:01:15 +0000 (02:01 -0500)]
Avoid linking against libicudata.a, its not needed. (#44105)

3 years agoFix the typo (#44075)
SingleAccretion [Sun, 1 Nov 2020 03:00:39 +0000 (06:00 +0300)]
Fix the typo (#44075)

3 years ago[master] Update dependencies from dotnet/arcade dotnet/llvm-project dotnet/xharness...
dotnet-maestro[bot] [Sat, 31 Oct 2020 21:38:38 +0000 (21:38 +0000)]
[master] Update dependencies from dotnet/arcade dotnet/llvm-project dotnet/xharness (#44062)

[master] Update dependencies from dotnet/arcade dotnet/llvm-project dotnet/xharness

3 years agoRemove WinRT leftovers from mono's CoreLib (#44102)
Adeel Mujahid [Sat, 31 Oct 2020 16:36:26 +0000 (18:36 +0200)]
Remove WinRT leftovers from mono's CoreLib (#44102)

3 years agoMinor update to function signatures for RISCV64 architecture (#43862)
monojenkins [Sat, 31 Oct 2020 16:30:19 +0000 (12:30 -0400)]
Minor update to function signatures for RISCV64 architecture (#43862)

I don't believe this fixes any existing issue in the tracker, but I'm trying to build mono with dotnet-core on riscv from git and ran into this problem when compiling.  There may end up being other changes but I won't know until my VM is done actually building mono.  The changes right now are incredibly minor, just updating some function signatures to match the current rest of the system.

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: simcop2387 <simcop2387@users.noreply.github.com>
3 years agoFix IL interpreter build on GCC. (#44049)
hev [Sat, 31 Oct 2020 12:16:44 +0000 (20:16 +0800)]
Fix IL interpreter build on GCC. (#44049)

3 years agoDisable PollingEventFires test (#44096)
Stephen Toub [Sat, 31 Oct 2020 09:57:50 +0000 (05:57 -0400)]
Disable PollingEventFires test (#44096)

3 years agoOptimize String.Replace(string, string) (#44088)
Stephen Toub [Sat, 31 Oct 2020 02:22:49 +0000 (22:22 -0400)]
Optimize String.Replace(string, string) (#44088)

We can significantly improve its throughput for a few scenarios:
- If both oldValue and newValue are single characters in the form of strings, we can just delegate to the Replace(char, char) overload, which is much faster.
- If oldValue is a single character but newValue isn't, we can use IndexOf to find it, rather than an open-coded loop, making search times much faster for reasonably sized strings.
- If oldValue is multiple characters and the string being searched for isn't super frequent (e.g. doesn't repeat every few characters), we can significantly speed up throughput by using IndexOf to search for the whole string.  For example, replacing "\r\n" with "\n" in the contents of a typical file.

This does come at a measurable cost when the oldValue is really common and tightly packed, e.g. searching for "aa" in "aaaaaaaaaaaaaaaaaa", so we can decide whether the tradeoff is the right one.

3 years ago[Interp] Create an intrinsic for Interlocked.Exchange for int64 (#43893)
Fan Yang [Fri, 30 Oct 2020 21:06:32 +0000 (17:06 -0400)]
[Interp] Create an intrinsic for Interlocked.Exchange for int64 (#43893)

* Add an instrinsic for Interlocked.Exchange

* Hacks to help with development

* Remove one more layer of function call and revert local hacks

* Revert redundant format change

* make interlocked_mutex a global variable

* Update opcode name

* Resolve reviewer feedbacks

* Add a pair of braces.

3 years agoAdd area owners for System.Formats (#44038)
Carlos Sanchez [Fri, 30 Oct 2020 21:04:29 +0000 (14:04 -0700)]
Add area owners for System.Formats (#44038)

* Asn1

* Cbor

* Align last pipe, add missing pipes.

* Quic

* Additional owners for Asn1 and Cbor

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
3 years agoClean up debugger debug logging and wasm trace logging (#43960)
Larry Ewing [Fri, 30 Oct 2020 20:09:07 +0000 (15:09 -0500)]
Clean up debugger debug logging and wasm trace logging (#43960)

* Clean up debugger debug logging and wasm trace logging

* Update src/mono/mono/mini/mini-wasm-debugger.c

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
3 years agoEqualityComparer IndexOf to shared (#44065)
Ben Adams [Fri, 30 Oct 2020 19:42:38 +0000 (19:42 +0000)]
EqualityComparer IndexOf to shared (#44065)

3 years agoDelete area-Tizen
Jan Kotas [Fri, 30 Oct 2020 19:41:11 +0000 (12:41 -0700)]
Delete area-Tizen

3 years agoSet default value for value-type ctor params properly (#43831)
Layomi Akinrinade [Fri, 30 Oct 2020 18:38:27 +0000 (11:38 -0700)]
Set default value for value-type ctor params properly (#43831)

* Set default value for value-type ctor params properly

* Address review feedback

3 years agoSet number handling for properties read after deserializing ctor params (#43829)
Layomi Akinrinade [Fri, 30 Oct 2020 17:39:43 +0000 (10:39 -0700)]
Set number handling for properties read after deserializing ctor params (#43829)

* Set number handling for properties read after deserializing ctor params

* Use DeserializeWrapper pattern for tests

3 years agoEnable unused-result warning for PAL (#43395)
Adeel Mujahid [Fri, 30 Oct 2020 17:36:06 +0000 (19:36 +0200)]
Enable unused-result warning for PAL (#43395)

Delete the remaining dead variables and methods from PAL, that were
highlighted by gcc's dead code analysis, and enable `unused-result`
warning for PAL.

3 years agoFix gsharedvt constrained calls to Object.GetHashCode () which was broken by #43729...
Zoltan Varga [Fri, 30 Oct 2020 16:53:26 +0000 (12:53 -0400)]
Fix gsharedvt constrained calls to Object.GetHashCode () which was broken by #43729. (#44047)

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

3 years agoImplement the reuse of duplicate constant values (#43899)
Brian Sullivan [Fri, 30 Oct 2020 16:21:58 +0000 (09:21 -0700)]
Implement the reuse of duplicate constant values (#43899)

* Implement the reuse of duplicate constant value
- Duplicate values will now be reused in the constants area
- Added MIN_DATA_ALIGN and MAX_DATA_ALIGN constants
- Added dsDataType to record the type of the constant
- Print the floating point values in the constants area
- Changed 'alignment' and 'cnsSize' parameters to be unsigned instead of UNATIVE_OFFSET
- Added method emitDataGenFind to search and return a duplicate constant value

* Correctly place declaration of curOffs

* Code review feedback

* Carol's feedback

* Feedback from Tanner Gooding
Allow binary bit pattern matches of constants

* Fix build warning/error

* Jit Format

3 years ago[cmake] Add -DCHECKED_BUILD=args support, and check getters in Debug (#44024)
Aleksey Kliger (λgeek) [Fri, 30 Oct 2020 15:35:37 +0000 (11:35 -0400)]
[cmake] Add -DCHECKED_BUILD=args support, and check getters in Debug (#44024)

* [cmake] Add -DCHECKED_BUILD=args support, and check getters in Debug

Add support for additional compile-time and runtime checks to cmake.

Also for Debug builds, turn on the compile-time "private types" check that
verifies that getters are being used to access the fields of certain structs.

* [interp] Use getters

* remove unused stub

3 years agoAddress JsonElement doc and test feedback (#43832)
Steve Harter [Fri, 30 Oct 2020 14:36:55 +0000 (09:36 -0500)]
Address JsonElement doc and test feedback (#43832)

3 years agoRemove unused ifdef logic in ODBC (#44042)
Levi Broderick [Fri, 30 Oct 2020 09:52:58 +0000 (02:52 -0700)]
Remove unused ifdef logic in ODBC (#44042)

3 years agoAdd Stream argument validation helpers and use throughout dotnet/runtime (#43968)
Stephen Toub [Fri, 30 Oct 2020 09:50:49 +0000 (05:50 -0400)]
Add Stream argument validation helpers and use throughout dotnet/runtime (#43968)

* Add Stream argument validation helpers and use throughout dotnet/runtime

* Delete unnecessary code in Stream

Stream.Null was using BlockingBegin/EndRead/Write, but the operations are nops (they don't even do argument validation), so the functionality was unnecessary complication.  We can just use TaskToApm instead, with already completed tasks, and then also delete the SynchronousAsyncResult that was used by these operations.

Also, the Begin/EndRead/Write methods were checking CanRead/Write and throwing if they return false, but this is a private sealed type with CanRead/Write hardcoded to return true! Delete.

Finally added consistency across Stream.Null to checking for cancellation.

* Clean up some style on Stream

Also consolidate a few resources and use a few existing ThrowHelpers where appropriate.

* Fix a few issues, and remove duplicative tests missed in conformance tests rollout

* Address PR feedback

3 years agoEnable automated SPMI collection for outerloop tests (#43773)
Kunal Pathak [Fri, 30 Oct 2020 06:16:29 +0000 (23:16 -0700)]
Enable automated SPMI collection for outerloop tests (#43773)

* wip

* wip

* Parameterized SPMI collection

* move the condition

* change to variables

* Update displayName

* Change the format

* Revert "Change the format"

This reverts commit 292ba21c95026feae7528be449c99a0f20b4b068.

* Use variables.collectionName

* fix displayName

* use variables.collectionName for displayName

* print

* Use name

* fix condition

* Create 2 yml files

* Download test artifacts for tests collection

* Attempt to have multiple jobs

* Back to superpmi.yml

* Add missing parameter

* Use CollectionName at other places

* Use collectionName for artifacts, increase timeout for test

* try to merge whatever mch files we got

* Fixes

- increase the timeout for tests to 8 hours
- ignore file error in superpmi.py
- revert timeout setting from superpmi.proj

* fix the .mch file name

* fix typo

3 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20201027.10 (#44020)
dotnet-maestro[bot] [Fri, 30 Oct 2020 04:33:53 +0000 (04:33 +0000)]
Update dependencies from https://github.com/dotnet/arcade build 20201027.10 (#44020)

[master] Update dependencies from dotnet/arcade

3 years agoUse BinaryPrimitives where possible (#43474)
Levi Broderick [Fri, 30 Oct 2020 04:30:07 +0000 (21:30 -0700)]
Use BinaryPrimitives where possible (#43474)

3 years agoRemove some unnecessary List-related allocation from EventSource (#44026)
Stephen Toub [Thu, 29 Oct 2020 22:10:58 +0000 (18:10 -0400)]
Remove some unnecessary List-related allocation from EventSource (#44026)

3 years agoUse jitstd::sort instead of qsort in jit and gcinfo (#43923)
David Wrighton [Thu, 29 Oct 2020 21:26:44 +0000 (14:26 -0700)]
Use jitstd::sort instead of qsort in jit and gcinfo (#43923)

Current use of qsort interferes with cross compilation.

The qsort algorithm is quite different between Windows and Linux, thus causing cross compilation comparison failures while testing.

This replaces qsort with the use of jitstd::sort which provides a sort which is consistent between all platforms. (Particularly in Windows where CFG has costs for function pointer usage.) With a homegrown sort performance test, there is about 15-30% performance win with this sort over qsort. (However as these tests do not resemble the behavior of these sorts in the JIT I do not believe they are spectacularly relevant.)

There is a size cost of about 4KB-6KB for the templatized routines. I was unable to measure a performance difference for the JIT itself. (Crossgen is very slightly faster in my testing with the change, but I do not believe the difference is statistically meaningful.)

3 years agoremove unnecessary bound check (#42431)
Jackson Miller [Thu, 29 Oct 2020 21:11:04 +0000 (17:11 -0400)]
remove unnecessary bound check (#42431)

now that all primitive types are supported (thanks to #29000), we can
remove custom bound checks.

3 years agoUpdate coding-style.md
Stephen Toub [Thu, 29 Oct 2020 20:25:32 +0000 (16:25 -0400)]
Update coding-style.md

3 years agoSupport loading public-only PEM X.509 certificates
Kevin Jones [Thu, 29 Oct 2020 18:43:57 +0000 (14:43 -0400)]
Support loading public-only PEM X.509 certificates

Create an overload of CreateFromFile that accepts just the PEM-encoded
X.509 certificate that does not contain a private key.

3 years agoFix loading component when application was started with `dotnet` instead of apphost...
Elinor Fung [Thu, 29 Oct 2020 18:29:51 +0000 (11:29 -0700)]
Fix loading component when application was started with `dotnet` instead of apphost (#43962)

* Don't parse arguments in hostpolicy until necessary
* Explicit error on invalid startup info in hostfxr
* Update tests

3 years agoDisable the 'problematic assembly' code on .net core. (#44022)
Zoltan Varga [Thu, 29 Oct 2020 18:10:40 +0000 (14:10 -0400)]
Disable the 'problematic assembly' code on .net core. (#44022)

3 years agoFix #44004, disable assertion messages in release mode instead of debug. (#44023)
Zoltan Varga [Thu, 29 Oct 2020 18:08:44 +0000 (14:08 -0400)]
Fix #44004, disable assertion messages in release mode instead of debug. (#44023)

* Fix #44004, disable assertion messages in release mode instead of debug.

* Remove obsolete 'full_messages' enable-minimal option.

3 years agoRemove redundant lower function (#44010)
Fan Yang [Thu, 29 Oct 2020 14:12:57 +0000 (10:12 -0400)]
Remove redundant lower function (#44010)

3 years agoUpdate ServiceProviderServiceExtensions.cs (#43974)
David Pine [Thu, 29 Oct 2020 13:41:41 +0000 (08:41 -0500)]
Update ServiceProviderServiceExtensions.cs (#43974)

Use pattern matching, rather than `as` cast and `null` check.

3 years agoAvoid disabling assert messages in debug configuration on wasm to help debugging...
Zoltan Varga [Thu, 29 Oct 2020 05:20:18 +0000 (01:20 -0400)]
Avoid disabling assert messages in debug configuration on wasm to help debugging. (#44004)

3 years agoClarify string.IndexOf rules in code comments (#43999)
Levi Broderick [Thu, 29 Oct 2020 03:52:39 +0000 (20:52 -0700)]
Clarify string.IndexOf rules in code comments (#43999)

3 years agoBump xharness (#43996)
Alexander Köplinger [Thu, 29 Oct 2020 02:21:29 +0000 (03:21 +0100)]
Bump xharness (#43996)

Includes a potential fix for https://github.com/dotnet/runtime/issues/43983

3 years agoAdd back passing of --build-id option to Mono runtime build (#43993)
Alexander Köplinger [Thu, 29 Oct 2020 01:29:26 +0000 (02:29 +0100)]
Add back passing of --build-id option to Mono runtime build (#43993)

This got lost as part of CMake cleanup in https://github.com/dotnet/runtime/pull/43678 but it is actually important for some publishing infrastructure: https://github.com/dotnet/arcade/issues/6464

3 years ago[interp] return false for IsLittleEndian on BE (#43946)
Egor Bogatov [Thu, 29 Oct 2020 01:27:12 +0000 (04:27 +0300)]
[interp] return false for IsLittleEndian on BE (#43946)

To help those who maintain Mono for BE.
Also, it allows interpreter to fold branches since now IsLittleEndian is converted into `LDC.I4.1` always on LE.

Example:
```csharp
static void Validate()
{
    if (!BitConverter.IsLittleEndian)
        throw new PlatformNotSupportedException();
}
```
Current output for `MONO_VERBOSE_METHOD=Validate` on both LE/BE:
```
IR_0000: ldsfld.u1  0
IR_0003: brtrue.i4.s IR_000b
IR_0005: newobj_fast 3
IR_000a: throw
IR_000b: ret.void
```

New output on LE:
```
IR_0000: ret.void
```

3 years agoAdd static libraries for System.Native back to mobile runtime packs (#43987)
Alexander Köplinger [Wed, 28 Oct 2020 23:38:07 +0000 (00:38 +0100)]
Add static libraries for System.Native back to mobile runtime packs (#43987)

We need it for various scenarios there. It was removed in https://github.com/dotnet/runtime/pull/41966.

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

3 years ago[master] Update dependencies from mono/linker dotnet/arcade dotnet/xharness dotnet...
dotnet-maestro[bot] [Wed, 28 Oct 2020 23:34:18 +0000 (00:34 +0100)]
[master] Update dependencies from mono/linker dotnet/arcade dotnet/xharness dotnet/llvm-project dotnet/runtime-assets dotnet/icu (#43822)

* Update dependencies from https://github.com/mono/linker build 20201026.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.20525.1 -> To Version 6.0.0-alpha.1.20526.1

* Update dependencies from https://github.com/dotnet/arcade build 20201022.2

Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.ApiCompat
 From Version 6.0.0-beta.20520.8 -> To Version 6.0.0-beta.20522.2

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-alpha.1.20512.1 -> To Version 6.0.0-alpha.1.20526.1

* Update dependencies from https://github.com/mono/linker build 20201026.2

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.20525.1 -> To Version 6.0.0-alpha.1.20526.2

* Update dependencies from https://github.com/mono/linker build 20201027.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.20525.1 -> To Version 6.0.0-alpha.1.20527.1

* Update dependencies from https://github.com/dotnet/arcade build 20201025.1

Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.ApiCompat
 From Version 6.0.0-beta.20520.8 -> To Version 6.0.0-beta.20525.1

* Update dependencies from https://github.com/dotnet/xharness build 20201027.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.20519.2 -> To Version 1.0.0-prerelease.20527.1

* Update dependencies from https://github.com/dotnet/llvm-project build 20201026.1

runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk
 From Version 9.0.1-alpha.1.20523.1 -> To Version 9.0.1-alpha.1.20526.1

* Update dependencies from https://github.com/dotnet/runtime-assets build 20201026.1

System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 5.0.0-beta.20522.4 -> To Version 5.0.0-beta.20526.1

* Update dependencies from https://github.com/mono/linker build 20201027.2

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.20525.1 -> To Version 6.0.0-alpha.1.20527.2

* Update dependencies from https://github.com/dotnet/arcade build 20201026.10

Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.ApiCompat
 From Version 6.0.0-beta.20520.8 -> To Version 6.0.0-beta.20526.10

* Update dependencies from https://github.com/dotnet/runtime-assets build 20201027.1

System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 5.0.0-beta.20522.4 -> To Version 5.0.0-beta.20527.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoFix DI DisposeAsync being called twice (#43803)
Wei Zheng [Wed, 28 Oct 2020 23:31:26 +0000 (07:31 +0800)]
Fix DI DisposeAsync being called twice (#43803)

* Fix DI DisposeAsync being called twice

3 years agoEnable the portable thread pool by default in coreclr (#43841)
Koundinya Veluri [Wed, 28 Oct 2020 20:58:03 +0000 (16:58 -0400)]
Enable the portable thread pool by default in coreclr (#43841)

3 years agoReplace net6.0 TargetFramework Equality Conditions with msbuild intrinsic function...
Anirudh Agnihotry [Wed, 28 Oct 2020 18:09:40 +0000 (11:09 -0700)]
Replace  net6.0  TargetFramework Equality  Conditions with msbuild intrinsic functions (#43857)

* using msbuild intrinsic functions to get tfm identifier and tfv version

* Update src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
* Update build-native.proj

* Update build-native.proj

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoRespect reloadOnChange in UserSecrets in DefaultBuilder (#43807)
Vadim Galaktionov [Wed, 28 Oct 2020 16:22:53 +0000 (19:22 +0300)]
Respect reloadOnChange in UserSecrets in DefaultBuilder (#43807)

* Respect reloadOnChange in UserSecrets in DefaultBuilder

3 years ago[mono] Fix LoadAssemblyRaw to not pin or copy (#43830)
Ryan Lucia [Wed, 28 Oct 2020 15:44:49 +0000 (11:44 -0400)]
[mono] Fix LoadAssemblyRaw to not pin or copy (#43830)

* [mono] Fix LoadAssemblyRaw to not pin or copy

Copying of the assembly and symbols happens later, in `mono_alc_load_raw_bytes`, and the pinning is no longer necessary so long as we have the handle.

* Handle null symbol store

3 years agoAdd interpreter libraries to iOS device runtime pack (#43944)
Alexander Köplinger [Wed, 28 Oct 2020 14:10:45 +0000 (15:10 +0100)]
Add interpreter libraries to iOS device runtime pack (#43944)

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

3 years agoAdd initial set of conformance tests for Stream (#43834)
Stephen Toub [Wed, 28 Oct 2020 13:36:23 +0000 (09:36 -0400)]
Add initial set of conformance tests for Stream (#43834)

* Fix invalid assert in StreamBuffer

This can be hit by calling code and thus shouldn't be an assert.  As an assert it prevents testing.

* Add ConnectedStreams.CreateUnidirectional

* Add initial set of Stream conformance tests

These primarily focus on "connected streams", ones that can be arranged to communicate with each other in a producer/consumer pattern or as a bidirectional communication mechanism, e.g. NetworkStream, PipeStream, SslStream wrapped around a NetworkStream, FileStream created around pipes, etc.  Later we can add more tests focused on standalone streams, e.g. FileStream created for an on-disk file, MemoryStream, etc.

* Add ConnectedStreams tests

These are currently helpers used by many other tests.  At some point they could become public API as well.

* Fix NetworkStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Add stream conformance tests for NetworkStream

* Add stream conformance tests for QuicStream

* Fix several CryptoStream behaviors

1. Flushing a stream that wraps another stream for writing should always flush that underlying stream, even if no additional data was written as part of the flush.
2. Argument validation should validate buffers are not null rather than null ref'ing on a null buffer.
3. Checks for the CryptoStream mode should come after argument validation.

* Add stream conformance tests for CryptoStream

* Fix FileStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Fix BufferedStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Add stream conformance tests for FileStream

Specifically when used in a connected fashion, wrapped around an anonymous or named pipe.

* Add stream conformance tests for BufferedStream

Specifically when used in a connected fashion, wrapped around some other connected stream.

* Add stream conformance tests for SslStream and NegotiateStream

* Fix PipeStream.Flush to not fail on readable streams

Consumers may expect Stream.Flush to be a nop if the stream is readable only, but PipeStream.Flush is throwing in that case.  Stop doing that.

* Add stream conformance tests for PipeStream

* Fix several BrotliStream behaviors

1. When passed a null buffer, it's throwing an exception with the argument name "array", even though the parameter's name is "buffer".
2. Even if there's no data written as part of the Flush{Async} call on a writeable stream, it should be calling flush on the wrapped stream.

* Fix several DeflateStream (and friends) issues

1. DeflateStream.Flush{Async} when writing needs to always flush the underlying stream, even if there's no data written as part of the flush call itself.
2. Several byte[] array arguments should be byte[] buffer. Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).
3. DeflateStream.EndRead/Write needs to do additional state validation.
4. Not a bug, but simplify ReadAsync to match the sync Read implementation flow.

* Add stream conformance tests for Deflate/ZLib/GZip/BrotliStream

* Fix PipeReader/WriterStream argument validation

* Add stream conformance tests for PipeReader/WriterStream

* Remove erroneous asserts from Stream.ReadWriteTask

* Address PR feedback

* Fix a few tests in CI

3 years agoChange Task.FromResult to use same task cache as async methods (#43894)
Stephen Toub [Wed, 28 Oct 2020 10:50:00 +0000 (06:50 -0400)]
Change Task.FromResult to use same task cache as async methods (#43894)

* Change Task.FromResult to use same task cache as async methods

Task.FromResult today always creates a new task.  This leads developers that are aware of this to then create their own caches for common values, typically 0, true, and false, to avoid task allocations for those common values.  But we already have such values cached internally, used for async method return values.  We can just use the same cache for Task.FromResult.

* Address PR feedback

3 years agoDisable qcalls on wasm. Treat them as normal pinvokes. (#43798)
Zoltan Varga [Wed, 28 Oct 2020 01:11:23 +0000 (21:11 -0400)]
Disable qcalls on wasm. Treat them as normal pinvokes. (#43798)

* Disable qcalls on wasm. Treat them as normal pinvokes.

This is needed because they are stored in a separate table, so they cannot be linked out the same
way as pinvokes/icalls.

* Update tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
3 years agoThrow when reader is completed with an exception (#43776)
Brennan [Wed, 28 Oct 2020 00:09:58 +0000 (17:09 -0700)]
Throw when reader is completed with an exception (#43776)

3 years agoAdd link to Discord server to README.md (#43926)
Alexander Köplinger [Wed, 28 Oct 2020 00:00:03 +0000 (01:00 +0100)]
Add link to Discord server to README.md (#43926)

3 years agoSome refactoring of thread suspension. (#34666)
Vladimir Sadov [Tue, 27 Oct 2020 22:56:31 +0000 (15:56 -0700)]
Some refactoring of thread suspension. (#34666)

* m_dwForbidSuspendThread

* Remove some fibers stuff

* g_TrapReturningThreads

* g_pGCSuspendEvent

* m_pThreadAttemptingSuspendForGC

* refactor SuspendRuntime into just one loop

* Suspend iteration after updating hijacks should "observeOnly" - no point to update hijacks again right away.

* avoid retrying to suspend threads that are already in redirected state.

* PR feedback

* "premptive" - common typo apparently

* missing profiler notification on suspend end and `DisableStressHeap` stuff

* indentation and infinite loop style

* Removed GTF_DONT_CSE flag on `g_TrapReturningThreads` load in GCPoll and added comment explaining why.

* reverted an accidentally removed assert

* removed SWITCHOUT_HANDLE_VALUE entirely - not different from INVALID_HANDLE_VALUE now

* some cleanups and more comments when non-GC suspension yields to GC

* Few tweaks for the concerns discussed in the PR

* On Server GC `pCurThread` is NULL.
Need to fix an ASSERT to account for the possibility of NULL.

3 years ago[wasm] Add backward compatibility file to timezone data compilation (#43786)
Tammy Qiu [Tue, 27 Oct 2020 22:55:44 +0000 (18:55 -0400)]
[wasm] Add backward compatibility file to timezone data compilation (#43786)

* Add backward file from iana to handle backward compatibility in tz data
* add tests to check for backwards compatibility

3 years agoMake runtime tests run with Android (#42683)
Fan Yang [Tue, 27 Oct 2020 22:41:21 +0000 (18:41 -0400)]
Make runtime tests run with Android (#42683)

* Prototype for runtime tests running with Android

* Conditionally collect app dependencies

* Switch android sample from publish to build

* Switch Android sample from publish to build

* Modify AndroidTestRunner

* Only build and test one test

* Clean up some changes

* Update new run test script path and update AndroidTestRunner to use files under CoreRoot

* Add Helix configuration for Android_x64

* Disable test which replies on coreclr System.Private.CoreLib.dll

* Fixed format and removed irrelevant parameters

* Rmoved unused parameters and fixed comment

* Revert my AndroidAppBuilder related changes to prepare for getting Egor's AndroidAppBuilder change

* Fixed rebase and merge error

* Update AndroidTestRunner

* Use the AndroidAppBuilder in the publish folder

* Update runtime test Android App creation command

* Temporarily disable all jobs except for the Android one

* Fix up job running config

* Fixed AndroidTestRunner

* Get Main function return code after running android app

* Fix for skipping building native tests

* Fix helix project path, due to recent coreclr test related files relocation.

* Fix android app running commands

* Add missing helixType

* Update HelixRuntimeRid

* Fix inconsistency

* Create Android app during build preiod.

* Adjust the way to run tests

* Temporary hack before AndroidAppBuilder could accept multiple assemblies

* Use xharness instead of adb to run tests on Androids and disable cmake for Android.

* Cleanup unnecessary changes

* Include xharness Cli

* Use the right xharness command

* Copy runtime assemblies, since the copy logic got removed from AndroidAppBuilder

* Save Android apps in CORE_ROOT dir and adjust BuildAndroidApp target due to rebase from master

* Minor cleanup

* Enable all runtime tests and disable tests caused build failure

* Copy over test helper assemblies and add failing tests to issues.targets

* Remove redundant comment

* Revert previous commit

* Only sending apk files to helix machine

* Delete OutputDir after finishing building the app

* Copy whole Core_Root dir to helix machine.

* Extend timeout threshold

* Extend timeout threshold for each test and each test collection

* Display Android app running logs when tests fail

* Android tests are required to run in sequential

* Check if log file exists before using it.

* Exclude two out-of-memory tests

* Fixed merge error

* Shorten the timeout threshold

* Enable all the lanes

* Fix indentation

* Fixed a few issues from review feedback

* Update src/tests/run.proj

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* Only bail out from the bash script when erroring out for andriod

* Extend timeout threshold, since the run could take a long time or a short time on CI.

* Fixed merge error

* Filter out tests using more memory than allowed by helix machine

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
3 years agoFix test for 32-bit platforms (#43888)
Koundinya Veluri [Tue, 27 Oct 2020 22:26:44 +0000 (18:26 -0400)]
Fix test for 32-bit platforms (#43888)

- Fixed an assertion failure. `WorkerCounter` shouldn't be used in the native thread pool implementation when the portable thread pool is enabled (all the counts will be zero), fixed a missed case in `GetAvailableThreads`.
- The native implementation uses a smaller max default worker thread count by default on 32-bit platforms, allowing configured values to go beyond that. Fixed the portable thread pool implementation to do similar, instead of limiting the max including for configured values.

3 years agoAdd info about how named mutexes work on Unix into code from the orginal PR (#43161)
Koundinya Veluri [Tue, 27 Oct 2020 20:32:13 +0000 (16:32 -0400)]
Add info about how named mutexes work on Unix into code from the orginal PR (#43161)

* Add exception case xml comment for ExecutionContext.Restore

* Add some info about how named mutexes work on Unixes into code from the PR

3 years agoRemove a volatile access from Task.Id (#43891)
Stephen Toub [Tue, 27 Oct 2020 18:35:56 +0000 (14:35 -0400)]
Remove a volatile access from Task.Id (#43891)

3 years agoReimplement Socket.Begin/EndSend/Receive on Send/ReceiveAsync (#43886)
Stephen Toub [Tue, 27 Oct 2020 17:57:01 +0000 (13:57 -0400)]
Reimplement Socket.Begin/EndSend/Receive on Send/ReceiveAsync (#43886)

3 years agoFix covariant return type validation for canon parents (#43843)
Jan Vorlicek [Tue, 27 Oct 2020 16:06:42 +0000 (17:06 +0100)]
Fix covariant return type validation for canon parents (#43843)

The return type validation was rejecting cases when the method being
overriden had canon type in its generic arguments.
This change fixes the problem by using parent method type instantiation
for constructing the SigTypeContext in such case.
It also adds a regression test.

3 years ago[RyuJIT] Fold "(X op C1) op C2" to "X op (C1 op C2)" for commutative operators (...
Egor Bogatov [Tue, 27 Oct 2020 15:47:07 +0000 (18:47 +0300)]
[RyuJIT] Fold "(X op C1) op C2" to "X op (C1 op C2)" for commutative operators (#43567)

Fold "(X op C1) op C2" to "X op (C1 op C2)"