Skip to content

Commit

Permalink
[mono] merge wasm-threading-eventpipe into main (#68232)
Browse files Browse the repository at this point in the history
Merge initial work on multi-threaded WebAssembly.

The normal wasm build is single-threaded.  There should be no functional changes to its behavior.

To enable a multi-threaded build pass `/p:WasmEnableThreads=true`.  See `src/mono/wasm/threads.md` for details.

The big changes are:
1. The normal ref assemblies related to threading retain `[UnsupportedOSPlatform("browser")]` attributes for various threading-related functions
2. In System.Private.CoreLib, the `[UnsupportedOSPlatform]` attributes are removed, and functions that used to always throw PNSE nwo do a runtime check using `System.Threading.Thread.IsThreadStartSupported` to check if threading is enabled in the current build. 
3. A new nuget `Microsoft.NET.WebAssembly.Threading` is created.  It contains experimental ref assemblies without the `[UnsupportedOSPlatform]` attributes.  The intention is that code opting into experimenting with multithreading will include this nuget by setting some property that will be used by the wasm MSBuild SDK to pick a multi-threaded runtime build and configure things appropriately.  (The SDK updates don't exist yet).
4. In the multi-threaded runtime we don't use Emscripten's "main thread" option (ie: the browser thread is the main one); we also continue to run certain runtime-internal jobs (finalizers, GC pump) on the main thread even in the multi-threaded runtime.

Remaining work is tracked in the related issue #68162

---

* Initial changes for emscripten 2.0.34

* Use emcc-link.rsp in build targets

* Use updated docker images

* Fix compiler warnings

* Put `--profiling-funcs` to `_EmccLinkFlags`

* Fix build

    src/mono/mono/mini/mini-runtime.c:3407:25: error: ‘invoke’ undeclared (first use in this function); did you mean ‘revoke’?
       3407 |                         invoke = mono_marshal_get_runtime_invoke_dynamic ();

* Add shell to the environment

   Environment setting https://github.com/emscripten-core/emscripten/blob/2.0.34/src/settings.js#L616-L641

   From emscripten 2.0.25 release notes

    - Support for the 'shell' environment is now disabled by default.  Running under
      `d8`, `js`, or `jsc` is not something that most emscripten users ever want to
      do, so including the support code is, more often than not, unnecessary.  Users
      who want shell support can enable it by including 'shell' in `-s ENVIRONMENT`
      (#14535).

   Example of the the size increase for bench sample:

    -a---          12/10/2021  3:35 PM         382113 dotnet.js
    -a---          12/13/2021 10:37 AM         383589 dotnet.js

* Add emcc-link.rsp to PlatformManifestFileEntry

* Feedback

   https://github.com/emscripten-core/emscripten/blob/2fda25eea756c78c8cb024aa5b6c2b188bf7990f/src/settings.js#L1173-L1176

   -s EXPORT_ES6 is link option

* Bump emscripten version

* Bump llvm package version and use its libclang

* Use newer docker images with emscripten 3.1.1

* Remove unused variable

* Add runtime support for threads in the wasm build

   To enable, pass `/p:WasmEnableThreads` when building the runtime

   ./build.sh -Subset mono+libs -os Browser -arch wasm /p:WasmEnableThreads=true

* Prevent runtime from starting twice when loaded in a web worker

* Automatically populate the emscripten mainScriptUrlOrBlob property so that worker initialization can find dotnet.js

* Add compatibility shim so that emscripten's generated worker.js can properly get a Module instance, since we broke the API

* Checkpoint

* Bring back threadpool and add some tracing in diagnostics

* Add comments and fix a typo

* Introduce 'MonoObjectRef' ts type. Migrate mono_string_intern to not have a retval

* Checkpoint (strings are broken for some reason)

* Fix string interning

* Migrate ObjectToString and GetDateValue

* Checkpoint gc safe/unsafe region work

* More ref conversion

* Checkpoint (broken?)

* Fix missing method

* Fix incorrect signatures

* Fix lint

* Add new 'R' signature char for 'ref object'

* Remove AddEventListener and RemoveEventListener Checkpoint

* eslint fixes

* Update call_method signature to avoid passing raw object pointers

* Ref-ify one websocket API and fix types and incorrect rooting of two others

* Deprecation metadata

* More ref

* Remove outdated comments

* Convert typed_array_new to ref

* Add volatile modifiers, satisfy eslint

* Update src/mono/wasm/runtime/corebindings.c

* Missing conflict

* Fix build, set coop gc, and always copy dotnet.worker.js when it's around for apps

* Disable sample profiler, add some functions that were missing from katelyn's PR.

* Add safepoint around ep_rt_wait_event_set.  Tweak sample to explicitly exit wasm in order to properly flush event to the nettrace file (w/ rundown events).

* [gc] Start the GC Finalizer thread on threaded WASM

* [mono] add GC Unsafe in mono_assembly_load; remove in EventPipe

   Remove GC Unsafe hack in ep_rt_wait_event_set

* post-merge cleanup: delete duplicated definitions

* [sample] Env vars should be stringy

* updated dotnet.d.ts

* Add mono_threads_wasm_async_run_in_main_thread; do background work on main

   Don't start a finalizer thread

   Queue all background work to run on the main thread

* [mono] Fix non-threaded wasm build

* Add a System.Threading.Thread.WebAssembly.Threading ref assembly

* Update the browser sample to use System.Threading.Thread.WebAssembly.Threading

* Rationalize System.Threading.Thread build

   In CoreLib, never add the [UnsupportedOSPlatform("browser")] attribute. Rely on runtime checks (`ThrowIfNoThreadStart()`). In System.Threading.Thread ref assembly, always add the unsupported platform
attribute.  Add mismatches to ApiCompat baseline. In System.Threading.Thread.WebAssembly.Threading don't add the attributes, and also set DisablePackageBaselineValidation to prevent Restore from looking for a System.Threading.Thread.WebAssembly.Threading nuget (fixes in-tree ProjectReferences for testing)

* only turn on analyzers for the browser sample

   not all wasm samples

* Make a single Microsoft.NET.WebAssembly.Threading nupkg

   that holds all the special ref assemblies

* works: sample has ProjectReference to the Microsoft.NET.WebAssembly.Threading.proj

* Add System.Threading.ThreadPool.WebAssembly.Threading ref assembly

* ThreadPool: throw PNSE if no thread start

* Update wasm threads.md

* apicompat: correct warnings for System.Threading.ThreadPool

* Add dotnet.worker.js to the runtime pack; update PlatformManifestFileEntry

* [wasm] startup: detect Blazor dotnet.[version].[hash].js location

   Blazor injects a `<link rel="modulepreload" />` element into the header when it boots; detect it and extract the URL of the script.

   This is needed by Emscripten's dotnet.worker.js to run WorkerGlobalScope.importScripts

* one more fix to Microsoft.NET.WebAssembly.Threading

   Seems to be necessary in order for the resulting .nupkg not to reference non-existent nugets for the ProjectReferences

* rename sample to browser-mt-eventpipe

* bring back unmodified browser sample

   The multithreading sample is browser-mt-eventpipe

* update browser-mt-eventpipe sample to use ref assembly refs

   Referencing the rollup Microsoft.NET.WebAssembly.Threading.proj doesn't work (it ends up bundling the ref assemblies into the publish dir and breaking the app)

* Use correct ifdef in AppContext.AnyOS.cs

* [build] support WasmEnableThreads and WasmEnablePerfTracing

   These toplevel options either turn on multi-threading in general, or turn on multithreading only for eventpipe internals.

   For libraries these define `FeatureWasmThreads` and `FeatureWasmPerfTracing` properties and the `FEATURE_WASM_THREADS` and `FEATURE_WASM_PERFTRACING` compiler constants.

   For the native code, they control `DISABLE_THREADS` and `DISABLE_WASM_USER_THREADS` cmake and preprocessor settings.

* Only add the portable threadpool on wasm if threading is enabled

* rename browser-mt-eventpipe csproj and main assembly

   Give it a unique name distinct from Wasm.Browser.CJS.Sample.csproj

* fix /p:WasmEnableThreads=false build after merge

* now fix the WasmEnableThreads=true build

* we need two ThreadPoolBoundHandle implementation stubs

   one for PortableThreadPool when threads are enabled, one for single-threaded wasm

* Add a System.Diagnostics.Tracing ref assembly gated by FeatureWasmPerfTracing

* [eventpipe] use the correct cmake option name

   see src/mono/mono.proj

* revert debug printf and commented out code

* turn off additional logging

* hack: set FeatureWasmPerfTracing in the browser-mt-eventpipe sample

   It would be better to drive this (the inclusion of the tracing runtime component) from a user-visible flag. not the FeatureWasmPerfTracing implementation detail

* remove unused variable, remove unneeded configure checks, revert line damage; add better comment in export.ts

* Exclude Microsoft.NET.WebAssembly.Threading from testPackages.proj

* review feedback, Apply suggestions from code review

* Use a testPackages settings file to skip package runtime item verification

* remove unneeded Directory.Build.props for ref package

   since ti doesn't compile its own assembly, none of these properties are needed

* use one ProjectReference item to share metadata for the ref assemblies

* remove ProjectReference comment and NoTargetsDoNotReferenceOutputAssemblies prop

* Remove unneeded target

* packaging simplification

   - move `_ExperimentalUpdateFileVersion` target to packaging.targets, conditioned on a new `IsExperimentalRefAssembly` attribute.  (The target increments the file version of the ref assembly to make it easier to distinguish from the real non-experimental ref assembly)
   - Remove unneeded src subdirectories in ref assembly libraries
   - Move properties that are only used in the ref assembly projects directory into the projects and delete Directory.Build.props in the experimental ref assembly subdirectories.

* move and rename UpdateExperimentalRefAssemblyFileVersion target

   packages.targets is only included for IsPackable=true projects, and these ref assemblies are not packable.

* Assorted code review nits

* Don't build/pack the multi-threaded sample on single-threaded runtime

* remove gratuitous debug printfs

* Apply suggestions from code review

* merge followup: nullable is enabled by default now

* make eslint happy

* include wasm-config.h in wasm runtime host

* include wasm-config.h into the runtime pack

   fixes aot compilation

* Add wasm-config.h to manifest

* put wasm-config.h into include/wasm from the outset

* put back noExitRuntime replacement for CJS

Co-authored-by: Radek Doulik <[email protected]>
Co-authored-by: Radek Doulik <[email protected]>
Co-authored-by: Zoltan Varga <[email protected]>
Co-authored-by: Steve Pfister <[email protected]>
Co-authored-by: Katelyn Gadd <[email protected]>
Co-authored-by: Viktor Hofer <[email protected]>
  • Loading branch information
7 people authored Apr 26, 2022
1 parent 8006e6a commit b44c008
Show file tree
Hide file tree
Showing 66 changed files with 793 additions and 85 deletions.
16 changes: 16 additions & 0 deletions eng/references.targets
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,20 @@
Condition="$(NetCoreAppLibraryNoReference.Contains('%(Filename);'))" />
</ItemGroup>
</Target>

<!-- For experimental ref assemblies (which typically have the same name as a regular ref
assembly), bump their minor file version by 100 to make it distinguishable from the regular
ref assembly.
-->
<Target Name="UpdateExperimentalRefAssemblyFileVersion"
AfterTargets="_InitializeAssemblyVersion"
Condition="'$(IsReferenceAssemblyProject)' == 'true' and '$(IsExperimentalRefAssembly)' == 'true'">
<PropertyGroup>
<_FileVersionMaj>$(FileVersion.Split('.')[0])</_FileVersionMaj>
<_FileVersionMin>$(FileVersion.Split('.')[1])</_FileVersionMin>
<_FileVersionBld>$(FileVersion.Split('.')[2])</_FileVersionBld>
<_FileVersionRev>$(FileVersion.Split('.')[3])</_FileVersionRev>
<FileVersion>$(_FileVersionMaj).$([MSBuild]::Add($(_FileVersionMin), 100)).$(_FileVersionBld).$(_FileVersionRev)</FileVersion>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace System.Threading
//
// Windows-specific implementation of ThreadPool
//
[UnsupportedOSPlatform("browser")]
public sealed class RegisteredWaitHandle : MarshalByRefObject
{
private readonly Lock _lock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
<PlatformManifestFileEntry Include="libmono-wasm-eh-wasm.a" IsNative="true" />
<PlatformManifestFileEntry Include="System.Private.Runtime.InteropServices.Javascript.dll" />
<PlatformManifestFileEntry Include="dotnet.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.worker.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.js.symbols" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.d.ts" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.wasm" IsNative="true" />
Expand All @@ -237,6 +238,7 @@
<PlatformManifestFileEntry Include="pinvoke.c" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke.h" IsNative="true" />
<PlatformManifestFileEntry Include="gc-common.h" IsNative="true" />
<PlatformManifestFileEntry Include="wasm-config.h" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-default.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-link.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-props.json" IsNative="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeBuildOutput>true</IncludeBuildOutput>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<NoTargetsDoNotReferenceOutputAssemblies>false</NoTargetsDoNotReferenceOutputAssemblies>
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<IsPackable>true</IsPackable>
<PackageDescription>Exposes Threading APIs for WebAssembly projects</PackageDescription>
<!-- XXX FIXME: NU5128 suppresses a really scary message about missing net7.0 dependencies -->
<NoWarn>$(NoWarn);NU5128;NU5131</NoWarn>
<!-- Place assemblies in the nuget ref folder -->
<BuildOutputTargetFolder>ref</BuildOutputTargetFolder>
</PropertyGroup>

<ItemGroup>
<ProjectReference
Include="$(LibrariesProjectRoot)System.Threading.Thread.WebAssembly.Threading\ref\System.Threading.Thread.WebAssembly.Threading.csproj;
$(LibrariesProjectRoot)System.Threading.ThreadPool.WebAssembly.Threading\ref\System.Threading.ThreadPool.WebAssembly.Threading.csproj;
$(LibrariesProjectRoot)System.Diagnostics.Tracing.WebAssembly.PerfTracing\ref\System.Diagnostics.Tracing.WebAssembly.PerfTracing.csproj"
Pack="true" PrivateAssets="all" Private="true" IncludeReferenceAssemblyInPackage="true" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<FeatureWasmPerfTracing>true</FeatureWasmPerfTracing>
<AssemblyName>System.Diagnostics.Tracing</AssemblyName>
<!-- tell references.targets to bump the assembly version -->
<IsExperimentalRefAssembly>true</IsExperimentalRefAssembly>
<!-- Disable all binplacing since this assembly will clash with the real ref assembly -->
<EnableBinPlacing>false</EnableBinPlacing>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<DefineConstants Condition="'$(FeatureWasmPerfTracing)' == 'true'">$(DefineConstants);FEATURE_WASM_PERFTRACING</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\System.Diagnostics.Tracing\ref\System.Diagnostics.Tracing.cs" />
<Compile Include="..\..\System.Diagnostics.Tracing\ref\System.Diagnostics.Tracing.Counters.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" PrivateAssets="all" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

namespace System.Diagnostics.Tracing
{
#if !FEATURE_WASM_PERFTRACING
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
#endif
public abstract partial class DiagnosticCounter : System.IDisposable
{
internal DiagnosticCounter() { }
Expand All @@ -14,28 +16,36 @@ internal DiagnosticCounter() { }
public void AddMetadata(string key, string? value) { }
public void Dispose() { }
}
#if !FEATURE_WASM_PERFTRACING
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
#endif
public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> metricProvider) { }
public override string ToString() { throw null; }
}
#if !FEATURE_WASM_PERFTRACING
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
#endif
public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public System.TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public void Increment(double increment = 1) { }
public override string ToString() { throw null; }
}
#if !FEATURE_WASM_PERFTRACING
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
#endif
public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> totalValueProvider) { }
public System.TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public override string ToString() { throw null; }
}
#if !FEATURE_WASM_PERFTRACING
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
#endif
public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<FeatureWasmPerfTracing>false</FeatureWasmPerfTracing>
<DefineConstants Condition="'$(FeatureWasmPerfTracing)' == 'true'">$(DefineConstants);FEATURE_WASM_PERFTRACING</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Diagnostics.Tracing.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Compat issues with assembly System.Diagnostics.Tracing:
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.DiagnosticCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.EventCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.IncrementingEventCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.IncrementingPollingCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.PollingCounter' in the contract but not the implementation.
Total Issues: 4
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Compat issues with assembly System.Diagnostics.Tracing:
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.DiagnosticCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.EventCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.IncrementingEventCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.IncrementingPollingCounter' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Diagnostics.Tracing.PollingCounter' in the contract but not the implementation.
MembersMustExist : Member 'protected void System.Diagnostics.Tracing.EventCounter.Flush()' does not exist in the reference but it does exist in the implementation.
CannotMakeTypeAbstract : Type 'System.Diagnostics.Tracing.EventListener' is abstract in the reference but is not abstract in the implementation.
CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener..ctor()' is 'protected' in the reference but 'public' in the implementation.
CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener.EventSourceIndex(System.Diagnostics.Tracing.EventSource)' is 'protected' in the reference but 'public' in the implementation.
Total Issues: 4
Total Issues: 8
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Activator.RuntimeType.cs" Condition="'$(TargetsCoreRT)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\AggregateException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.AnyOS.cs" Condition="'$(TargetsBrowser)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.AnyOS.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContextConfigHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppDomain.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppDomainSetup.cs" />
Expand Down Expand Up @@ -2329,7 +2329,7 @@
<ItemGroup Condition="'$(FeaturePortableThreadPool)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.Windows.cs" Condition="'$(TargetsWindows)' == 'true' and '$(FeatureCoreCLR)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\NativeRuntimeEventSource.PortableThreadPool.cs" Condition="'$(FeatureCoreCLR)' != 'true' and '$(FeatureMono)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs" Condition="'$(FeatureCoreCLR)' == 'true' or '$(FeatureMono)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.cs" />
Expand All @@ -2346,7 +2346,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.CpuUtilizationReader.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.cs" Condition="'$(TargetsBrowser)' != 'true' or '$(FeatureWasmThreads)' == 'true'"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Portable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace System
{
public static partial class AppContext
{
#if !TARGET_BROWSER
[UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file",
Justification = "Single File apps should always set APP_CONTEXT_BASE_DIRECTORY therefore code handles Assembly.Location equals null")]
private static string GetBaseDirectoryCore()
Expand All @@ -33,6 +34,7 @@ private static string GetBaseDirectoryCore()

return directory;
}
#endif

#if FEATURE_PERFTRACING
internal static void LogSwitchValues(RuntimeEventSource ev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ namespace Microsoft.Diagnostics.Tracing
namespace System.Diagnostics.Tracing
#endif
{
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
internal sealed class CounterGroup
{
private readonly EventSource _eventSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ namespace System.Diagnostics.Tracing
/// DiagnosticCounter is an abstract class that serves as the parent class for various Counter* classes,
/// namely EventCounter, PollingCounter, IncrementingEventCounter, and IncrementingPollingCounter.
/// </summary>
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
public abstract class DiagnosticCounter : IDisposable
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ namespace System.Diagnostics.Tracing
/// See https://github.com/dotnet/runtime/blob/main/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs
/// which shows tests, which are also useful in seeing actual use.
/// </summary>
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
public partial class EventCounter : DiagnosticCounter
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ namespace System.Diagnostics.Tracing
/// It does not calculate statistics like mean, standard deviation, etc. because it only accumulates
/// the counter value.
/// </summary>
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
public partial class IncrementingEventCounter : DiagnosticCounter
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ namespace System.Diagnostics.Tracing
/// Unlike IncrementingEventCounter, this takes in a polling callback that it can call to update
/// its own metric periodically.
/// </summary>
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
public partial class IncrementingPollingCounter : DiagnosticCounter
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ namespace System.Diagnostics.Tracing
/// function to collect metrics on its own rather than the user having to call WriteMetric()
/// every time.
/// </summary>
#if NETCOREAPP
[UnsupportedOSPlatform("browser")]
#endif
public partial class PollingCounter : DiagnosticCounter
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace System.Threading
/// <summary>
/// An object representing the registration of a <see cref="WaitHandle"/> via <see cref="ThreadPool.RegisterWaitForSingleObject"/>.
/// </summary>
[UnsupportedOSPlatform("browser")]
public sealed partial class RegisteredWaitHandle : MarshalByRefObject
{
internal RegisteredWaitHandle(WaitHandle waitHandle, _ThreadPoolWaitOrTimerCallback callbackHelper,
int millisecondsTimeout, bool repeating)
{
Thread.ThrowIfNoThreadStart();
Handle = waitHandle.SafeWaitHandle;
Callback = callbackHelper;
TimeoutDurationMs = millisecondsTimeout;
Expand Down
Loading

0 comments on commit b44c008

Please sign in to comment.