-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow suspending the runtime while suspension for the debugger is pending in some cases #44539
Conversation
kouvel
commented
Nov 11, 2020
•
edited
Loading
edited
- When suspending for the debugger is in progress (the debugger is waiting for some threads to reach a safe point for suspension), a thread that is not yet suspended may trigger another runtime suspension. This is currently not allowed because the order of operations conflicts with requirements to send GC events for managed data breakpoints to work correctly when suspending for a GC. Instead, the thread suspends for the debugger first, and after the runtime is resumed, continues suspending for GC.
- At the same time, if the thread that is not suspended yet is in a forbid-suspend-for-debugger region, it cannot suspend for the debugger, which conflicts with the above scenario, but is currently necessary for the issue fixed by Don't suspend for debugger while holding the slot backpatching lock #40060
- The current plan is to change managed data breakpoints implementation to pin objects instead of using GC events to track object relocation, and to deprecate the GC events APIs
- With that, the requirement in # 1 goes away, so this change conditions the check to avoid suspending the runtime during a pending suspension for the debugger based on whether GC events are enabled
- Verified that the latest deadlock seen in Intermittent hang/deadlock in .net core 5.0 RC1 while debugging #42375 manifests only when a data breakpoint is set and not otherwise
- Combined with Add ICorDebugHeapValue4 -- CreatePinnedHandle #44471 and a VS update to use that to switch to the pinning mechanism, the latest deadlock issue seen in Intermittent hang/deadlock in .net core 5.0 RC1 while debugging #42375 should disappear completely
…ding in some cases 1. When suspending for the debugger is in progress (the debugger is waiting for some threads to reach a safe point for suspension), a thread that is not yet suspended may trigger another runtime suspension. This is currently not allowed because the order of operations conflicts with requirements to send GC events for managed data breakpoints to work correctly when suspending for a GC. Instead, the thread suspends for the debugger first, and after the runtime is resumed, continues suspending for GC. 2. At the same time, if the thread that is not suspended yet is in a forbid-suspend-for-debugger region, it cannot suspend for the debugger, which conflicts with the above scenario, but is currently necessary for the issue fixed by dotnet#40060 3. The current plan is to change managed data breakpoints implementation to pin objects instead of using GC events to track object relocation, and to deprecate the GC events APIs 4. With that, the requirement in #1 goes away, so this change conditions the check to avoid suspending the runtime during a pending suspension for the debugger when GC events are not enabled - Verified that the latest deadlock seen in dotnet#42375 manifests only when a data breakpoint set and not otherwise - Combined with dotnet#44471 and a VS update to use that to switch to the pinning mechanism, the deadlock issue seen above should disappear completely
( | ||
g_pDebugInterface->ThreadsAtUnsafePlaces() || | ||
( | ||
g_pDebugInterface->AreGarbageCollectionEventsEnabledForNextSuspension() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is adding complexity to preserve data breakpoints in VS versions without our pending fix. However for these versions the deadlock would still exist.
I wonder if the right fix is to simply never allow EnableGCNotification(true)
. We could do that by returning an error when when this is set to true. (Or by removing the interface)
The benefit would be that the deadlock would be fixed completely (at the sake of broken data breakpoints on non-updated VS versions). I guess to me that feels like a better solution. I would prefer a hard failure on data breakpoints, than a intermittent deadlock.
@chuckries @gregg-miskelly opinions? ramifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdmaclea @gregg-miskelly I don't have a problem with deprecating EnableGCNotifications entirely, however there is a problem in VS: It appears we never actually check the HRESULT from EnableGCNotificationEvents(...)
. This means that for existing version of VS, a failed return won't actually fail the data bp code path, and the thread contexts will still get updated to set the hardware data bp. Without the GC events actually enabled, these data bp's would be enabled across GC's and almost certainly cause major issues.
Data BP's could be "gracefully" disabled by failing the QI for ICorDebugProcess10. This would make VS think that the target runtime simply doesn't support data bp's. It appears that EnableGCNotificationEvents(...)
is the only API available on ICorDebugProcess10, so I think this might be a valid approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deadlock introduced by #40060 in adding the forbid-suspend-for-debugger region is only applicable to .NET 5, for 3.1 a different solution was used and that deadlock is not applicable there. So after this change, that deadlock could still occur in .NET 5 (but not 3.1) when using a VS version that uses GC events.
Not sure I followed the above completely. If the target runtime supports data BPs, is there a suggestion for a change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can draft the change. See #44549
This is a simplification of dotnet#44539 as proposed by @kouvel
Closing in favor of #44549 |
…otnet#44549) * Stop providing IID_ICorDebugProcess10 Prevent older VS versions from setting managed data breakpoints. * Simplify the thread collision logic to prevent deadlock This is a simplification of dotnet#44539 as proposed by @kouvel
#44563) * Add ICorDebugHeapValue4 -- CreatePinnedHandle (#44471) * Add ICorDebugHeapValue4 * Add EnableGCNotificationEvents deprecation comment * Drop support for IID_ICorDebugProcess10 and fix thread suspend logic (#44549) * Stop providing IID_ICorDebugProcess10 Prevent older VS versions from setting managed data breakpoints. * Simplify the thread collision logic to prevent deadlock This is a simplification of #44539 as proposed by @kouvel
* Remove dead code in MarshalNative (#44506) * Update buildtriage.md (#44538) * Remove internal NuGet.config that is not needed anymore (#44507) * Convert aka.ms links to https (#44501) * Add signing information to asset manifest (port #41889 and #42688) (#43896) * Post build signing * Add PostBuildSign flag * Drop support for IID_ICorDebugProcess10 and fix thread suspend logic (#44549) * Stop providing IID_ICorDebugProcess10 Prevent older VS versions from setting managed data breakpoints. * Simplify the thread collision logic to prevent deadlock This is a simplification of https://github.com/dotnet/runtime/pull/44539 as proposed by @kouvel * Use fcntl(F_FLUSHFSYNC) on OSX and make FlushAsync() to behave like Flush(false) on Unix (#44443) * Use fcntl(F_FLUSHFSYNC) on OSX and make FlushAsync to behave like Flush on Unix * Remove HAVE_F_FULLFSYNC from mono/cmake/config.h.in * Address FlushAsyncInternal feedback * Address feedback: use fcntl only for OSX * Add Type.GetMethod overload that takes Name, BindingFlags, and Parameter Types (#44529) * Add Type.GetMethod overload that takes Name, BindingFlags, and Parameter Types Adding overloads to GetConstructor and GetMethod that don't take a Binder or parameter modifiers. Fix #42753 * Fix arm64 disasm failures (#44547) GTF_ICON_STATIC_HDL and GTF_ICON_FTN_ADDR can't be converted to names using eeGetFieldName and eeGetMethodFullName, respectively. So, just print out the type of the target. Fixes #40354 * A couple of R2RDump fixes (#44558) * Fix StartInfo test (#44392) * Stabilize StartInfo_NotepadWithContent_withArgumentList * Add state in failed SetApartmentState exception * Same for other tests * Extract common code * Modify * Extract common code * Pass down throwOnError * Apply suggestions from code review Co-authored-by: Jan Kotas <[email protected]> * feedback * Add process for disposal * Make slow test outer loop Co-authored-by: Jan Kotas <[email protected]> * Crossgen2 support for System.Private.CoreLib compilation in CoreCLR build (#44090) This change moves the logic for crossgenning System.Private.CoreLib to the crossgen-corelib.proj script, no longer calling out to the OS-specific scripts crossgen-corelib.cmd / crossgen-corelib.sh, and adds the support for using Crossgen2 for the System.Private.CoreLib compilation. As of this commit Crossgen2 is not set as the default because the System.Utf8.Experimental libraries tests fail with Crossgen2-compiled CoreLib. I'm working on fixing this as the next step. Thanks Tomas * docs: fix MSBuild property InvariantGlobalization (#44572) * Fix remote-unwind for TARGET_ARM crossdac (#44553) * Remove unused Crst entries and regenerate header. (#44556) * Remove unused Crst entries and regenerate header. * Remove unused RCW/CCW code paths (#44121) * Remove unused checks for DCOM proxies. * Remove empty API for WinRT scenarios. * Remove unused static functions from runtimecallablewrapper.cpp. * Remove unused functions in comcallablewrappers. * Remove unused or irrelevant functions in interoputil.cpp. Remove WinRT focused code path in ComInterfaceMarshaler. - ICOMInterfaceMarshalerCallback usage * [RyuJIT] Unroll single-iteration loops (#43947) * Unroll empty loops * Unroll single-iteration loops * Update optimizer.cpp * clean up * Update optimizer.cpp * Fix RCS1049: Simplify boolean comparison (#44564) * Santiago's suggestion (#44554) * Fix race condition in Hosting test (#44548) Change Task.Delay(1) to Task.Yield() to avoid a super race condition. Fix #43389 * Copy OpenSSL binaries (#44577) This PR could resolve some failures mentioned in https://github.com/dotnet/runtime/issues/44306 * Use Dictionary for underlying cache of ResourceSet (#44521) Co-authored-by: Jan Kotas <[email protected]> * Fix 5-minute hang in Process tests (#44571) * Remove LazyInitializer usage from corelib (#44409) It's fine for higher layers, but in corelib we don't want to forcibly prevent LazyInitializer from being trimmed nor pay the overheads of additional cached delegates. * Make PhysicalFilesWatcher exclusively use polling when pollForChanges=true and no FSW is provided (#41426) When a FileSystemWatcher is not passed to the PhysicalFileWatcher we'll permit construction (if polling is enabled) and have it behave as exclusively polling. The PhysicalFileProvider will use this mode when both UsePollingFileWatcher and UseActivePolling are set which is what happens when the DOTNET_USE_POLLING_FILE_WATCHER environment variable is set. * Remove dependency on System.Linq from debug build (#44531) * [Android] Use Android SDK instead of OpenSSL where possible (#43740) This PR redirects all RandomNumberGenerator, MD5, Sha1-512, HMAC and AES APIs to use Android SDK instead of OpenSSL. * Validate ref/src parameter names (#43838) Ensure our reference assembly parameter names match implementation. Align all current mismatches. * Special-case SocketsHttpHandler.MaxResponseDrainTime == 0 (#44568) If the drain size is set to 0, any attempts to drain end up failing with a 1st-chance exception that's logged and eaten, when we should just be skipping all the associated work and failing immediately. * Override Read/Write for spans on ConsoleStream (#44597) Console.WriteLine ends up calling Write(span) in some cases, which incurs unnecessary additional cost to call through to Write(byte[], ...). * OSX Add option -no_code_signature_warning (#44604) When building on Apple Silicon the stripping pass warns about breaking signing despite not having signed the binary yet. Disable the warning * Mark R2RDumpTests as incompatible with GC stress (#44586) The purpose of this test is not to stress the runtime, it's relatively lengthy as it processes the entire System.Private.CoreLib framework assembly and so it's timing in GC stress runs. Thanks Tomas * Fix zh cultures parent chain (#44607) * Reduce Process test time (#44593) Fix a test that was taking 30 seconds, and make another test outerloop. * Remove the experimental Utf8String type and tests from the runtime repo (#44574) * [Android] Split android_security.c into multiple files (#44603) * Fix trimming linker tests (#44613) * Fix race conditions in CG2 runs (#44492) While we do lock the test folder during CG2 compilation, we always run the compilation which means that it can race with execution of the already CG2-compiled executable which also locks the PE file. While I'm not super happy about introducing more state, I believe the easiest way to fix this is the same way CG1 works - compiling opportunistically upon first build of the project and skipping the compilation subsequently. Thanks Tomas * Subtle fixes for JIT build mode (#44615) Maoni expressed interest in experimenting with the R2RTest tool for the purpose of running arbitrary CoreCLR test subsets. As until now we've seldom used the tool in JIT mode, this naturally uncovered a bit of bitrot, frankly speaking less than I expected. Thanks Tomas * Switch to new Microsoft.DotNet.SharedFramework.Sdk and refactor Host/Installer build subsets (#38457) * Start creating runtime, apphost, and targeting packs using the new SDK in the NewSFX subset. * Fix generation of runtime package, runtime symbols package, and host symbols package. * Correcly include hosting files and DIA in the shared framework archives and packages * Include PackageOverrides.txt in the ref pack. * Fix product brand prefix. * Add the shared host installer. * Add the hostfxr build and clean up MacOS building. * Rename host and hostfxr projects to ensure we don't collide with the nuget packaging projects. * Add bundle installer. * Update platform manifest entries to include linux/mac file variations from the runtime. * Update apphost pack to match master. * Fix typo * Include manpages and fix linux package properties. * Fix linux package properties. * Match short-description from packages in master. * Update to uploaded package. * Update metadata and SDK to generate an exact match of the productbuild xml file. * First draft moving crossgen2 to new SDK. * Get crossgen2 pack working with updated SDK. * Build archives from the installer and bundle projects. * Move the dotnet-runtime-deps installers to use the new SDK. * Rough attempt to convert the build to use the new sfx sdk. * Remove now empty subsets. * Update installer subsets for testing. * Remove non-existent packaging project from subsets. * Add missing Windows api shim dll to platform manifest. * Update sharedfx sdk. * Add both versions of the long-name dac to the platform manifest. * Skip builds for non-relevant components on Mono. * Remove installer tests by default temporarily to validate product build. * Remove pkgprojs subset from mono installer build since it doesn't build the hosts. * Skip the apphost pack on mono. * Update host test infra to use the new sfx projects. * Delete an out of date test (the alternative case this test exercises is now the only case in this repo) * Fix packaging tests and remove NETStandard packaging tests since we aren't producing that ref pack any more. * Fixes for test official build failures. Re-eneable installer tests by default. * Fix condition for building linux installers. * Exclude Mono header files from the deps.json. They don't need to be in it. * Don't include the host files on the sfxproj. * Add mono-specific files to the platform manifest. * Remove extra copy step in installer job. * Include libmonosgen-2.0.a in platform manifest. * Fix change in linux-x64 test steps. * Fix display name of linux package steps. * Build the installers based on the portable build when applicable so they can find their artifacts. * The installer build no longer consumes Microsoft.NETCore.Platforms and Microsoft.NETCore.Targets, try removing the dependency on the AllConfigurations leg from the installer build. * Set PackageBrandNameSuffix for runtime-deps packages. * Updated sharedfx sdk * Fix debian runtime-deps dependency elements. * Add new platform manifest entries. * Add icudt.dat to the platform manifest. * Invert conditions to correctly skip generating installers on non-applicable platforms. * Create extra installer subset so we can build just the installers (and avoid double-building nuget packages). Rename the newsfx subset and folder to sfx. * Fix Crossgen2 package name. * Clean up some dead MSBuild goo and update the sharedfx package so we can override the crossgen2 package name without breaking the default package id logic. * Update SharedFX SDK. * Fix discovery of the built dotnet layout for installer tests. Clean up some MSBuild along this path. * Update to use the new refactored packages. * Fix macOS build failures. * Fix linux installer build. * Upgrade to newest version of the SDK and centrally manage versions. * Update SDK to fix build skipping for the shared framework sdk. * Update SDK with full fix for skipbuild with packaging. * Another try for fixing the build-skip infra. * Upgrade SDK. * Fix package ids for mono packages. * Fix installer tests after update. * Add System.Private.Runtime.InteropServices.Javascript.dll to platform manifest * Fix Crossgen2 package to place all files in the tools folder. * Update to SDK with validation targets. * Add new ICU files to manifest. * Crossgen2 doesn't need to go through framework resolution so we can permit non-file-versioned dlls. (jitinterface.dll is currently unversioned). Signed-off-by: Jeremy Koritzinsky <[email protected]> * Put the property in a property group. * Ensure we build corehost before sfx since we no longer directly build the project from the sfx projects. * Add missing entry for additional ICU data file. * Remove step downloading all artifacts and remove MSBuild glue to hook up looking up artifacts in the full download. Signed-off-by: Jeremy Koritzinsky <[email protected]> * Update SDK Signed-off-by: Jeremy Koritzinsky <[email protected]> * Update SDK to get MSI fix. Signed-off-by: Jeremy Koritzinsky <[email protected]> * Don't even try building the hosting, crossgen2, or bundle installers when RuntimeFlavor is Mono. * Remove out of date comment. Signed-off-by: Jeremy Koritzinsky <[email protected]> * Rename subsets based on PR discussion. * Update platform manifest and fix path to 3rd party notices for installer. * Remove test feed. * Update subset references I missed. * Fixed the subset arguments in other yaml files. * Add NuGet metadata to packs. * Add diagnostics-specific incremental signing in CoreCLR when the files are produced so the installer portion doesn't need to sign them. * Pass sign type to job. * Add new WASM files. * Enable static graph restore for the whole repo * Fix nits * Add back the runtime-deps packages. They were lost when we moved away from globs. * Don't disable NuGet static graph restore. * Make sure we sign the cross-arch same-os DAC * Update installers package. * Update Installers package from arcade * Update installers package. Co-authored-by: Viktor Hofer <[email protected]> * increase timeout on WebRequest timeout test (#44612) * update assemblyVersion, packageIndex & resources data (#44373) * updated package indes * Fix the failures in all config build * add "5.0.0.0" : "5.0.0" entry * correct the system.net.quic and system.security.access control * add inbox libraries for net6.0 * fix system.net.quic * disable closure verify for net6.0 * harvest net5.0 asset and include net6.0 asset in package * some extra changes reverted * updating some other assembly verisons * remove package version and use major and minor version to get the assembly version * Update Directory.Build.props * Don't force unused reg arg to the stack. (#44555) * Don't force unused reg arg to the stack. * Add example to test doc for generating Core_Root without building tests (#44504) * Doubly linked freelist fix (#44585) Details: In gc_heap::allocate_uoh_object. we set the background mark bit if the new object is in a range that has mark bits committed. However, if the object is in a segment that is allocated during background_sweep, we won't actually sweep the segment, and so the background mark bits stays on, causing confusion in the next background GC - the object itself will survive, but we won't keep the objects that it points at, so we'll have heap corruption. * [master] Update dependencies from mono/linker (#44557) Microsoft.NET.ILLink.Tasks From Version 6.0.0-alpha.1.20560.1 -> To Version 6.0.0-alpha.1.20561.1 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Adjust method table pointer masks (#44637) * Adjusting more places where method table pointers get masked. * Put the Crossgen2 assertion check in sync with actual intrinsic count (#44624) * Put the Crossgen2 assertion check in sync with actual intrinsic count Recent removal of two intrinsics from the CorInfoIntrinsics enumeration started tripping the assertion failure verifying the expected number of intrinsics. I'm just updating the expected count. * Remove the assertion per JanK's PR feedback * Fix race condition in TestExited_SynchronizingObject test (#44627) * Move PollingFileProviderShouldntConsumeINotifyInstances to outerloop (#44651) * Enable WASM AOT option in build and update MonoAOTCompiler (#44468) Allows creating AOT images for WASM with the AOT compiler and consuming them in the runtime. Use `make build AOT=1` in `src/mono/netcore/sample/wasm/console` to try it out. -- Also fix a regression in aot-compiler.c regarding SPC->corlib assembly name: In https://github.com/dotnet/runtime/commit/035ebeab160b9a281e5fbb3fa0c237f244c81b7a we added a simplified prefix for symbol names in System.Private.CoreLib. However this shouldn't happen for the actual assembly name otherwise we aren't able to find the AOT module linked statically into the binary. * RuntimeResourceSet improvements (#44454) * RuntimeResourceSet improvements - remove unnecessary base class calls to trim more of base type - remove code paths which were never executed - replaced nested locking with simple locks - fix caching for case insensitive mode - add tests for more code paths * Move local caseInsensitiveTable initialisation * Clean up unused code * Revert "Clean up unused code" It's actually used via reflection in System.Resources.Extensions * update version (#44478) * Don't build archives or installers for Mono builds. (#44656) * Add link to github issues (#44650) * Add feature switch for disabling startup hooks (#44050) * Introduce feature switch for startup hook * Add test * Update md * Update src/coreclr/src/System.Private.CoreLib/src/System/StartupHookProvider.cs Co-authored-by: Jan Kotas <[email protected]> * Add UnreferencedCode attribute * Apply suggestions from code review Co-authored-by: Vitek Karas <[email protected]> * Update message * Update baseline Co-authored-by: Jan Kotas <[email protected]> Co-authored-by: Vitek Karas <[email protected]> * Support multi-buffer sends in WebAssembly WebSockets (#44611) * Support multi-buffer sends in WebAssembly WebSockets Proposed fix for https://github.com/dotnet/runtime/issues/44551 * Update BrowserWebSocket.cs * Whitespace * TryGetBuffer * Check args before asking runtime to resolve fqns to avoid assert (#44635) * Add allocation-free StringInfo APIs, improve unit tests (#44609) * Remove extraneous dependency ignore. (#44672) * Fix MONO exports not actually being callable through Module (#44634) * Only sign in the official build pipeline, not in any other pipeline (#44668) * Only sign in the official build pipeline, not in any other pipeline (was breaking the perf pipeline). * Pass signBinaries directly to crossdac-build Signed-off-by: Jeremy Koritzinsky <[email protected]> * Only install MicroBuild when we are signing. Signed-off-by: Jeremy Koritzinsky <[email protected]> * Fix Android runtime tests to upload .apk per work item (#44662) Instead of uploading all .apk's as a correlation payload. * Remove allocations from IsCustomAttributeDefined (#44694) * improve parsing network files on WSL (#44680) * improve parsing network files on WSL * Apply suggestions from code review Co-authored-by: Stephen Toub <[email protected]> * Fixed various comments and minor refactor ServiceController. (#44014) * Fixed various comments in ServiceController. 1. Fixed comments, so that VS can infer and show in tooltip. 2. Removed redundant base constructor call. 3. Used auto-properties. * Addressed PR feedback * Update src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs Co-authored-by: Dan Moseley <[email protected]> * Fix `-output_mch_path` argument to superpmi.py (#44693) Convert the given path argument to an absolute path. Without this, the `collect` command changes the current directory before doing its work, so the file doesn't end up where you expeect it to. Also, print the given argument in any error message. * Organize SendReceive tests and isolate non-parallel test collection (#44591) Some `SendReceive` socket tests may be prone to timing issues on CI. This seems to be the root cause of #1712. We need a reliable way to run such tests to unblock the work on new UDP socket API-s in #33418. This PR defines a new `SendReceiveNonParallel` test group, moving `SendToRecvFrom_Datagram_UDP` into that group. Since this is already a significant reorganization, it seemed reasonable to also: - Harmonize naming: all SendReceive test classses are now named either `SendReceive_[SubVariant]` or `SendReceiveNonParallel_[SubVariant]` - Split `SendReceive.cs` into multiple files: - `SendReceive.cs` for the parallel variants - `SendReceiveNonParallel.cs` for the new, non-parallel variants - Rename the non-generic class `SendReceive` to `SendReceiveMisc` (to avoid name collision and confusion with `SendReceive<T>`) and move it to `SendReceiveMisc.cs` - Move `SendReceiveListener` and `SendReceiveUdpClient` to separate files, rename `SendReceiveListener` to `SendReceiveTcpClient` * Delete unnecessary entry in global.json (#44709) * Support System.Type.Missing arguments for late bound calls to IDynamicObject methods with 8 or more arguments (#44434) * Avoid MemoryMarshal.Cast unaligned accesses in Marvin (#44617) * Fix RCS1036: Remove redundant empty line (#44631) Sync with PowerShell/PowerShell#13404 * Make System.Guid readonly (#44629) * System.Memory.Data (#44633) * Add BinaryData Ported from https://github.com/Azure/azure-sdk-for-net/commit/995a13b14c5f635b293c117bfb657d9532b2a202 * Make System.Memory.Data build and fix tests * Simplify type default * Respond to feedback * Use common ReadOnlyMemoryStream Make common ReadOnlyMemoryStream support compiling for NETFramework and NETStandard2.0, and add ObjectDisposedException checking. * Add tests cases for null objects/types * Fix System.Text.Json reference * Simplify ReadOnlyMemoryStream.Dispose * Throw on Disposed for more cases in ReadOnlyMemoryStream Co-authored-by: JoshLove-msft <[email protected]> * Make DirectoryInfoWrapper better handle missing directories (#44671) EnumerateFileSystemInfos tries to noop when root directory does not exist but the directory might be deleted between the time it checks Exists and begins enumerating. The value for Exists might also be stale as it is cached. * arm64 osx: support byte sizes from lowering to codegen. (#43024) * arm64 osx: support byte sizes from lowering to codegen. * a better message about GT_PUTARG_SPLIT. * Fix arm * Response review. * format GenTreePutArgStk(genTreeOps. * response Egor's review. * Harmonize pointer type handling (#44465) * CoreCLR treats pointer types as UIntPtr in a couple places. * Regression test * Avoid MediaTypeHeaderValue.ToString allocation when no parameters (#44750) * Remove unnecessary closure / delegate allocation from CallSiteFactory.GetCallSite (#44755) Nothing is ever removed from the cache, and CreateCallSite is already storing the newly created ServiceCallSite into the dictionary, so GetOrAdd isn't providing any meaningful value: we can simply TryGetValue and then call CreateCallSite if it fails. * Drop ReadOnlyCollection dependency from TaskExceptionHolder (#44757) it's used only to copy data aroud locally * Special-case zero parameters in GetParameters (#44759) * Replace Tuples with ValueTuples (#44712) Some help to remove allocation, some just help to avoid pulling in Tuple and likely increasing build size. * Update src/libraries/Common/src/System/Security/Cryptography/Pkcs12Kdf.cs Co-authored-by: Jeremy Barton <[email protected]> * Remove ALT_JIT define and replace with runtime logic (#44565) * Remove ALT_JIT define and replace with runtime logic * Fix SuperPMI for new altjit jit flag Co-authored-by: Bruce Forstall <[email protected]> * Remove use of Tuple<> from corelib (#44706) * Adjust Mono EventPipe/DiagnosticServer C library to better support CoreCLR shim. (#44527) * Adjust EventPipe/DiagnosticServer C library to support CoreCLR shim. Adjustments done to better align with implementation of CoreCLR shim using CoreCLR artifacts and C++ code (CoreCLR implementation done in separate PR). Disconnect runtime specific shim info from shared sources, all included shim files handled through defines. Exception safety and improved error handling, adding error checking and error returns into shim container functions. Walkthrough of codebase, aligning with gaps from CoreCLR + port of sample profiler and json file serializer. Implement core dump diagnostic command and runtime layer (needed by CoreCLR, currently not implemented on Mono). Implemented process env diagnostic command and runtime layer. Implemented profiler attach diagnostic command and runtime layer (needed by CoreCLR, currently not implemented on Mono). Fix native EventPipe test aligning with changes. * Fix build errors. * Review feedback. * Avoid string/StringBuilder/char[] allocation in LogValuesFormatter's ctor (#44746) This is producing thousands of allocations at ASP.NET startup, due to almost 1000 call sites to LoggerMessage.Define. * Don't use interfaces for sharing Tuple implementation methods (#44684) * Added condition of empty for concurrent dictionary (#44581) * Added condition of empty for concurrent dictionary Collection is already empty why to initialize it again with new emtpy tables. * Made AreAllBucketsEmpty method private from local function. Addressed PR feedback. * Addressed PR feedback. Comment corrected. Co-authored-by: Stephen Toub <[email protected]> Co-authored-by: Stephen Toub <[email protected]> * Make ImmutableArray readonly (#44640) * Add reference to Unsafe. * Mark ImmutableArray as readonly struct. * Update ImmutableInterlocked to use Unsafe.As. * Also include S.R.CS.Unsafe for netstandard1.0. * Add explicit '=default' to avoid CS0649. * Use Unsafe.AsRef instead of Unsafe.As. * Fix full-aot support for unmanaged function pointers. (#44783) Fixes https://github.com/dotnet/runtime/issues/44779. * Enables the interpreter on Android (#44649) To enable on tests, you can pass MonoForceInterpreter=true as an extra MSBuild property. AndroidAppBuilder now has an ForceInterpreter property which will flow the setting down to the device / simluator. * Avoid unnecessary LINQ and string joins in JsonConfigurationFileParser (#44734) * Add workflow to update solution files with SlnGen and update them initially (#44703) * Add slngen infra * Update all solution files * Use new CoreDisTools package (#44490) R2RDump and GCStress use a version of coredistools produced from https://github.com/dotnet/jitutils * Optimize HelloWorld usage (#44711) * Fix the culture parent chain for zh-Han[s|t]-* (#44737) * Signing cleanup (#44658) Co-authored-by: Viktor Hofer <[email protected]> * Add the emscripten version to the wasm runtime pack and check it at app build time when relinking the wasm runtime. (#44715) * Add the emscripten version to the wasm runtime pack and check it at app build time when relinking the wasm runtime. * Update src/mono/wasm/Makefile Co-authored-by: Alexander Köplinger <[email protected]> Co-authored-by: Alexander Köplinger <[email protected]> * Handle unicode and e-notation differences between S.T.J and J.N tests (#35042) * Handle unicode and e-notation differences between S.T.J and J.N tests Fixes #32350 * Remove TODO * Bumping CI * Bump CI * Handle relaxed escaping and precision properly * Move else if * Move else if back * Remove relaxedEscaping param and skip whitespace * Apply Jozkee final touches * Add missing period Co-authored-by: David Cantu <[email protected]> * [Android] Add ability to set env vars via command line (#44644) * Remove HashProviderDispenser.Android.cs (#44814) * Update archives package to fix zip/tar naming. (#44827) * Remove some overhead from Process.Start (#44691) - Avoid StringBuilder marshaling - Let CreateProcess{WithLogonW} determine the current working directory - Avoid creating SafeHandles for GetCurrentProcess() - Avoid forcing ProcessStartInfo.ArgumentList into existence just to check if it contains anything - Prefer using ProcessStartInfo.Arguments in Start(string, IEnumerable<string>) if there's only one string in the enumerable - Use ValueStringBuilder instead of StringBuilder to build up arguments, so as to use stack space / pooled char[]s and avoid actually needing to produce strings. - Avoid unnecessary SafeHandle for PROCESS_INFORMATION.hThread * Return pooled arrays in Regex.Replace when no replacements (#44833) When Regex.Replace doesn't actually need to replace anything, we're inadvertently not returning a previously rented ArrayPool array to the pool. On repeated use, that drains the pool of the desired size, such that every attempt ends up allocating a new array, even if there are no replacements to be made. The fix is to lazily rent from the pool. This not only fixes the problem, but helps perf further by not taking the rental cost unless we actually need an array to store a replacement segment. * Fix non-thread-safe EntityTagHeaderValue.Any (#44802) * Fix non-thread-safe EntityTagHeaderValue.Any It was being published before fully populated. * Address PR feedback * Update EntityTagHeaderValue.cs * Restore Snapcraft files. (#44812) * Fix building host lineup packages. (#44839) * Fix building host lineup packages. Signed-off-by: Jeremy Koritzinsky <[email protected]> * Update src/installer/pkg/projects/host-packages.proj Co-authored-by: Viktor Hofer <[email protected]> Co-authored-by: Viktor Hofer <[email protected]> * [wasm] Use the functions in emscripten/stack.h to compute stack bounds. (#44819) Co-authored-by: vargaz <[email protected]> * Trigger SuperPMI collection pipeline if JIT-EE GUID changes (#44846) Changing the JIT-EE GUID invalidates previous SuperPMI collections, necessitating a re-collection. As a proxy for determining whether the JIT-EE GUID has changed, just trigger anytime the corinfo.h file changes. * Update nullability on some LINQ expression methods (#44844) - MethodCallExpression can take nullable instance when static method - LambdaExpression.Update does not return null in any case Resolves #44821 Resolves #44822 * Make $(TargetOS) lowercase windows in eng/coredistools.target (#44845) * Make $(TargetOS) lowercase windows in eng/coredistools.target * Make $(TargetOS) lowercase windows in src/tests/Common/Directory.Build.targets * Fix NRE when default value is null and ServiceCallSite is not found (#44675) * Fix NRE when default value is null and ServiceCallSite is not found * Enable nullable annotations for M.E.L.Abstractions (#43892) * Enable nullable annotations for M.E.L.Abstractions * Corrections from review * LoggerExtensions.cs: params object?[] -> params object?[] * using Nullable Annotations, to allow annotations on relevant projects, not yet enabled * formatter not null * Fix decoding GC information in R2RDump (#44682) * [master] Update dependencies from dotnet/arcade (#44835) * Update dependencies from https://github.com/dotnet/arcade build 20201113.2 Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , 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.20552.5 -> To Version 6.0.0-beta.20563.2 * Update global.json Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Viktor Hofer <[email protected]> Co-authored-by: Juan Hoyos <[email protected]> * few minor MemoryCache perf improvements (#44797) * make ValidateCacheKey and CheckDisposed inlinable by moving throws to separate methods * ensure that the check for expiration does not require a method call for the most common case * update the last expiration scan when the Scan Task starts actual work * Apply suggestions from code review Co-authored-by: Stephen Toub <[email protected]> * Integrate misc fixes from dotnet/runtimelab:NativeAOT (#44851) * Use read-only auto-implemented property (#44677) * Use read-only auto-implemented property in src\libraries\Common Use read-only auto-implemented property (RCS1170) https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1170.md * Revert changes except to ComEventsMethod * Remove unnecessary suppression (#44811) * [browser][wasm] Cleanup debug statement (#44870) * Fix a comment in the bundle marker (#44874) * Remove most LINQ usage from Microsoft.Extensions.Configuration (#44825) Resulting in several hundred Func, IEnumerable, set, and string allocations at startup. * GetUninitializedObject fixes & improved tests (#44843) * Improve unit test coverage for GetUninitializedObject * Normalize most checks between coreclr and mono * Avoid string.Concat(params string[]) in SimpleConsoleFormatter.CreateDefaultLogMessage (#44765) It's resulting in a string[] allocation and a string allocation, when we can instead just make a few more individual calls to Write and stackalloc the integer. * Restore the Microsoft.NETCore.DotNetAppHost package since the SDK transitively uses it through the Microsoft.NETCore.DotNetHostResolver package. (#44883) * Remove closure allocations from ServiceCollectionDescriptorExtensions (#44696) * Avoid string.Split in LoggerRuleSelector.IsBetter (#44753) * Change SuperPMI collection to not use altjit mechanism (#44834) * Change SuperPMI collection to not use altjit mechanism The SuperPMI collection process interposes a "shim" JIT between the JIT and EE. As it is inconvenient to physically replace the existing JIT, currently this is done by enabling altjit compilation and setting `COMPlus_AltJitName` to the name of the shim JIT. This creates other inconvenience, especially with the new way of saving the altjit flag in the JIT flags, by requiring us to force the altjit flags bit to not be set, and force unset all the altjit flags. It also makes it inconvenient to collect and/or replay with an actual altjit. Change this collection mechanism to use the newly restored `COMPlus_JitName` variable to allow specifying the JIT, and use that to specify the SuperPMI shim. In addition, do not record in the MC file the `COMPlus_EnableExtraSuperPmiQueries` variable. This is only used during collections to attempt to make replays more flexible, but we never want to tell the JIT during replay that this is set. * Enable `COMPlus_JitName` for crossgen as well * Fix issue with empty collection args * Fix ComponentDocumentDesigner references in DesignerAttribute to include right base type (#44774) * Fix IComponent Designer attribute that was missing base designer type * Fix IRootDesigner references to use assembly qualified name * Fix build failures * Fix nullable annotations on HttpClient.Post/Put/PatchAsync (#44880) Null content is allowed. * Remove some allocations from ManifestBuilder.CreateManifestString (#44532) For the RuntimeEventSource, this removes around 30K of allocation, though that's only ~3% of what gets allocated. * Delete now unused target in crossgen2.csproj. (#44888) Signed-off-by: Jeremy Koritzinsky <[email protected]> * Remove unnecessary GetTypeInfo from Microsoft.Extensions. (#44891) I also made a slight optimization to CallSiteFactory to use ToArray instead of ToList. * Add test for Timer.Elapsed DateTime (#44881) * Fix discuss #44785:optimize constructor of ElapsedEventArgs (#44853) * optimize constructor of ElapsedEventArgs * delete the old ctor * Improve dumping GC info in R2RDump (#44857) The --raw command-line option used to dump bytes prefixed with their RVAs for all structures except GC blobs, which were dumped with file offsets instead. This change fixes that inconsistency. It also fixes the size reported by x86.GcInfo, which determines how many bytes to dump. In addition I simplified ReadyToRunMethod's code to store just the GC blob's RVA and avoid the delegate allocation. * Fix illumos managed build (#44386) * Fix illumos managed build * Fix CA1823 (unused private field) in `NetworkChange` partial for `UnknownUnix`. * Use official casing `illumos` in MSBuild property names (as done for iOS). * Fix Solaris version in test with SDK's PlatformDetection. * only major version is needed. * Implement Enviornment.WorkingSet for SunOS Difference between Linux and SunOS procfs is that files in latter contain binary data, so we need `read(2)` and cast into corresponding struct. Redeclaring system structs in managed code is not ideal, as they do change across the major versions of OS, which inevitably requires recompilation of binaries and replicating them in C# as is means additional/unnecessary maintenance of code. * Address CR feedback * Make minor change to corinfo.h to test SuperPMI AzDO job trigger (#44893) * Change gtGetThisArg not to return nullptr. (#44398) * Don't wrap string literal const as nop for CoreRT. It was probably an old workaround for another Jit bug, it is most likely fixed by now. * Change `gtGetThisArg` not to return `nullptr`. There was only 1 case where a null return was tolerated - for a tail call in `optAssertionGen` marked as virtual. However, a transformed tail call is never a virtual, fix `fgMorphTailCallViaJitHelper` to unset virtual flag. * Keep x86 tail call via jit helper as a virtual stub call. * Verify that OCSP and CRL checks fall back. Test that a CRL timeout chain build will use OCSP, and that an OCSP timeout chain build will use CRL. * For x86/x64, call a stack probe helper for all frame sizes equal or over one page (#44664) * Fix ListSeparator with ICU (#44732) * Sync SPC File.cs implementation with full the implementation in SIF (#44902) * Ensure Debugging assets are signed. (#44915) * Fix regression in XDocumentType (#44868) * Use simple array for AggregateException inner exceptions storage (#44787) * Use simple array for AggregateException inner exceptions storage * Replace cases which called into InnerExceptions inside SPC * Update src/libraries/System.Private.CoreLib/src/System/AggregateException.cs Co-authored-by: Stephen Toub <[email protected]> * Fix typo Co-authored-by: Stephen Toub <[email protected]> * Fix s390x unwinding and remove need for backchain pointer (#44927) Fix unwinding for s390x. Removes the `-mbackchain` flag that had been used in the past when unwinding stack frames but has not been required for sometime. This should also improve performance. Co-authored-by: nealef <[email protected]> * Add AOT support for the EntryPoint property for UnmanagedCallersOnly. (#44809) * Change mono_reflection_create_custom_attr_data_args_noalloc () so it returns the beginning of the metadata string so its length can be computed. * Add AOT support for the EntryPoint property for UnmanagedCallersOnly. Fixes https://github.com/dotnet/runtime/issues/44803. * Update src/mono/mono/mini/driver.c Co-authored-by: Aleksey Kliger (λgeek) <[email protected]> Co-authored-by: Aleksey Kliger (λgeek) <[email protected]> * Move EventPipe C library into shared location. (#44791) * Move C EventPipe library into shared location. * Fix CMake build and add CMake eventpipe test runner build. * Increment breaking change no for doubly linked freelists (#44800) Update breaking change number because doubly linked free lists use one additional bit in the method table pointer at the beginning of objects now. Added a comment noting that gcDacVars->major_version_number that is set in gc.cpp is not actually checked by SOS, so SOS_BREAKING_CHANGE_VERSION should be updated if GC changes in a way that is incompatible with the existing SOS. * [mono] Unconditionally check llvm::Expected<T> for success (#44908) `assert()` will expand to a no-op if NDEBUG is defined, which can cause an assertion-enabled LLVM to trap if an `llvm::Expected<T>` is destroyed before having had `operator bool` applied to it. * [mono] Re-enable /JIT/HardwareIntrinsics/General/NotSupported_{r,ro}/ (#44930) * Delete coreconsole test hosts (#44933) Superceded by the shipping single-file hosts Contributes to #44848 * Speed up Crossgen2 by 10% (#44917) Server GC looks to improve Crossgen2 compile times by up to 15% so use it by default. * Fix issue 44646 - ILAsm incorrectly handles method .custom attribute when we have generic type constraint (#44850) * Fix issue 44646 - ILAsm incorrectly handles method .custom attribute when we have generic type constraint The IL Assembler incorrectly dropped a .custom attribute for the method This only occurred when the inline syntax for generic type parameters was used in the method definition. This behavior can also occur for a generic class definition. * Fix typo in comment * Fix SoD input path (#44954) * Consolidate RID and native file naming in MSBuild scripts (#43804) * Consolidate RID and native file naming in MSBuild scripts * Use short variable names for native files naming convention, that are used by `framework.sharedfx.targets` in arcade, and cleanup redefinitions from crossgen2 and installer. e.g. `ExeSuffix` instead of `ApplicationFileExtension`, `LibSuffix` instead of `LibraryFileExtension` and so on. * Calculate `TargetArchitecture`, `NonPortableRuntimeOS` (for `PortableBuild`) and `PackageRID` values once for the entire livebuild, inside `eng/Configurations.props`. This implementation is a union of three varied implementations that are being deleted. * Import `names.props` once in `eng/Configurations.props` based on calculated `PackageRID` and cleanup imports of this file from various places. * Combine OS targets definition in MSBuild scripts. * Delete legacy tooling properties * Delete legacy tooling properties * Delete NetEventSource.IsEnabled (#44901) * Delete NetEventSource.IsEnabled These were all meant to be changed to NetEventSource.Log.IsEnabled(), and there are almost 900 occurrences of that pattern. But there are still 9 stragglers, and the method itself. Deleting the method and fixing the call sites. * Fix uses in NetEventSource itself * Fix NRE on EmitCalli (#44452) * Remove temporary SuperPMI scripting code (#44962) Now that we have new SPMI collections, after https://github.com/dotnet/runtime/pull/44834, remove temporary scripting code. * Mark stress log critical section as compatible with shutdown (#44937) Fixes: https://github.com/dotnet/runtime/issues/43571 * Use multibyte character path for bundle_probe (#44466) * Custom attribute properties were not always applied correctly (#44813) * Run class cctor in RuntimeHelpers.GetUninitializedObject(type). (#44898) * Run class cctor in RuntimeHelpers.GetUninitializedObject(type). Fixes https://github.com/dotnet/runtime/issues/44852. * Reenable test. * Don't run the cctor for beforefieldinit classes. * Fix post build signing props and enable post build signing. (#44951) * Move xunit test harness to its own directory under core_root (#44921) Running `xunit.console` from within the CoreRoot directory is problematic. It is executed by the shared runtime but has a full copy of the runtime and framework libraries next to it from which assemblies are getting loaded despite being for a pre-release test runtime. Place the xunit assemblies under `<core_root>/xunit` and update the places that invoke it in local and Helix test runs. The loaded tests do reference the xunit assemblies so they need to also be available in core_root for when the tests run (with the exception of the harness specific assemblies like xunit.console). * Use simple convert method for internal bool to ulong enum conversion (#44942) * Enables the interpreter on iOS (#44911) To enable on tests, you can pass MonoForceInterpreter=true as an extra MSBuild property. AppleAppBuilder will also have a ForceInterpreter property on it in order to flow down to device / simulator. * Fix syntax error in Signing.props (#44971) * Fix handling of \G in Regex.Split/Replace (#44975) In our optimized Regex.Split loop, we failed to update runtextstart, which means the \G anchor (aka starting where the previous match ended). * Build osx-x64 Crossgen2 package (#44984) * Removed unwanted ManualResetEvent from ServiceController (#44716) * Removed unwanted ManualResetEvent from ServiceController Fixes https://github.com/dotnet/runtime/issues/44699 * Addressed PR feedback. Added delay of 250 ms. * Fix pal cgroup v2 implementation (#44990) * Fix pal cgroup v2 implementation Fixes two issues in src/pal/src/misc/cgroup.cpp: * No subsystem match must be performed for cgroup v2. * Incorrect arguments for sscanf_s when reading cgroup path. The src/gc/unix/cgroup.cpp implementation doesn't have these issues. * Rename is_subsystem_match to isSubsystemMatch * Preserve symbols in dbgshim (#44970) * Preserve symbols in the dbgshim * Remove unused library group option. * Increase Hosting test delay to fix flaky BackgroundServiceAsyncExceptionGetsLogged test. (#44953) * Increase Hosting test delay to fix flaky BackgroundServiceAsyncExceptionGetsLogged test. Fix #43389 * Use a Task to control the delay on the background service. * Fix parsed RID condition for VS (#44998) * Use substitute SHA-1 implementation in wasm (#44982) * Use different managed SHA-1 implementation * Add missing call to Start * Use TryParseUInt32HexNumberStyle directly from Guid.TryParse (#44918) Skips public entry points of uint.TryParse, including argument validation, branches for style, but most impactfully fetching the current number culture when it won't actually be needed. * Disable on Server Core a couple tests that use notepad (#44972) * Fix CFB8 with Zero padding * Fix add user secrets (#44838) * [mono] Define ENABLE_MONOTOUCH and MONOTOUCH when building iOS/tvOS AOT cross compilers (#45005) * Updated mono testing doc (#44360) * Update testing.md * Create testing-mono.md * Update mono testing doc * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * PR feedback * Fix format * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * PR feedback * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Update docs/workflow/testing/mono/testing.md Co-authored-by: Ryan Lucia <[email protected]> * Replace bullet points with sub-headers * Update sub-headers to remove the duplicated part Co-authored-by: Ryan Lucia <[email protected]> * Add Linux ARM64 runs (#44887) * Add chmod for the SoD tool (#45014) * Add chmod for the SoD tool * crossgen.out input path * Add missing XML docs to System.Security.* (#44461) * Add missing XML docs to System.Security.* * add missing < * Apply suggestions from code review Co-authored-by: Carlos Sanchez <[email protected]> * Update src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs Co-authored-by: Carlos Sanchez <[email protected]> * apply feedback * fix merge conflict (renamed parameters) * Apply suggestions from code review Co-authored-by: Jeremy Barton <[email protected]> * Update src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs Co-authored-by: Carlos Sanchez <[email protected]> Co-authored-by: Jeremy Barton <[email protected]> * Register allocation cleanup (#44977) * Register allocation cleanup - Comment updates - Misc code cleanup * jit format * Fix buffer comparison in stream conformance tests (#45012) * avoid using Assert.Equals for buffer comparison in stream conformance tests because it's super, super slow * Apply suggestions from code review update span comparisons Co-authored-by: Stephen Toub <[email protected]> Co-authored-by: Geoffrey Kizer <[email protected]> Co-authored-by: Stephen Toub <[email protected]> * Remove Convert.ToByte usage from Enum (#45004) * Remove LINQ usage from EnvironmentVariablesConfigurationProvider (#44923) * Remove more LINQ usage from various dotnet/runtime libraries (#44964) * Remove unnecessary OrderBy / copy from MemoryCache.Compact * Replace First() in ILEmitResolverBuilder with [0] * Remove stale "using System.Linq;" from System.Text.Json * Remove stale "using System.Linq;" from System.Security.Cryptography.X509Certificates * Remove some LINQ usage from System.Security.Cryptography.Pkcs * Remove System.Linq reference from System.Private.Xml * Remove System.Linq reference from System.Net.WebHeaderCollection * Remove stale "using System.Linq;" from CookieContainer * Remove stale "using System.Linq;" from AltSvcHeaderParser * Remove Enumerable.Contains on a string from System.IO.Packaging * Remove System.Linq dependency from System.Diagnostics.Process * Remove LINQ usage from Microsoft.Extensions.Options * Remove LINQ usage from Microsoft.Extensions.Logging * Remove LINQ usage from Microsoft.Extensions.Logging.Console * Remove LINQ from CollectionExtensions.GetAssets/RuntimeFiles * Update src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampToken.cs Co-authored-by: Jeremy Barton <[email protected]> Co-authored-by: Jeremy Barton <[email protected]> * Add GetCiphertextLength for CBC, CFB, and ECB. * Hide DispatchTailCalls helper in stacktraces (#45019) Fixes #45011 * [browser][tests] Standup System.Net.WebSockets.Client.Tests in CI (#44781) * [browser][tests] Standup System.Net.WebSockets.Client.Tests in CI * Just a small test to see if tests are actually kicked off and failing. * Remove comment from ActiveIssue to pass tests * Address review comments - mark the loopback issues as activeIssue - [ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Browser)] * Address review comments * Correct confusion I caused * Remove extra extra exclusion that snuck in * Make browser specific failure browser specific Co-authored-by: Larry Ewing <[email protected]> * Use OutputRid for host packs (#45041) * Correct nullability annotation for IDataRecord (#44938) Fixes #44886 * Implement getMethodModule (#45046) R2R testing was failing by hitting an assert about unimplemented getMethodModule, called as part of R2R-only devirtualization handling in the JIT. I didn't determine why this regressed now. Fixes #45016 * Handle non-ASCII strings in GetNonRandomizedHashCodeOrdinalIgnoreCase (#44688) * Fix GetNonRandomizedHashCodeOrdinalIgnoreCase * Add a test Co-authored-by: Levi Broderick <[email protected]> * Use HexConverter directly when producing hex representation of enum value (#44945) instead of hopping over layers of ToString indirections which end up calling HexConvertor anyway. * Drop Convert static constructor dependency from RuntimeType (#45054) * Drop Convert static constructor dependency from RuntimeTypeto make it trimmable Co-authored-by: Jan Kotas <[email protected]> * Fix Typos (#45024) * Delete unused WinRT related strings (#45067) Fix a few typos * Improve throughput of Environment.GetEnvironmentVariables() (#45057) Use IndexOf to search for positions rather than open-coded loops, taking advantage of vectorization to improve throughput. * Create cancellation token registration wrapper only when it's needed (#45075) Co-authored-by: Stephen Toub <[email protected]> * disable ReadWrite_Success_Large test for CryptoStream because it takes too long to run (#45081) Co-authored-by: Geoffrey Kizer <[email protected]> * Skip Invariant initialization test for CultureData.Invariant (#45064) * Skip Invariant initalization test for CultureData.Invariant * Feedback * [Android] Introduce AndroidApkFileReplacerTask task (#44993) * Add support for stack walks on wasm for the reflection methods which need them. (#45076) Fixes https://github.com/dotnet/runtime/issues/44269. * Use `argIsInvariant` instead of `argNode->OperIsConst()` for inlining observations. (#44790) * Use `argIsInvariant` instead of `argNode->OperIsConst()`. * add a small repro test for the current issue. * Use Type.EmptyTypes consistently (#45112) We currently have several hundred uses of `Array.Empty<Type>()` and several hundred uses of `Type.EmptyTypes`. This just changes the repo to use the latter consistently. * Update ILVerify readme (#45123) ILVerify is published on nuget now. It is not required to use the nightly feed anymore. * Remove most uses of RuntimeTypeHandle.Allocate (#45085) - Refactoring paves way for related work in https://github.com/dotnet/runtime/pull/32520 - Fixes some possible GC holes in the reflection stack * Fix native build on arm and arm64. (#45131) * Fix native build on arm and arm64. * Fix a typo. * Fix CoreRT frozen strings handling. (#45095) * Fix CoreRT frozen strings handling. * Review response. * Delete noway_assert. * Additional checks. * Fix failures. * Update nullability.md * Reduce RuntimeType.MakeGenericType overheads (#45137) - Avoid an extra GetGenericArguments() call for all arities. - Special-case a Type[] with just one type. In looking at all calls to MakeGenericType when starting up a basic ASP.NET MVC app, 70% were for a single generic argument (the rest were for two). * Handle inconsistent \0 in Pkcs9Document{Name|Description} * add support for less standard serial port speeds on macOS (#44052) * add support for less standard serial port speeds on macOS * s/ifdef/if * Delay initialization of Task related properties which are rarely used (#45127) * Delay initialization of Task related properties which are rarely used to reduce the dependencies chain * Apply PR review suggestions * fix up previous commit * Update src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs Co-authored-by: Stephen Toub <[email protected]> Co-authored-by: Stephen Toub <[email protected]> * Fix Full Width Chars Casing (#45079) * JIT: change basic block weight to float (#45052) Change the core data type for basic block weights from unsigned to float, to simplify overall calculations and allow for a wider dynamic range. Many changes are straightforward, but a few are worth noting: * LSRA needs a true max weight, so had to introduce infinity * I removed some of the overflow checking as floats naturally saturate. * The simple geometric loop weight scaling (*8 per loop nest level) leads to some very large counts in some tests (15 level loop nests). We may want to rethink this and scale less aggressively in deep nests. * Morph's use of the weighted ref counts for RCS_EARLY is nonstandard and the values are not actually weights, so I just added a cast back to unsigned. * Several places in the jit seem to try and compare or combine unweighted and weighted counts; I don't think this makes sense. But have left as is. * Lower, LIR, and Decompose were passing around weights but never using them. * I had to introduce a special new weight for the inline projection we do for the prejit root. These changes lead to small numbers of diffs, mostly places where small rounding changes have altered heuristics; notably: * cse weights * LSRA's initial take on whether a parameter should be enregistered Overall diff impact is a wash. There are almost no diffs without PGO/IBC data. Diffs are slightly more prominent in the Roslyn assemblies prejitted with some IBC. I've tried to keep the format of weights the same in dumps (in most places) and see minimal diffs in dumps too. * Reduce SafeHandle allocation in CertEnumCertificatesInStore (#45166) And avoiding leaving the last invalid one for finalization. * Fix work item exit code for helix tests (#45164) * Fix work item exit code for helix tests The helix work items are only supposed to return non-zero if they fail to report tests for some reason. * Fix if * Keep precise argument sizes between import and morph. (#43130) Create `GT_PUTARG_TYPE` when signature type does not match node type. Check in morph that this information has survived inlining and other phases between. * Remove ForceAsync from CryptoStream (#45150) * Remove redundant ExecutionContext private ctor parameter (#45173) * Fix Activity Start Time Precision (#45175) * Skip some PKCS9 tests on NetFx (#45199) * Fix Socket telemetry outerloop test failures (#45170) Based purely on code inspection, since I couldn't repro the failures happening in the lab, I believe what's happening is we're not outputting the right events if the connect ends up completing so fast that it's treated as a synchronous completion. The fix is to move the relevant tracing to be done when the work completes, regardless of the completion mode. I was able to simulate at least one set of failures by delaying the calling thread before it reaches a particular point, and this fixes that issue, so even if it's not fixing all known problems (hopefully it is), it's at least fixing some. * Implement TCP Keep-Alive for WinHttpHandler (#44889) Implements the final version of the API proposal in #44025 except the [SupportedOSPlatform("windows10.0.2004")] bits * Fix spelling of OverideEventProvider (#45113) * Fix spelling of OverideEventProvider * Fix a few more "overrides" in comments * [master] Update dependencies from dotnet/icu dotnet/llvm-project dotnet/arcade dotnet/runtime-assets dotnet/xharness (#44459) [master] Update dependencies from dotnet/icu dotnet/llvm-project dotnet/arcade dotnet/runtime-assets dotnet/xharness - Merge branch 'master' into darc-master-f04f89fe-a712-45ce-96bf-a8d278fcda72 - Revert changes to dotnet sdk in global.json See https://github.com/dotnet/runtime/pull/45108#pullrequestreview-536374298 * [wasm] change filtering system timezones from zone.tab as a task parameter (#45138) * change filtering system timezones from zone.tab as a task parameter Co-authored-by: Ankit Jain <[email protected]> * Remove unused Enum::InternalFlagsFormat parameter (#45196) * Mono: switch to CMake build on Windows (#44976) This unifies the build with the other platforms. Hooks up the versioning targets so the mono libraries get the correct version. * Fix ninja package name (#45217) * Disabled test, fixed some typos as well. (#45212) * Initial version of class profiling for PGO (#45133) * Initial version of class profiling for PGO Add support to the jit and runtime so that PGO can determine the distribution of classes at virtual and indirect call sites. Use this information when jitting to enable guarded devirtualization, if there is a suitably likely class to guess for. Enable by setting: ``` COMPlus_TieredCompilation=1 COMPlus_TieredPGO=1 COMPlus_JitClassProfiling=1 COMPlus_JitEnableGuardedDevirtualization=1 ``` impact can be enhanced by also setting ``` COMPlus_TC_QuickJitForLoops=1 ``` to allow more methods to pass through Tier0. * Handle unsupported browser warnings (#43363) * Handle browser warnings * Apply feedback, revert updates handled with different PRs * Add misssing diagnotic id * Address multitargeted warnings * Apply feedback * Small type/comment updates * Apply more feedback * Use project settings instead adding Directory.Build.props * Annotate APIs injecting unsupported type through DI * Fix window support related warnings found with generic type parameter * Fix another browser warning found with generic type parameter bug fix * All public APIs of ConsoleLoggerExtensions are unsupported, so marking entire type as unsupported on browser * Try handle mono warnings * Revert mono related changes, it was mistake * Try handle browser warninga in mono * Apply feedback and fix new warnings caused from corelib changes * Review update * Apply feedback * Move platform specific section from HttpTelemetry * Revering unwanted changes * Remove redundant attributes * Exclude cross platform build with browser target * small updates * Annotate entire type DiagnosticCounter unsupported * Apply feedback, improve suppression comments * Remove Unsupported browser from TypeDescriptor.CreateInstance, TypeDescriptionProvider.CreateInstance and related updates * Disabled Http2_PingKeepAlive (#45214) Co-authored-by: Elinor Fung <[email protected]> Co-authored-by: Jan Jahoda <[email protected]> Co-authored-by: Santiago Fernandez Madero <[email protected]> Co-authored-by: Levi Broderick <[email protected]> Co-authored-by: Matt Mitchell <[email protected]> Co-authored-by: Steve MacLean <[email protected]> Co-authored-by: David Cantú <[email protected]> Co-authored-by: Eric Erhardt <[email protected]> Co-authored-by: Bruce Forstall <[email protected]> Co-authored-by: Andrew Au <[email protected]> Co-authored-by: Dan Moseley <[email protected]> Co-authored-by: Jan Kotas <[email protected]> Co-authored-by: Tomáš Rylek <[email protected]> Co-authored-by: 谭九鼎 <[email protected]> Co-authored-by: Aaron Robinson <[email protected]> Co-authored-by: Egor Bogatov <[email protected]> Co-authored-by: xtqqczze <[email protected]> Co-authored-by: Sergey Andreenko <[email protected]> Co-authored-by: Fan Yang <[email protected]> Co-authored-by: Marek Safar <[email protected]> Co-authored-by: Stephen Toub <[email protected]> Co-authored-by: Eric StJohn <[email protected]> Co-authored-by: Steve Harter <[email protected]> Co-authored-by: Tarek Mahmoud Sayed <[email protected]> Co-authored-by: Jeremy Koritzinsky <[email protected]> Co-authored-by: Viktor Hofer <[email protected]> Co-authored-by: Tomas Weinfurt <[email protected]> Co-authored-by: Anirudh Agnihotry <[email protected]> Co-authored-by: Carol Eidt <[email protected]> Co-authored-by: Peter Sollich <[email protected]> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Alexander Köplinger <[email protected]> Co-authored-by: Mateo Torres-Ruiz <[email protected]> Co-authored-by: Vitek Karas <[email protected]> Co-authored-by: Brennan <[email protected]> Co-authored-by: Katelyn Gadd <[email protected]> Co-authored-by: Ben Adams <[email protected]> Co-authored-by: Shreyas Jejurkar <[email protected]> Co-authored-by: Anton Firszov <[email protected]> Co-authored-by: Charles Stoner <chucks@microso…