We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.
The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.
* [browser][tests][outerloop] Standup OuterLoop tests on CI
* System.Collections.NonGeneric.Tests passing
* System.Console.Tests passing
* System.Diagnostics.DiagnosticSource.Tests passing
* System.Globalization.Tests passing
- See active issue https://github.com/dotnet/runtime/issues/45951
* System.IO.FileSystem.Tests passing after deactivating test cannot wait on monitors on this runtime.
* System.IO.FileSystem.Tests passing - See active issue: https://github.com/dotnet/runtime/issues/45954
* Remove fat fingered code.
* Threads not supported on Browser
* Browser does not support monitor
* Browser does not support monitor
* Browser does not support wait on monitors
* Browser does not support wait on monitors
* Add ActiveIssue for DataFlow tests TestNullTarget_CompletionNoCaching
* Add ActiveIssue for DataFlow tests
* Add ActiveIssue for DataFlow tests
* Add threading support conditional
* Change all Cannot wait on monitors on this runtime Browser platform checks to
[ConditionalXXXX(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
As was suggested in comments
* Address review comment for monitors not supported
* Address review comments
* Add threading supported condition.
```
fail: [FAIL] System.Text.Json.Serialization.Tests.EnumConverterTests.VeryLargeAmountOfEnumsToSerialize
[08:10:56] info: System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.
```
- Enables using the portable thread pool with coreclr as opt-in. Change is off by default for now, and can be enabled with COMPlus_ThreadPool_UsePortableThreadPool=1. Once it's had bake time and seen to be stable, at a reasonable time in the future the config flag would ideally be removed and the relevant parts of native implementation deleted.
- The IO thread pool is not being migrated in this change, and remains on the native side
- My goal was to get compatible behavior, compatible with diagnostics tools, and similar perf to the native implementation in coreclr. Tried to avoid changing scheduling behavior, behavior of heuristics, etc., compared with that implementation.
- The eventual goal is to have one mostly managed thread pool implementation that can be shared between runtimes, to ease maintenance going forward
Commit descriptions:
- "Add dependencies"
- Ported LowLevelLock from CoreRT, and moved LowLevelSpinWaiter to shared. Since we support Thread.Interrupt(), they were necessary in the wait subsystem in CoreRT partly to support that, and were also used in the portable thread pool implementation where a pending thread interrupt on a thread pool thread would otherwise crash the process. Interruptible waits are already used in the managed side of the thread pool in the queue implementations. It may be reasonable to ignore the thread interrupt problem and suggest that it not be used on thread pool threads, but for now I just brought in the dependencies to keep behavior consistent with the native implementation.
- "Add config var"
- Added config var COMPlus_ThreadPool_UsePortableThreadPool (disabled by default for now)
- Flowed the new config var to the managed side and set up a mechanism to flow all of the thread pool config vars
- Removed debug-only config var COMPlus_ThreadpoolTickCountAdjustment, which didn't seem to be too useful
- Specialized native and managed thread pool paths based on the config var. Added assertions to paths that should not be reached depending on the config var.
- "Move portable RegisteredWaitHandle implementation to shared ThreadPool.cs"
- Just moved the portable implementation, no functional changes. In preparation for merging the two implementations.
- "Merge RegisteredWaitHandle implementations"
- Merged implementations of RegisteredWaitHandle using the portable version as the primary and specializing small parts of it for coreclr
- Fixed PortableThreadPool's registered waits to track SafeWaitHandles instead of WaitHandles similarly to the native implementation. The SafeWaitHandle in a WaitHandle can be modified, so it is retrieved once and reused thereafter. Also added/removed refs for the SafeWaitHandles that are registered.
- "Separate portable-only portion of RegisteredWaitHandle"
- Separated RegisteredWaitHandle.UnregisterPortable into a different file, no functional changes. Those paths reference PortableThreadPool, which is conditionally included unlike ThreadPool.cs. Just for consistency such that the new file can be conditionally included similarly to PortableThreadPool.
- "Fix timers, tiered compilation, introduced time-sensitive work item queue to simulate coreclr behavior"
- Wired work items queued from the native side (appdomain timer callback, tiered compilation background work callback) to queue them into the managed side
- The timer thread calls into managed code to queue the callback
- Some tiered compilation work item queuing paths cannot call managed code, so used a timer with zero due time instead
- Added a queue of "time-sensitive" work items to the managed side to mimic how work items queued from the native side ran previously. In particular, if the global queue is backed up, when using the native thread pool the native work items still run ahead of them periodically (based on the Dispatch quantum). Potentially they could be queued into the global queue but if it's backed up it can potentially significantly and perhaps artificially delay the appdomain timer callback and the tiering background jitting. I didn't want to change the behavior in an observable (and potentially bad) way here for now, a good time to revisit this would be when IO completion handling is added to the portable thread pool, then the native work items could be handled somewhat similarly.
- "Implement ResetThreadPoolThread, set thread names for diagnostics"
- Aside from that, setting the thread names (at OS level) allows debuggers to identify the threads better as before. For threads that may run user code, the thread Name property is kept as null as before, such that it may be set without exception.
- "Cache-line-separate PortableThreadPool._numRequestedWorkers similarly to coreclr"
- Was missed before, separated it for consistency
- "Post wait completions to the IO completion port on Windows for coreclr, similarly to before"
- On Windows, wait completions are queued to the IO thread pool, which is still implemented on the native side. On Unixes, they are queued to the global queue.
- "Reroute managed gate thread into unmanaged side to perform gate activites, don't use unmanaged gate thread"
- When the config var is enabled, removed the gate thread from the native side. Instead, the gate thread on the managed side calls into the native side to perform gate activities for the IO completion thread pool, and returns a value to indicate whether the gate thread is still necessary.
- Also added a native-to-managed entry point to request the gate thread to run for the IO completion thread pool
- "Flow config values from CoreCLR to the portable thread pool for compat"
- Flowed the rest of the thread pool config vars to the managed side, such that COMPlus variables continue to work with the portable thread pool
- Config var values are stored in AppContext, made the names consistent for supported and unsupported values
- "Port - ..." * 3
- Ported a few fixes that did not make it into the portable thread pool implementation
- "Fix ETW events"
- Fixed the EventSource used by the portable thread pool, added missing events
- For now, the event source uses the same name and GUID as the native side. It seems to work for now for ETW, we may switch to a separate provider (along with updating tools) before enabling the portable thread pool by default.
- For enqueue/dequeue events, changed to use the object's hash code as the work item identifier instead of the pointer since the pointer may change between enqueue and dequeue
- "Fix perf of counts structs"
- Structs used for multiple counts with interlocked operations were implemented with explicit struct layout and field offsets. The JIT seems to generate stack-based code for such structs and it was showing up as higher overhead in perf profiles compared to the equivalent native implementation. Slower code in compare-exchange loops can cause a larger gap of time between the read and the compare-exchange, which can also cause higher contention.
- Changed the structs to use manual bit manipulation instead, and microoptimized some paths. The code is still not as good as that generated by C++, but it seems to perform similarly based on perf profiles.
- Code size also improved in many cases, for example one of the larger differences was in MaybeAddWorkingWorker(), which decreased from 585 bytes to 382 bytes and with far fewer stack memory operations
- "Fix perf of dispatch loop"
- Just some minor tweaks as I was looking at perf profiles and code of Dispatch()
- "Fix perf of ThreadInt64PersistentCounter"
- The implementation used to count completed work items was using `ThreadLocal<T>`, which turned out to be too slow for that purpose according to perf profiles
- Changed it to rely on the user of the component to provide an object that tracks the count, which the user of the component would obtain from a ThreadStatic field
- Also removed the thread-local lookup per iteration in one of the hot paths in Dispatch() and improved inlining
- "Miscellaneous perf fixes"
- A few more small tweaks as I was looking at perf profiles and code
- In ConcurrentQueue, added check for empty into the fast path
- For the portable thread pool, updated to trigger the worker thread Wait event after the short spin-wait completes and before actually waiting, the event is otherwise too verbose when profiling and changes performance characteristics
- Cache-line-separated the gate thread running state as is done in the native implementation
- Accessing PortableThreadPool.ThreadPoolInstance multiple times was generating less than ideal code that was noticeable in perf profiles. Tried to avoid it especially in hot paths, and in some cases where unnecessary for consistency if nothing else.
- Removed an extra call to Environment.TickCount in Dispatch() per iteration
- Noticed that a field that was intended to be cache-line-separated was not actually being separated, see https://github.com/dotnet/runtime/issues/38215, fixed
- "Fix starvation heuristic"
- Described in comment
- "Implement worker tracking"
- Implemented the equivalent in the portable thread pool along with raising the relevant event
- "Use smaller stack size for threads that don't run user code"
- Using the same stack size as in the native side for those threads
- "Note some SOS dependencies, small fixes in hill climbing to make equivalent to coreclr"
- Corresponds with PR that updates SOS: https://github.com/dotnet/diagnostics/pull/1274
- Also fixed a couple of things to work similarly to the native implementation
- "Port some tests from CoreRT"
- Also improved some of the tests
- "Fail-fast in thread pool native entry points specific to thread pool implementations based on config"
- Scanned all of the managed-to-native entry points from the thread pool and thread-entry functions, and promoted some assertions to be verified in all builds with fail-fast. May help to know in release builds when a path that should not be taken is taken and to avoid running further along that path.
- "Fix SetMinThreads() and SetMaxThreads() to return true only when both changes are successful with synchronization"
- These are a bit awkward when the portable thread pool is enabled, because they should return true only when both changes are valid and return false without making any changes otherwise, and since the worker thread pool is on the managed side and IO thread pool is on the native side
- Added some managed-to-native entry points to allow checking validity before making the changes, all under a lock taken by the managed side
- "Fix registered wait removals for fairness since there can be duplicate system wait objects in the wait array"
- Described in comment
- "Allow multiple DotNETRuntime event providers/sources in EventPipe"
- Temporary change to EventPipe to be able to get events from dotnet-trace
- For now, the event source uses the same name and GUID as the native side. It seems to work for now for ETW, and with this change it seems to work with EventPipe for getting events. Subscribing to the NativeRuntimeEventSource does not get thread pool events yet, that is left for later. We may switch to a separate provider (along with updating tools) before enabling the portable thread pool by default, as a long-term solution.
- "Fix registered wait handle timeout logic in the wait thread"
- The timeout logic was comparing against how long the last wait took and was not timing out waits sometimes, fixed to consider the total time since the last reset of timeout instead
- "Fix Browser build"
- Updated the Browser-specific thread pool variant based on the other changes
Corresponding PR to update SOS: https://github.com/dotnet/diagnostics/pull/1274
Fixes https://github.com/dotnet/runtime/issues/32020
- Remove depprojs which currently binplace external references into the RefPath folders in favor of PackageReference and PackageDownload items.
- Build all configurations by default when building an individual project (either on the CLI or inside VS) same as with the official SDK. This enables .NETFramework Test Explorer support.
- Centrally define libraries that compose the shared framework instead of in each Directory.Build.props file to be able to build the targeting pack first and consume it in the OOB libraries.
- Use ProjectReferences to reference OOB projects. Compile against the reference assembly but use the implementation assembly app-local during runtime.
- Remove OOBs from the testhost and remove the testhost folder for .NETFramework as it isn't required anymore.
- Only binplace for $(NetCoreAppCurrent) to compose a) the targeting pack, b) the runtime pack, c) the testhost, d) a full closure for the shims.
- Use Targeting Packs for OOB projects (with their implicit assembly references) but still explicitly define granular references for .NETCoreApp configurations (DisableImplicitAssemblyReferences switch). Use the implicit targeting pack references in some Microsoft.Extensions.* cases.
- Remove placeholder configurations as they aren't needed anymore with explicit P2Ps vs Targeting Pack references.
- Remove implicit assembly references (ie for .NETFramework, mscorlib)
- Remove AssemblySearchPath hacks that were introduced with b7c4cb7 as the targeting pack is now used by default.
- Reduce unnecessary .NETFramework configurations that were added to run tests in favor of the already existing ref&src configurations.
- Stop hardcoding the paths for wasm assemblies and use the returned TargetPath of the ProjectReferences.
- Addressed formatting (ItemGroups, References at the bottom of the project file, ordering of references, use LibrariesProjectRoot instead of a relative path, unnecessary AssemblyName and RootNamespace properties which are identical to the project name, ordering of tfms)
- Revert "fix clean (#33758)"
Some of our full facades are missing `<Nullable>enable</Nullable>`. I don't think the lack of these causes any issues, but having them makes it easy to confirm what ref assemblies remain to be annotated.
- Adds the type, almost an exact copy of `TaskCompletionSource<TResult>`, but creating a `Task` instead of a `Task<TResult>`. Primary benefits here are symmetry, smaller `Task` object, and not forcing a developer to specify an unnecessary type name.
- Adds tests for both TCS and TCS<TResult>.
- Switches a bunch of usage of the generic type over to the non-generic, both in src and tests.
* libraries -restore for vertical build without test restore
* Automatic test change and regex to remove the addition of an extra line at eof
* manual test restore fixed (restore completely done for vertical build)
* build native done
* Automatic ref change and regex to remove the last line
* manual reference assebly change and generated shims build
* automatic src change and regex
* native bin place and src build manual change
* apicompat and pretest.csproj done
* fixing the package build
* fixing all config
* packaging and feedback
* adding back placeholder configuration
* fixing the shims
* delete configuration.props
* making the build work in master
* Test Change
* fixing the packageing, test restore replacing TargetFramework -> OriginalTargetFramework
* delete test configuraiton.props, trailing semicolon and use targetFramework
* reverting the package change
* enable apicompat and fixing configurationGroup for individual projects
* fixing the api compat
* making ilproj work
* adding the outerBuildTest
* adding the arcade package version
* fixing the merge conflicts
* minor changes
* adding additional configs and setting the runtimeOS
* making the vs stuff work
* removing the target Group to fix the apicompat
* fixing the linux build and some minor changes
* making additionalBuildTargetFramework LOcalProperty
* fixing the allConfigurations build
* fixing the netfx build
* fixing package Testing and restore
* Missing TargetFrameworks tag
* making the VSdesgin stuff work
* Remove OriginalFramework Entirely
* some minor pr feedback
* RemoveExtraSemicolon
* use boolean exclude flag
* fixing yml scripts to pass tests
* adding comments and some minor feedback
* moving packaging property to correct plave
* fixing the build for web assembly
* Fixing the live ci build
* Fixing the live build for shims
* fixing the tests
* fixing the packaging and enterprise linux
* fixing package sizes
* Fix the targetFramework
* updating the targetFramework sdl
* removing the buildOS and be able to use OSGroup as done in the old system
* Fixing the osgroup stuff for send to helix task
* Fix OSX failures
* Fixing the osx build
* uploading tmp folder to artifacts
* running restore for runtime.deproj correctly
* netcoreapp -> netcoreapp5.0 in .sln files
* netcoreapp; -> netcoreapp5.0; , netcoreapp- to netcoreapp5.0-
* netcoreapp- -> netcoreapp5.0 in .csproj
* 'netcoreapp -> 'netcoreapp5.0 in .csproj
* done with libraries sub folder
* missed semicolon
* minor changes
* netcoreapp -> netcoreapp5.0 in some extra files
* vNext target variable in configurations.props
* netcoreapp => netcoreapp5/0 in some other .props file
* netcoreapp -> vnext in .csproj
* making the netcorepap framework switch work
* fixing sendToHelix and linux build
* TargetFrameworkVNext -> netcoreappCurrent
* case correct netcoreappcurrent
* fixing send to helix zip path
* netfx -> net472 in .sln
* netfx; -> net472; in .props
* netfx- -> net472- in .props
* netfx - -> net472- in .csproj
* 'netfx-> 'net472 in .csproj
* netfx -> net472 manual change
* fixing ci build for netfx
* Not trying to change the global property
* Fixing build failure due to master changes in net https tests
* adding documentaiton and fixing filtering
* netcoreapp -> netcore5.0 in py file
* changing the path to use netcoreapp5.0 version
* feedback and override corefx path corrected in installers
* remaing netcoreapp5.0 changes done
* netcoreapp-> netcoreapp5.0 after live builds
* net472 -> netframeworkcurrent
* Fix test build break and update common path usages to use property
* Use normalize directory for CommonPath and CommonTestPath
* Update instances of CommonPath and CommonTestPath to not use trailing \
Mechanical/automated change. The only manual changes were a) removing the two rules from the CodeAnalysis.ruleset file, b) removing spaces from one line of a .targets file that is used to generate a .cs file, and c) reverting the changes in a few test files where the naive replacement happened in the middle of a verbatim string where the whitespace actually mattered.
Commit migrated from https://github.com/dotnet/corefx/commit/09a6e66b0c2b31bd0f6e7e3170537d14027aeed0
* Auto-generate the reference assemblies
* Add back type forwards.
* Revert "Add back type forwards."
This reverts commit dotnet/corefx@3acf74aabb.
* Add back TypeForwardedTo in .Forward.cs files
* Add new type forward files to the csproj files
* Add back if-defs and move TestUtilities comment from ref to source
* Remove duplicate definitions, delete unnecessary manual files,
* Fix build breaks
* Add back missing AsyncMethodBuilderAttr to S.Runtime ref
* Fix typo between XmlDocument and XPath.XDocument
* Add type forward fild missed from previous commit
* Fix ECDiffieHellmanCngPublicKey internal ctor for netfx 4.6.1
* Remove "this type was moved to comments" from the type forwards.
* Add back the Xml and Debugger* attributes to Xml.ReaderWriter
* Add back struct layout attributes
* Add back attributes missing (highlighted from api compat)
* Add missing toolbox item attribute in s.data.common.
* Add missing struct layout attributes and remove unnecessary additions
* Add back InterfaceTypeAttribute
Commit migrated from https://github.com/dotnet/corefx/commit/16689aa0a933517dc45465fc6edb6223222414a6
* Add more Timer tests
Exercise scenarios involving lots of timers.
* Add debugging details to new test
The test is failing with very high percentages (e.g. 100%) on macOS in CI. Add more data to find out why.
* Disable test on macOS, and make test a little more forgiving, too
Commit migrated from https://github.com/dotnet/corefx/commit/61d06d8b7ba8e16d22714a6a173d61efb6289fd5
* Coverage do not target CoreLib in bulk
* Fix 1 project add temp nop to 2 others
* PR feedback: reuse property to disable code coverage
* PR Feedback: add dedicated property to target runtime
* System.Transactions.Local.Tests taking too long on PR
Commit migrated from https://github.com/dotnet/corefx/commit/95eeecb5184e414810bc94fdb496c5748289a720
Changes to add a new netcoreappaot target group, similar to netcoreapp but it builds against the .NET Native core libraries. A couple of libraries, such as System.Linq.Expressions, have aot-specific definitions that are enabled for netcoreappaot.
Commit migrated from https://github.com/dotnet/corefx/commit/3333166174e54ae9435c31e0a68a6784e9aacc41