diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 5f28824c09a299..53e2dc562691f4 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -107,7 +107,7 @@ jobs: - Browser_wasm #- Browser_wasm_win nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:_WasmPThreadPoolSize=8 + extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:_WasmPThreadPoolSize=8 isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} # Always run for runtime-wasm because tests are not run in runtime @@ -127,7 +127,7 @@ jobs: - Browser_wasm #- Browser_wasm_win nameSuffix: _Threading_PerfTracing - extraBuildArgs: /p:WasmEnablePerfTracing=true + extraBuildArgs: /p:MonoWasmBuildVariant=perftrace isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} # Always run for runtime-wasm because tests are not run in runtime diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index cf5e09293ea31f..56581e27013083 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -445,7 +445,7 @@ extends: platforms: - Browser_wasm nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true + extraBuildArgs: /p:MonoWasmBuildVariant=multithread alwaysRun: ${{ variables.isRollingBuild }} - template: /eng/pipelines/common/templates/wasm-build-only.yml @@ -453,7 +453,7 @@ extends: platforms: - Browser_wasm nameSuffix: _Threading_PerfTracing - extraBuildArgs: /p:WasmEnablePerfTracing=true + extraBuildArgs: /p:MonoWasmBuildVariant=perftrace alwaysRun: ${{ variables.isRollingBuild }} # diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index f3894923e086f0..2d23e4fcf91e18 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -98,7 +98,7 @@ <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode) <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs) - <_XHarnessArgs Condition="('$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true') and '$(_XHarnessArs.Contains("--web-server-use-cop")' != 'true'">$(_XHarnessArgs) --web-server-use-cop + <_XHarnessArgs Condition="('$(MonoWasmBuildVariant)' == 'multithread' or '$(MonoWasmBuildVariant)' == 'perftrace') and '$(_XHarnessArs.Contains("--web-server-use-cop")' != 'true'">$(_XHarnessArgs) --web-server-use-cop <_XHarnessArgs >$(_XHarnessArgs) -s dotnet.js.symbols <_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbol-patterns wasm-symbol-patterns.txt <_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbolicator WasmSymbolicator.dll,Microsoft.WebAssembly.Internal.SymbolicatorWrapperForXHarness diff --git a/eng/testing/workloads-testing.targets b/eng/testing/workloads-testing.targets index ef363aef425688..be571215f53cae 100644 --- a/eng/testing/workloads-testing.targets +++ b/eng/testing/workloads-testing.targets @@ -159,8 +159,8 @@ --> - <_DefaultBuildVariant Condition="'$(WasmEnableThreads)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread'">.multithread. - <_DefaultBuildVariant Condition="'$(WasmEnablePerfTracing)' == 'true' or '$(MonoWasmBuildVariant)' == 'perftrace'">.perftrace. + <_DefaultBuildVariant Condition="'$(MonoWasmBuildVariant)' == 'multithread'">.multithread. + <_DefaultBuildVariant Condition="'$(MonoWasmBuildVariant)' == 'perftrace'">.perftrace. <_DefaultBuildVariant Condition="'$(_DefaultBuildVariant)' == ''">. <_DefaultRuntimePackNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono$(_DefaultBuildVariant)browser-wasm.$(PackageVersionForWorkloadManifests).nupkg diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props index 05574402ee8c95..77bcb239745a5f 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props @@ -15,9 +15,6 @@ true true The .NET Shared Framework - - multithread - perftrace diff --git a/src/libraries/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj b/src/libraries/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj index 87841c3eae041b..c571f7b37eb65a 100644 --- a/src/libraries/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj +++ b/src/libraries/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj @@ -4,9 +4,7 @@ true - diff --git a/src/libraries/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj b/src/libraries/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj index f20973b1c8c181..f6312b653df64a 100644 --- a/src/libraries/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj +++ b/src/libraries/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj @@ -4,8 +4,7 @@ true - + diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index f877d2046f8356..8b6a516050e97b 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -45,12 +45,12 @@ - + - + @@ -369,7 +369,7 @@ - + @@ -378,7 +378,7 @@ - + diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index 7c126121b96481..f48e722486cc20 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -121,8 +121,8 @@ $(DefineConstants);MONO_FEATURE_SRE true - true - true + true + true true true true diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 94ffc014244470..9b18ac091e2702 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -53,8 +53,8 @@ $([MSBuild]::NormalizeDirectory('$(RepositoryEngineeringDir)', 'common')) $([MSBuild]::NormalizePath('$(RepositoryEngineeringCommonDir)', 'cross', 'toolchain.cmake')) false - true - true + true + true diff --git a/src/mono/sample/wasm/Directory.Build.props b/src/mono/sample/wasm/Directory.Build.props index d03dbcf021398d..a5af908c5fef0c 100644 --- a/src/mono/sample/wasm/Directory.Build.props +++ b/src/mono/sample/wasm/Directory.Build.props @@ -15,7 +15,7 @@ bin $(MSBuildProjectDirectory)\bin\$(Configuration)\AppBundle\ - $(WasmXHarnessArgs) --web-server-use-cop + $(WasmXHarnessArgs) --web-server-use-cop false diff --git a/src/mono/sample/wasm/browser-eventpipe/README.md b/src/mono/sample/wasm/browser-eventpipe/README.md index ad7ffe1158093b..855f2e4c78c0a7 100644 --- a/src/mono/sample/wasm/browser-eventpipe/README.md +++ b/src/mono/sample/wasm/browser-eventpipe/README.md @@ -4,7 +4,7 @@ To be able to run this sample you need to build the runtime with `/p:WasmEnableP # Testing with mock -Build the runtime with `/p:WasmEnablePerfTracing=true /p:MonoDiagnosticsMock=true` +Build the runtime with `/p:MonoWasmBuildVariant=perftrace /p:MonoDiagnosticsMock=true` Run this test with `/p:MonoDiagnosticsMock=true` It will inject file [mock.js](./mock.js) into the worker thread, which is mocking the `dotnet trace` tool. @@ -17,8 +17,8 @@ dotnet trace convert --format Speedscope c:\Downloads\trace.1665653486202.nettra # Testing with dotnet trace tool -Build the runtime with `/p:WasmEnablePerfTracing=true` -Build version of dsrouter with WebSockets https://github.com/lambdageek/diagnostics/tree/wasm-server +Build the runtime with `/p:MonoWasmBuildVariant=perftrace` +Build a version of dsrouter with WebSockets support (versions from upstream that target net6.0 or later have the requisite support, see https://github.com/dotnet/diagnostics/blob/main/src/Tools/dotnet-dsrouter/dotnet-dsrouter.csproj) In console #1 start dsrouter ``` @@ -40,4 +40,4 @@ In the browser click `Start Work` button and after it finished In the #3 console press `Enter` -In the browser open dev tools and on performance tab import file `C:\Dev\socket_XXXXXXXX_YYYYYY.chromium.json` which dotnet trace produced \ No newline at end of file +In the browser open dev tools and on performance tab import file `C:\Dev\socket_XXXXXXXX_YYYYYY.chromium.json` which dotnet trace produced diff --git a/src/mono/wasm/threads.md b/src/mono/wasm/threads.md index 36431d915a9b7e..f47a54d6a809e2 100644 --- a/src/mono/wasm/threads.md +++ b/src/mono/wasm/threads.md @@ -1,13 +1,19 @@ # Threaded runtime # -## Building ## +## Building the runtime ## -Build with `/p:WasmEnableThreads=true` to enable support for multi-threading. +Build the runtime with `/p:MonoWasmBuildVariant=multithread` to enable support for multi-threading. -Build with `/p:WasmEnablePerfTracing=true` to enable support for EventPipe diagnostics - this enabled threading, but only for "internal" utility threads. User code is not allowed to start threads. +Build with `/p:MonoWasmBuildVariant=perftrace` to enable support for EventPipe diagnostics - this enabled threading, but only for "internal" utility threads. User code is not allowed to start threads. Do not combine these options, just turn on one or the other. +## Building sample apps ## + +Sample apps use the "public" properties `WasmEnableThreads` and `WasmEnablePerfTracing` to enable +the relevant functionality. This also works with released versions of .NET 7 or later and the +`wasmbrowser` template. + ## Libraries feature defines ## We use the `FeatureWasmThreads` property in the libraries projects to conditionally define diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 5069285979c98a..b049dcfbabb055 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -16,8 +16,8 @@ - true - true + true + true false true