From af4402c672728f99692f98e7039d4c487e03d0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 18:44:17 +0200 Subject: [PATCH 001/101] Upgrade emsdk to 5.0.6 --- eng/Version.Details.props | 78 ++++----- eng/Version.Details.xml | 156 +++++++++--------- eng/Versions.props | 2 +- eng/common/SetupNugetSources.ps1 | 5 + eng/common/SetupNugetSources.sh | 5 + .../core-templates/job/helix-job-monitor.yml | 2 +- eng/common/core-templates/job/job.yml | 6 + .../steps/enable-internal-sources.yml | 24 +++ eng/common/cross/build-rootfs.sh | 10 +- .../native/LocateNativeCompiler.targets | 27 +++ eng/common/templates/job/job.yml | 5 - eng/common/templates/vmr-build-pr.yml | 2 +- eng/native/tryrun.browser.cmake | 4 +- global.json | 8 +- src/mono/browser/emscripten-version.txt | 2 +- src/mono/mono.proj | 2 +- 16 files changed, 202 insertions(+), 136 deletions(-) create mode 100644 eng/common/native/LocateNativeCompiler.targets diff --git a/eng/Version.Details.props b/eng/Version.Details.props index ae9bc9d9cb1a5f..a557b85a51f85a 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,46 +6,46 @@ This file should be imported by eng/Versions.props - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 0.11.5-preview.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 0.11.5-preview.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 3.2.2-beta.26257.113 - 2.9.3-beta.26302.118 - 11.0.0-beta.26302.118 - 5.9.0-1.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 11.0.0-preview.6.26302.118 - 3.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 + 2.9.3-beta.26311.101 + 11.0.0-beta.26311.101 + 5.9.0-1.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 11.0.0-preview.6.26311.101 + 3.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 11.0.0-alpha.0.26180.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1b7caa3bb024bc..330a6578080d21 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -37,91 +37,91 @@ https://github.com/dotnet/llvm-project 64a0a6a5130929ccaa47b52ad28997b7922920cc - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/dotnet 0eae08ed2f094f44e0151e4815e7cdd1a334fcdf - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/runtime-assets @@ -259,33 +259,33 @@ https://github.com/dotnet/llvm-project 64a0a6a5130929ccaa47b52ad28997b7922920cc - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/xharness @@ -299,9 +299,9 @@ https://github.com/dotnet/xharness fa7fbebf9168e8858971f9d0c71b2b08f2f7b106 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -327,33 +327,33 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -365,21 +365,21 @@ - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/node diff --git a/eng/Versions.props b/eng/Versions.props index 4625dbb9864ccb..c3817ef6345fda 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -172,7 +172,7 @@ $(MicrosoftNETCoreAppRefPackageVersion) $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) - 3.1.56 + 5.0.6 1.1.87-gba258badda 1.0.0-v3.14.0.5722 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index fc8d618014e0da..58002808bc841a 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -32,6 +32,11 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +# This script only consumes helper functions from tools.ps1 to configure NuGet feeds. +# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +$disableConfigureToolsetImport = $true + . $PSScriptRoot\tools.ps1 # Adds or enables the package source with the given name diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b97cc536379dfe..67e7e0942ca14e 100755 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -40,6 +40,11 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +# This script only consumes helper functions from tools.sh to configure NuGet feeds. +# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +disable_configure_toolset_import=1 + . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index 767450da2fcb03..a8162c51166735 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -170,7 +170,7 @@ jobs: toolArgs=( --helix-base-uri '${{ parameters.helixBaseUri }}' --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' - --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 2))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. + --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. --stage-name '$(System.StageName)' ) diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index 66c7988f222a65..cb60f5297844a4 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -75,6 +75,12 @@ jobs: variables: - name: AllowPtrToDetectTestRunRetryFiles value: true + # Component Governance detection and CodeQL are not run in the public project + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - name: skipComponentGovernanceDetection + value: true + - name: Codeql.SkipTaskAutoInjection + value: true - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 4085512b690910..51af9a017091ff 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -15,32 +15,56 @@ steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token env: Token: ${{ parameters.legacyCredential }} + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + targetType: inline + script: | + "$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token" + env: + Token: ${{ parameters.legacyCredential }} # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config - ${{ else }}: - template: /eng/common/templates/steps/get-federated-access-token.yml parameters: federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token) # This is required in certain scenarios to install the ADO credential provider. # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others # (e.g. dotnet msbuild). diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index f06854ccc1865e..273cae651a2b1e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -618,15 +618,15 @@ elif [[ "$__CodeName" == "openbsd" ]]; then [[ -z "$PKG_FILE" ]] && { echo "ERROR: Package $pkg not found"; exit 1; } if [[ "$__hasWget" == 1 ]]; then - wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - + wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - else - curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - + curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - fi done echo "Creating versionless symlinks for shared libraries..." # Find all versioned .so files and create the base .so symlink - for lib in "$__RootfsDir/usr/lib/libc++.so."* "$__RootfsDir/usr/lib/libc++abi.so."* "$__RootfsDir/usr/lib/libpthread.so."*; do + for lib in "$__RootfsDir"/usr/lib/lib*.so.*; do if [ -f "$lib" ]; then # Extract the filename (e.g., libc++.so.12.0) VERSIONED_NAME=$(basename "$lib") @@ -636,6 +636,10 @@ elif [[ "$__CodeName" == "openbsd" ]]; then ln -sf "$VERSIONED_NAME" "$__RootfsDir/usr/lib/$BASE_NAME" fi done + + echo "Cleaning up unnecessary paths" + # we don't use executables and kernel in rootfs (as we use host's compiler with -sysroot) + rm -rf "$__RootfsDir/usr/share" "$__RootfsDir/usr/bin" elif [[ "$__CodeName" == "illumos" ]]; then mkdir "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp" diff --git a/eng/common/native/LocateNativeCompiler.targets b/eng/common/native/LocateNativeCompiler.targets new file mode 100644 index 00000000000000..028b33d944416f --- /dev/null +++ b/eng/common/native/LocateNativeCompiler.targets @@ -0,0 +1,27 @@ + + + + + clang + $(ROOTFS_DIR) + + + + + + + + $(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';')))) + <_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1)))) + lld + + + diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 5e261f34db421b..85501406a541b6 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -21,11 +21,6 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} - # we don't run CG in public - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable - artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml index 2f3694fa13239e..d24de935248a68 100644 --- a/eng/common/templates/vmr-build-pr.yml +++ b/eng/common/templates/vmr-build-pr.yml @@ -33,7 +33,7 @@ resources: - repository: vmr type: github name: dotnet/dotnet - endpoint: dotnet + endpoint: public ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into stages: diff --git a/eng/native/tryrun.browser.cmake b/eng/native/tryrun.browser.cmake index ed8ac60a55a576..ecee89e501f7dd 100644 --- a/eng/native/tryrun.browser.cmake +++ b/eng/native/tryrun.browser.cmake @@ -6,7 +6,7 @@ # IMPORTANT: This file is specific to the Emscripten version and WebAssembly target. # # Valid for: -# - Emscripten version: 3.1.56 +# - Emscripten version: 5.0.6 # - Target: wasm32-unknown-emscripten (browser-wasm) # - Architecture: wasm32 # - OS: browser/Emscripten @@ -85,7 +85,7 @@ # mv eng/native/tryrun.browser.cmake.bak eng/native/tryrun.browser.cmake # Version tracking: This cache is valid for the following Emscripten version -set(TRYRUN_BROWSER_EMSCRIPTEN_VERSION "3.1.56" CACHE INTERNAL "Emscripten version this cache was generated for") +set(TRYRUN_BROWSER_EMSCRIPTEN_VERSION "5.0.6" CACHE INTERNAL "Emscripten version this cache was generated for") # Macro to set cache values (same as eng/native/tryrun.cmake) macro(set_cache_value) diff --git a/global.json b/global.json index 8d47900ffba1b7..8f6f1ee63b47d5 100644 --- a/global.json +++ b/global.json @@ -13,11 +13,11 @@ "dotnet": "11.0.100-preview.5.26227.104" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26302.118", - "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26302.118", - "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26302.118", + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26311.101", + "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26311.101", + "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26311.101", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26302.118" + "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26311.101" } } diff --git a/src/mono/browser/emscripten-version.txt b/src/mono/browser/emscripten-version.txt index 4a8bd23c1443d4..4d5e5283b97fb2 100644 --- a/src/mono/browser/emscripten-version.txt +++ b/src/mono/browser/emscripten-version.txt @@ -1 +1 @@ -3.1.56 \ No newline at end of file +5.0.6 \ No newline at end of file diff --git a/src/mono/mono.proj b/src/mono/mono.proj index c3844d6351437a..e936acfb2ce67f 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -757,7 +757,7 @@ <_PythonCmd Condition="'$(HostOS)' != 'windows'">python3 <_PythonCmd Condition="'$(HostOS)' == 'windows'">python - <_PythonCmd Condition="'$(HostOS)' == 'windows' and ('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true')">$([MSBuild]::NormalizePath('$(PkgMicrosoft_NET_Runtime_Emscripten_3_1_56_Python_win-x64)', 'tools', 'python.exe')) + <_PythonCmd Condition="'$(HostOS)' == 'windows' and ('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true')">$([MSBuild]::NormalizePath('$(PkgMicrosoft_NET_Runtime_Emscripten_5_0_6_Python_win-x64)', 'tools', 'python.exe')) From 64a07bfb6d47b5d125b016a5e72faa65cab00c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 18:50:07 +0200 Subject: [PATCH 002/101] Add general-testing feed --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 8d2d351914d014..d89fa51e4679ea 100644 --- a/NuGet.config +++ b/NuGet.config @@ -22,6 +22,7 @@ + From 5c431c3242f608042b0b48ba93d3ef79c2cea279 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 26 May 2026 14:05:56 +0200 Subject: [PATCH 003/101] rebase (cherry picked from commit ea0ec7c019dbf7ce2da317b285004a1232479407) --- src/mono/mono/mini/mini-llvm-cpp.cpp | 26 +++++++++++++------------- src/mono/mono/mini/mini-llvm-cpp.h | 4 ++-- src/mono/mono/mini/mini-llvm.c | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 80d99c341c6802..18db74f8da5e4f 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -308,12 +308,12 @@ mono_llvm_replace_uses_of (LLVMValueRef var, LLVMValueRef v) } LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len) +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len) { #if LLVM_API_VERSION >= 1600 - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), ArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), ArrayRef(data, len))); #else - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), makeArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), makeArrayRef(data, len))); #endif } @@ -514,7 +514,7 @@ mono_llvm_add_param_attr_with_type (LLVMValueRef param, AttrKind kind, LLVMTypeR switch (kind) { case LLVM_ATTR_STRUCT_RET: - func->addParamAttr (n, Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithStructRetType (func->getContext (), unwrap (type))); break; default: g_assert_not_reached (); @@ -526,7 +526,7 @@ mono_llvm_add_param_byval_attr (LLVMValueRef param, LLVMTypeRef type) { Function *func = unwrap (param)->getParent (); int n = unwrap (param)->getArgNo (); - func->addParamAttr (n, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithByValType (func->getContext (), unwrap (type))); } void @@ -542,7 +542,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, switch (kind) { case LLVM_ATTR_STRUCT_RET: - attr = Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)); + attr = Attribute::getWithStructRetType (unwrap (val)->getContext (), unwrap (type)); unwrap (val)->addParamAttr (index - 1, attr); break; default: @@ -553,7 +553,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, void mono_llvm_add_instr_byval_attr (LLVMValueRef val, int index, LLVMTypeRef type) { - unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (unwrap (val)->getContext (), unwrap (type))); } void* @@ -603,7 +603,7 @@ mono_llvm_di_create_file (void *di_builder, const char *dir, const char *file) void* mono_llvm_di_create_location (void *di_builder, void *scope, int row, int column) { - return DILocation::get (*unwrap(LLVMGetGlobalContext ()), row, column, (Metadata*)scope); + return DILocation::get (cast((Metadata*)scope)->getContext (), row, column, (Metadata*)scope); } void @@ -631,7 +631,7 @@ mono_llvm_di_builder_finalize (void *di_builder) LLVMValueRef mono_llvm_get_or_insert_gc_safepoint_poll (LLVMModuleRef module) { - llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(unwrap(LLVMVoidType()), false)); + llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(Type::getVoidTy(unwrap(module)->getContext()), false)); return wrap (dyn_cast (callee.getCallee ())); } @@ -725,7 +725,7 @@ mono_llvm_register_intrinsic (LLVMModuleRef module, IntrinsicId id, LLVMTypeRef outs () << id << "\n"; g_assert_not_reached (); } - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id); + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id); *out_type = wrap (type); return wrap (f); } else { @@ -749,7 +749,7 @@ mono_llvm_register_overloaded_intrinsic (LLVMModuleRef module, IntrinsicId id, L for (int i = 0; i < ntypes; ++i) arr [i] = unwrap (types [i]); auto f = Intrinsic::getDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id, { arr, (size_t)ntypes }); + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id, { arr, (size_t)ntypes }); *out_type = wrap (type); return wrap (f); } @@ -784,8 +784,8 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, } LLVMTypeRef -mono_llvm_get_ptr_type (void) +mono_llvm_get_ptr_type (LLVMContextRef ctx) { - PointerType *t = PointerType::get (*unwrap (LLVMGetGlobalContext ()), 0); + PointerType *t = PointerType::get (*unwrap (ctx), 0); return wrap (t); } diff --git a/src/mono/mono/mini/mini-llvm-cpp.h b/src/mono/mono/mini/mini-llvm-cpp.h index 9f40accf3043ac..7882ee1ce8ce52 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.h +++ b/src/mono/mono/mini/mini-llvm-cpp.h @@ -111,7 +111,7 @@ void mono_llvm_set_must_tailcall (LLVMValueRef call_ins); LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len); +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len); void mono_llvm_set_is_constant (LLVMValueRef global_var); @@ -234,7 +234,7 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, const char *name); LLVMTypeRef -mono_llvm_get_ptr_type (void); +mono_llvm_get_ptr_type (LLVMContextRef ctx); G_END_DECLS diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index f310f7364f5d88..0fad7c29a9c4c4 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -8075,7 +8075,7 @@ MONO_RESTORE_WARNING LLVMValueRef info_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), 8), "@OBJC_IMAGE_INFO"); int32_t objc_imageinfo [] = { 0, 0 }; - LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array ((uint8_t *) &objc_imageinfo, 8)); + LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array (ctx->module->context, (uint8_t *) &objc_imageinfo, 8)); LLVMSetLinkage (info_var, LLVMPrivateLinkage); LLVMSetExternallyInitialized (info_var, TRUE); LLVMSetSection (info_var, "__DATA, __objc_imageinfo,regular,no_dead_strip"); @@ -8091,7 +8091,7 @@ MONO_RESTORE_WARNING LLVMTypeRef name_var_type = LLVMArrayType (LLVMInt8Type (), (unsigned int)(strlen (name) + 1)); LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, name_var_type, "@OBJC_METH_VAR_NAME_"); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, (int)(strlen (name) + 1))); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (const uint8_t*)name, (int)(strlen (name) + 1))); LLVMSetLinkage (name_var, LLVMPrivateLinkage); LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals"); mark_as_used (ctx->module, name_var); @@ -13619,7 +13619,7 @@ emit_method_inner (EmitContext *ctx) LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, type, "missing_method_name"); LLVMSetVisibility (name_var, LLVMHiddenVisibility); LLVMSetLinkage (name_var, LLVMInternalLinkage); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((guint8*)name, len + 1)); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (guint8*)name, len + 1)); mono_llvm_set_is_constant (name_var); g_free (name); @@ -14058,7 +14058,7 @@ add_types (MonoLLVMModule *module) void mono_llvm_init (gboolean enable_jit) { - ptr_t = mono_llvm_get_ptr_type (); + ptr_t = mono_llvm_get_ptr_type (LLVMGetGlobalContext ()); intrin_types [0][0] = i1_t = LLVMInt8Type (); intrin_types [0][1] = i2_t = LLVMInt16Type (); @@ -14469,7 +14469,7 @@ mono_llvm_emit_aot_data_aligned (const char *symbol, guint8 *data, int data_len, d = LLVMAddGlobal (module->lmodule, type, symbol); LLVMSetVisibility (d, LLVMHiddenVisibility); LLVMSetLinkage (d, LLVMInternalLinkage); - LLVMSetInitializer (d, mono_llvm_create_constant_data_array (data, data_len)); + LLVMSetInitializer (d, mono_llvm_create_constant_data_array (module->context, data, data_len)); if (align != 1) LLVMSetAlignment (d, align); mono_llvm_set_is_constant (d); @@ -14911,7 +14911,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name) LLVMDeleteGlobal (cfg->llvm_dummy_info_var); } else { // FIXME: How can this happen ? - LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (NULL, 0)); + LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (module->context, NULL, 0)); } } } From 1cc4928b5e5c45640ae2c2fbc1d5c1ddd4619db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 19:41:07 +0200 Subject: [PATCH 004/101] Remove lbulkmemory --- eng/native/configureplatform.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 5626751cd9c885..e45fd26203320c 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -507,7 +507,6 @@ else() add_link_options(-Wl,--error-limit=0) add_link_options(-nostdlib) - add_link_options(-lbulkmemory) add_link_options(-lstubs) add_link_options(-lc) add_link_options(-lmalloc) From f0619f9e876b7290e390e536627033bfa9633872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 19:42:16 +0200 Subject: [PATCH 005/101] Update to llvm 23.x --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index a557b85a51f85a..468c756144805f 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 330a6578080d21..d89a3b753fa61d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b https://github.com/dotnet/dotnet From ea8bd080d6679e7f186775166d34d5eea6796ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 20:17:02 +0200 Subject: [PATCH 006/101] Fix llvm version check in src/mono/CMakeLists.txt --- src/mono/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 4ef4acb0eee17d..0fc53433128438 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -637,21 +637,21 @@ if(LLVM_PREFIX) string(REGEX REPLACE ".*MONO_API_VERSION ([0-9]+)" "\\1" llvm_api_version ${llvm_api_version_line}) # IMPORTANT: when bumping LLVM make sure to rerun the llvm-config commands below and update the variables accordingly - if (NOT ${llvm_api_version} EQUAL 1900) + if (NOT ${llvm_api_version} EQUAL 2300) message(FATAL_ERROR "Unexpected LLVM version: ${llvm_api_version}.") endif() # llvm-config --libs analysis core bitwriter mcjit orcjit - set(MONO_llvm_core_libs "LLVMOrcJIT" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendOffloading" "LLVMCodeGen" "LLVMScalarOpts" "LLVMInstCombine" "LLVMObjCARCOpts" "LLVMCodeGenTypes" "LLVMCFGuard" "LLVMAggressiveInstCombine" "LLVMTransformUtils" "LLVMWindowsDriver" "LLVMJITLink" "LLVMOption" "LLVMMCJIT" "LLVMExecutionEngine" "LLVMTarget" "LLVMRuntimeDyld" "LLVMOrcTargetProcess" "LLVMOrcShared" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_core_libs "LLVMOrcJIT" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCodeGen" "LLVMScalarOpts" "LLVMInstCombine" "LLVMObjCARCOpts" "LLVMCodeGenTypes" "LLVMCGData" "LLVMCFGuard" "LLVMAggressiveInstCombine" "LLVMTransformUtils" "LLVMWindowsDriver" "LLVMJITLink" "LLVMOption" "LLVMMCJIT" "LLVMExecutionEngine" "LLVMTarget" "LLVMRuntimeDyld" "LLVMOrcTargetProcess" "LLVMOrcShared" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs x86codegen - set(MONO_llvm_extra_libs_x86codegen "LLVMX86CodeGen" "LLVMX86Desc" "LLVMX86Info" "LLVMMCDisassembler" "LLVMInstrumentation" "LLVMIRPrinter" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCodeGenTypes" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_x86codegen "LLVMX86CodeGen" "LLVMX86Desc" "LLVMX86Info" "LLVMMCDisassembler" "LLVMInstrumentation" "LLVMIRPrinter" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCodeGenTypes" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs armcodegen - set(MONO_llvm_extra_libs_armcodegen "LLVMARMCodeGen" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendOffloading" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMARMDesc" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMMCDisassembler" "LLVMCodeGenTypes" "LLVMARMUtils" "LLVMARMInfo" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_armcodegen "LLVMARMCodeGen" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMFrontendHLSL" "LLVMARMDesc" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMMCDisassembler" "LLVMCodeGenTypes" "LLVMARMUtils" "LLVMARMInfo" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs aarch64codegen - set(MONO_llvm_extra_libs_aarch64codegen "LLVMAArch64CodeGen" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMAArch64Desc" "LLVMCodeGenTypes" "LLVMAArch64Utils" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMAArch64Info" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_aarch64codegen "LLVMAArch64CodeGen" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMAArch64Desc" "LLVMCodeGenTypes" "LLVMAArch64Utils" "LLVMAArch64Info" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") if(HOST_LINUX AND NOT HOST_WASM AND NOT HOST_WASI) set(MONO_stdlib "-nostdinc++ -nostdlib++") From 813760c2b13eb0b3cdfc5aa3125af71ba3b40ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 01:20:54 +0200 Subject: [PATCH 007/101] Fix llvm warnings/errors --- src/mono/mono/mini/mini-llvm-cpp.cpp | 8 ++++++++ src/mono/mono/mini/mini-llvm.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 18db74f8da5e4f..a01db4d29a29fe 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -720,7 +720,11 @@ mono_llvm_register_intrinsic (LLVMModuleRef module, IntrinsicId id, LLVMTypeRef auto intrins_id = get_intrins_id (id); if (intrins_id != not_intrinsic) { +#if LLVM_API_VERSION >= 2100 + Function *f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id); +#else Function *f = Intrinsic::getDeclaration (unwrap (module), intrins_id); +#endif if (!f) { outs () << id << "\n"; g_assert_not_reached (); @@ -748,7 +752,11 @@ mono_llvm_register_overloaded_intrinsic (LLVMModuleRef module, IntrinsicId id, L Type *arr [max_types]; for (int i = 0; i < ntypes; ++i) arr [i] = unwrap (types [i]); +#if LLVM_API_VERSION >= 2100 + auto f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); +#else auto f = Intrinsic::getDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); +#endif auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id, { arr, (size_t)ntypes }); *out_type = wrap (type); return wrap (f); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 0fad7c29a9c4c4..b8ca295a11b144 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -30,6 +30,16 @@ #define __STDC_CONSTANT_MACROS #endif +// Mono's LLVM backend uses the global-context LLVM-C type accessors (LLVMInt32Type, etc.) +// pervasively. These are deprecated in newer LLVM versions in favor of the *InContext variants. +// Suppress the deprecation warnings rather than threading an LLVMContextRef through every call site. +#if defined(__clang__) || defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + #include "llvm-c/Core.h" #include "llvm-c/BitWriter.h" #include "llvm-c/Analysis.h" From b6e6b73d3b28581212fe92767446275483db7da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 12:57:43 +0200 Subject: [PATCH 008/101] Don't mark Browser as LowTemporalResolution anymore --- .../tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index d1205dc6ba7148..6cbe1a949ca607 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -19,7 +19,7 @@ public abstract class BaseGetSetTimes : FileSystemTest protected static bool isHFS => driveFormat != null && driveFormat.Equals(HFS, StringComparison.InvariantCultureIgnoreCase); - protected static bool LowTemporalResolution => PlatformDetection.IsBrowser || isHFS; + protected static bool LowTemporalResolution => isHFS; protected static bool HighTemporalResolution => !LowTemporalResolution; private static void CheckHighTemporalResolution() From 4113f8e52586234464f2d00d6846d62c13eb3453 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:20 +0200 Subject: [PATCH 009/101] don't node flush streams in a browser --- src/mono/browser/runtime/loader/exit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index b57d06b993cc48..bfddfbf3f29097 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -204,6 +204,7 @@ function set_exit_code_and_quit_now (exit_code: number, reason?: any): void { } async function flush_node_streams () { + if (!ENVIRONMENT_IS_NODE) return; try { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: From fa8db40e4e2a6f9f2544d9f632a4086584bf9daa Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:56 +0200 Subject: [PATCH 010/101] export memory from Module --- eng/native.wasm.targets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index 8b86ba9b2df243..a34f0bce2fea24 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -55,6 +55,16 @@ + + + + + + + + + + From 89d50f1128d4f2aa174beb14d06a5ef9da52badf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 19:25:39 +0200 Subject: [PATCH 011/101] [mono][llvm] Fix sign-extension bug in const_int8/const_int32 When passing a negative C int to LLVMConstInt, the value is implicitly converted to unsigned long long via sign-extension. In LLVM 23, LLVMConstInt now retains those upper bits when SignExtend is FALSE, which broke constant folding of subsequent ZExt instructions (e.g. 'zext i32 -1 to i64' produced i64 -1 instead of i64 4294967295). This manifested as wrong results for decimal arithmetic in mono+LLVM AOT, e.g. the inlined Decimal..ctor(uint) with a constant argument sign-extending to _lo64. Many CoreLib tests (System.Tests.DecimalTests, System.Text.Tests.RuneTests, Vector128.NarrowWithSaturation*) were failing as a result. Mask the value to the destination width before passing to LLVMConstInt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/mono/mono/mini/mini-llvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index b8ca295a11b144..a14802d61b2545 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -568,13 +568,19 @@ const_int1 (int v) static LLVMValueRef const_int8 (int v) { - return LLVMConstInt (LLVMInt8Type (), v, FALSE); + /* Mask to 8 bits so a negative int is not implicitly sign-extended via + * the (unsigned long long) parameter conversion. Starting with LLVM 23, + * LLVMConstInt retains the upper bits when SignExtend is FALSE, which + * caused constant folding of subsequent ZExt to produce wrong results + * (e.g. zext i8 -1 to i64 yielding -1 instead of 255). */ + return LLVMConstInt (LLVMInt8Type (), (guint8)v, FALSE); } static LLVMValueRef const_int32 (int v) { - return LLVMConstInt (LLVMInt32Type (), v, FALSE); + /* See const_int8 for why we mask. */ + return LLVMConstInt (LLVMInt32Type (), (guint32)v, FALSE); } static LLVMValueRef From 64eaad9ed0110015f3c61739516bf42034cf3bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 20:05:31 +0200 Subject: [PATCH 012/101] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 468c756144805f..8c72d7b5dee5cf 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d89a3b753fa61d..70ab1de18ed779 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 https://github.com/dotnet/dotnet From 3bcf4d0407494dab5c17593ce9d8b2449e26f296 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:50:02 +0200 Subject: [PATCH 013/101] balance clearTimeout --- src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts | 1 + src/mono/browser/runtime/scheduling.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts index d0d503db4d5ceb..d11c2834828368 100644 --- a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts +++ b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts @@ -23,6 +23,7 @@ export function collectGcDump (options?:DiagnosticCommandOptions):Promise { stopSent = true; diff --git a/src/mono/browser/runtime/scheduling.ts b/src/mono/browser/runtime/scheduling.ts index 93dde2a5525281..1a374630d3d18e 100644 --- a/src/mono/browser/runtime/scheduling.ts +++ b/src/mono/browser/runtime/scheduling.ts @@ -70,18 +70,19 @@ export function SystemJS_ScheduleTimerImpl (shortestDueTimeMs: number): void { if (lastScheduledTimeoutId) { globalThis.clearTimeout(lastScheduledTimeoutId); lastScheduledTimeoutId = undefined; + Module.runtimeKeepalivePop(); } lastScheduledTimeoutId = Module.safeSetTimeout(mono_wasm_schedule_timer_tick, shortestDueTimeMs); } function mono_wasm_schedule_timer_tick () { if (WasmEnableThreads) return; + lastScheduledTimeoutId = undefined; Module.maybeExit(); forceThreadMemoryViewRefresh(); if (!loaderHelpers.is_runtime_running()) { return; } - lastScheduledTimeoutId = undefined; try { cwraps.mono_wasm_execute_timer(); } catch (ex) { From 0dab167d17a670eac27902b56db8af048ad4df6c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:22:52 +0200 Subject: [PATCH 014/101] balance runtimeKeepalivePop --- src/mono/browser/runtime/startup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index c086c6b7c4bb6e..8f0887c90ef81a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -291,7 +291,6 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { - Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From 5ad201d14a0a9d809056e05e71063ffdc127b509 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 19:53:10 +0200 Subject: [PATCH 015/101] WASM_BIGINT=0 for node testing --- src/coreclr/hosts/corerun/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 93909d44fe034c..23c950a564ef83 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -97,11 +97,6 @@ else() -Wl,--error-limit=0) if (CORERUN_IN_BROWSER) - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=1) - # Include the virtual file system data for the # browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") @@ -110,6 +105,10 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() + # Node.js doesn't have good support for WASM_BIGINT + # so it only is added when running in the browser. + target_link_options(corerun PRIVATE + -sWASM_BIGINT=0) # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE From 8c992afea874db6cc7479eec0853d36775beab8c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:09:14 +0200 Subject: [PATCH 016/101] fix WasmEnableExceptionHandling=false --- src/mono/browser/build/BrowserWasmApp.targets | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index ea0b33bb83ebeb..7fc58f51f13d0d 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -38,7 +38,8 @@ <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions - <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128 + + <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm @@ -178,6 +179,10 @@ <_EmccCommonFlags Include="$(EmccFlags)" /> <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> + + <_EmccCommonFlags Include="-fexceptions" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> From 273e1e18bca92954c54d6f1ac7812a69ff0fffdf Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:09:32 +0200 Subject: [PATCH 017/101] improve sample --- .../sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj index 815953ebc35a40..365a61629523a8 100644 --- a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj +++ b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj @@ -8,6 +8,8 @@ true true web,worker + false + <_WasmAllowAOTDebug>true -s USE_CLOSURE_COMPILER=1 -s LEGACY_GL_EMULATION=1 -lGL -lSDL -lidbfs.js From 95feacdb34ce7a44fbf62c13faf7ee7f784de8fa Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:52:52 +0200 Subject: [PATCH 018/101] Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one --- eng/native/configureplatform.cmake | 2 ++ src/mono/browser/build/BrowserWasmApp.targets | 5 ++++- src/mono/mono/mini/CMakeLists.txt | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index e45fd26203320c..163b68190894ae 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -503,6 +503,7 @@ else() if(CLR_CMAKE_RUNTIME_CORECLR) if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD) add_link_options(-fwasm-exceptions) + add_link_options(-sWASM_LEGACY_EXCEPTIONS=0) add_link_options(-Wno-unused-command-line-argument) add_link_options(-Wl,--error-limit=0) @@ -516,6 +517,7 @@ else() add_link_options(-lunwind) add_compile_options(-fwasm-exceptions) + add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0) add_compile_options(-mbulk-memory) add_compile_options(-msimd128) endif() diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 7fc58f51f13d0d..40d9c07a5340a5 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -37,7 +37,8 @@ emcc <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions - <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions + + <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=0 <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 @@ -185,6 +186,8 @@ <_EmccCommonFlags Include="-fexceptions" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> + + <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=0" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 23b8d15bf708f1..57e3786f9f1cf8 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -474,10 +474,12 @@ if(HOST_BROWSER) set_target_properties(mono-wasm-eh-js PROPERTIES LINK_FLAGS "-fexceptions") install(TARGETS mono-wasm-eh-js LIBRARY) + # Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one. + # WASM_LEGACY_EXCEPTIONS is a [compile+link] setting, so it must be set on both. add_library(mono-wasm-eh-wasm STATIC llvm-runtime.cpp) target_link_libraries (mono-wasm-eh-wasm PRIVATE monoapi eglib_api) - set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions") - set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions") + set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0") + set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0") install(TARGETS mono-wasm-eh-wasm LIBRARY) endif() From a374f19e018e474c240bb71c18a3edc0954b491d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 23:06:59 +0200 Subject: [PATCH 019/101] Refine comments regarding millisecond granularity support Updated comments to clarify that OSX HFS driver format does not support millisecond granularity. --- .../tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 6cbe1a949ca607..0cc91d011a301e 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -83,7 +83,6 @@ private void SettingUpdatesPropertiesCore(T item, T? linkTarget = default) bool isLink = linkTarget is not null; // Checking that milliseconds are not dropped after setter. - // Emscripten drops milliseconds in Browser DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, function.Kind); function.Setter(item, dt); @@ -245,7 +244,7 @@ public void CanGetAllTimesAfterCreation() ValidateSetTimes(item, beforeTime, afterTime); } - [ConditionalFact] // OSX HFS driver format and Browser platform do not support millisec granularity + [ConditionalFact] // OSX HFS driver format does not support millisec granularity public void TimesIncludeMillisecondPart() { CheckHighTemporalResolution(); @@ -283,7 +282,7 @@ public void TimesIncludeMillisecondPart_LowTempRes() { CheckLowTemporalResolution(); T item = GetExistingItem(); - // OSX HFS driver format and Browser do not support millisec granularity + // OSX HFS driver format does not support millisec granularity Assert.All(TimeFunctions(), (function) => { DateTime time = function.Getter(item); From 696eb47643b0e9664d17b9832d241d9c2222b1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 11:37:36 +0200 Subject: [PATCH 020/101] [mono][llvm] Fix sign-extension bug in emit_div_check and il_state init LLVMConstInt(IntTy, N, FALSE) requires N to fit in IntTy's unsigned width (i.e. no bits set beyond IntTy's bit count). Passing -1 (= 0xFF..FF as unsigned long long) to a sub-64-bit type violates this. Under LLVM 23 the resulting constant is wrong, which in emit_div_check caused the rhs == -1 comparison to constant-fold to false and the OverflowException check for INT_MIN / -1 and INT_MIN % -1 to be eliminated by the optimizer. Use LLVMConstAllOnes() which is the LLVM C API's idiomatic way to build an all-ones constant of any integer width, sidestepping the issue. Also fix the same pattern in emit_entry_bb where il_state->il_offset is initialized to -1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/mono/mono/mini/mini-llvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index a14802d61b2545..082c7fb219fda3 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -3826,7 +3826,7 @@ emit_div_check (EmitContext *ctx, LLVMBuilderRef builder, MonoBasicBlock *bb, Mo /* b == -1 && a == 0x80000000 */ if (is_signed) { LLVMValueRef c = (LLVMTypeOf (lhs) == LLVMInt32Type ()) ? LLVMConstInt (LLVMTypeOf (lhs), 0x80000000, FALSE) : LLVMConstInt (LLVMTypeOf (lhs), 0x8000000000000000LL, FALSE); - LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstInt (LLVMTypeOf (rhs), -1, FALSE), ""); + LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstAllOnes (LLVMTypeOf (rhs)), ""); LLVMValueRef cond2 = LLVMBuildICmp (builder, LLVMIntEQ, lhs, c, ""); cmp = LLVMBuildICmp (builder, LLVMIntEQ, LLVMBuildAnd (builder, cond1, cond2, ""), LLVMConstInt (LLVMInt1Type (), 1, FALSE), ""); @@ -4369,7 +4369,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder) index [0] = const_int32 (0); index [1] = const_int32 (1); addr = LLVMBuildGEP2 (builder, il_state_type, ctx->il_state, index, 2, ""); - LLVMBuildStore (ctx->builder, LLVMConstInt (types [1], -1, FALSE), addr); + LLVMBuildStore (ctx->builder, LLVMConstAllOnes (types [1]), addr); /* * Set il_state->data [i] to either the address of the arg/local, or NULL. From 938a82e2ac966ec8ae89d81867a593d3e324d03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 16:35:06 +0200 Subject: [PATCH 021/101] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8c72d7b5dee5cf..ee4c00f01cdcb7 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 70ab1de18ed779..e288e7d47e54ec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 https://github.com/dotnet/dotnet From 53a6d163992d4d016677b73e4f6561b274d6ce5a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:50:49 +0200 Subject: [PATCH 022/101] disable WASM_BIGINT for corerun - NodeJS --- docs/workflow/building/coreclr/wasm.md | 3 ++- eng/native.wasm.targets | 5 +++-- src/coreclr/runtime.proj | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/workflow/building/coreclr/wasm.md b/docs/workflow/building/coreclr/wasm.md index b2de062d88b066..99dd2911483441 100644 --- a/docs/workflow/building/coreclr/wasm.md +++ b/docs/workflow/building/coreclr/wasm.md @@ -146,7 +146,8 @@ In config below please replace `/path/to/runtime/` by a **absolute unix path** t "/**" ], "runtimeArgs": [ - "--stack-trace-limit=1000" + "--stack-trace-limit=10000", + "--experimental-wasm-exnref" ], "args": [ "HelloWorld.dll" diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a34f0bce2fea24..d40145458ecd7c 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,8 +63,9 @@ - - + + + diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 2c968913b26f4c..a0a11f404243b1 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,17 @@ - + + + + + <_WasmDisableBigInt>true + + + From 6860d5c333e189f5b8dd3ade2ae35e940f06f90a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:59:26 +0200 Subject: [PATCH 023/101] for nodejs: --experimental-wasm-exnref for wasm-opt: --enable-reference-types --enable-multivalue for runtime default build: new instructions -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 for no-EH runtime:-fexceptions JS exceptions --- eng/testing/WasmRunnerTemplate.cmd | 2 +- eng/testing/WasmRunnerTemplate.sh | 2 +- src/mono/browser/browser.proj | 10 ++++++++++ src/mono/browser/runtime/CMakeLists.txt | 4 ++-- .../wasm/console-node/Wasm.Console.Node.Sample.csproj | 2 +- .../wasm/console-v8/Wasm.Console.V8.Sample.csproj | 2 +- src/mono/sample/wasm/wasm.mk | 6 +++--- src/mono/wasm/build/WasmApp.Common.targets | 4 ++-- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/eng/testing/WasmRunnerTemplate.cmd b/eng/testing/WasmRunnerTemplate.cmd index 463883384bde3d..0e8b6c9406ee29 100644 --- a/eng/testing/WasmRunnerTemplate.cmd +++ b/eng/testing/WasmRunnerTemplate.cmd @@ -47,7 +47,7 @@ if /I [%XHARNESS_COMMAND%] == [test] ( ) if [%JS_ENGINE_ARGS%] == [] ( - set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000" + set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000 --engine-arg^=--experimental-wasm-exnref" ) ) else ( if /I [%SCENARIO%] == [WasmTestOnChrome] ( diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh index dc9339e1acdd62..91fcc162f4fbf4 100644 --- a/eng/testing/WasmRunnerTemplate.sh +++ b/eng/testing/WasmRunnerTemplate.sh @@ -44,7 +44,7 @@ if [[ "$XHARNESS_COMMAND" == "test" ]]; then fi if [[ -z "$JS_ENGINE_ARGS" ]]; then - JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000" + JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref" fi else if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index b9f72ca324b0fd..50ccb7a426aa63 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -321,6 +321,10 @@ -g -Os -DDEBUG=1 -Oz + + $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationEmccFlags) -fexceptions $(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 -O2 @@ -330,6 +334,9 @@ $(CMakeConfigurationLinkFlags) -msimd128 $(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth $(CMakeConfigurationLinkFlags) --emit-symbol-map + + $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationLinkFlags) -fexceptions -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))" @@ -344,6 +351,9 @@ $(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/').Replace('\','/'))" $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd" $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_INTERPSIMDTABLES_LIB="nosimd" + + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EH_LIB="eh-wasm" + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EH_LIB="eh-js" $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0 $(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1 $(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath) diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt index 788707244c11bd..a133f625d40f89 100644 --- a/src/mono/browser/runtime/CMakeLists.txt +++ b/src/mono/browser/runtime/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries(dotnet.native ${MONO_ARTIFACTS_DIR}/libmono-ee-interp.a ${MONO_ARTIFACTS_DIR}/libmonosgen-2.0.a ${MONO_ARTIFACTS_DIR}/libmono-icall-table.a - ${MONO_ARTIFACTS_DIR}/libmono-wasm-eh-js.a + ${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_EH_LIB}.a ${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_INTERPSIMDTABLES_LIB}.a ${NATIVE_BIN_DIR}/libSystem.Native.a ${NATIVE_BIN_DIR}/libSystem.Native.TimeZoneData.a @@ -44,7 +44,7 @@ set(ignoreMeEmsdkPath "${EMSDK_PATH}") if(CMAKE_BUILD_TYPE STREQUAL "Release") add_custom_command(TARGET dotnet.native - POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm + POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling --enable-reference-types --enable-multivalue --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm COMMENT "Stripping debug symbols from dotnet.native.wasm using wasm-opt") endif() diff --git a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj index 5e9ae0d965fe6f..65301b3087520a 100644 --- a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj +++ b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj @@ -6,7 +6,7 @@ true 2 - $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode) + $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode) diff --git a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj index cbd591be53286b..dfc937e8569bea 100644 --- a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj +++ b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj @@ -5,7 +5,7 @@ true true - $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) + $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index 22db9a0d89fa9e..658d77ead989b4 100644 --- a/src/mono/sample/wasm/wasm.mk +++ b/src/mono/sample/wasm/wasm.mk @@ -42,10 +42,10 @@ run-browser: fi run-console: - cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --single-threaded $(MAIN_JS) -- $(ARGS) + cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) -- $(ARGS) run-console-node: - cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS) + cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS) debug-console-node: - cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS) \ No newline at end of file + cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS) \ No newline at end of file diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets index 86c53bcec5609c..a8e6211aab2741 100644 --- a/src/mono/wasm/build/WasmApp.Common.targets +++ b/src/mono/wasm/build/WasmApp.Common.targets @@ -930,8 +930,8 @@ <_WasmOptPostLinkFileName Condition="'$([System.IO.Path]::IsPathRooted($(_WasmOptPostLinkFileName)))' != 'true'">$([System.IO.Path]::Combine($(_WasmIntermediateOutputPath), $(_WasmOptPostLinkFileName))) - - + From d38a699fe740789d2bcd81f64129086532c973c7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 21:00:25 +0200 Subject: [PATCH 024/101] - change wasm exception instructions detection - change jiterp to use new wasm exception instructions --- .../browser/runtime/jiterpreter-jit-call.ts | 31 ++++++++++++------- .../browser/runtime/jiterpreter-opcodes.ts | 7 ++--- .../browser/runtime/jiterpreter-support.ts | 15 ++++++++- src/mono/browser/runtime/loader/globals.ts | 4 +-- src/mono/browser/runtime/startup.ts | 6 ++-- src/mono/browser/runtime/types/internal.ts | 4 +-- 6 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-jit-call.ts b/src/mono/browser/runtime/jiterpreter-jit-call.ts index 3175cc5a758e5a..cbb50e23118633 100644 --- a/src/mono/browser/runtime/jiterpreter-jit-call.ts +++ b/src/mono/browser/runtime/jiterpreter-jit-call.ts @@ -333,11 +333,11 @@ export function mono_interp_flush_jitcall_queue (): void { return; } - if (builder.options.enableWasmEh) { - if (!runtimeHelpers.featureWasmEh) { + if (builder.options.enableWasmFinalEh) { + if (!runtimeHelpers.featureWasmFinalEh) { // The user requested to enable wasm EH but it's not supported, so turn the option back off - applyOptions({ enableWasmEh: false }); - builder.options.enableWasmEh = false; + applyOptions({ enableWasmFinalEh: false }); + builder.options.enableWasmFinalEh = false; } } @@ -639,10 +639,14 @@ function generate_wasm_body ( ): boolean { let stack_index = 0; - // If wasm EH is enabled we will perform the call inside a catch-all block and set a flag - // if it throws any exception - if (builder.options.enableWasmEh) - builder.block(WasmValtype.void, WasmOpcode.try_); + // If wasm EH is enabled we perform the call inside a try_table (standardized exnref proposal) + // and set a flag if it throws a C++ exception. Structure: + // (block $outer (block $catch (result i32) (try_table (catch __cpp_exception $catch) ) br $outer) ) + if (builder.options.enableWasmFinalEh) { + builder.block(WasmValtype.void); // $outer + builder.block(WasmValtype.i32); // $catch - receives the exception pointer + builder.tryTable(WasmValtype.void, "__cpp_exception", 1); // catch __cpp_exception -> $catch + } // Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef // Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx @@ -779,9 +783,12 @@ function generate_wasm_body ( } // If the call threw a JS or wasm exception, set the thrown flag - if (builder.options.enableWasmEh) { - builder.appendU8(WasmOpcode.catch_); - builder.appendULeb(builder.getTypeIndex("__cpp_exception")); + if (builder.options.enableWasmFinalEh) { + builder.endBlock(); // end try_table + // Normal completion (no exception): skip the handler by branching out to $outer + builder.appendU8(WasmOpcode.br); + builder.appendULeb(1); + builder.endBlock(); // end $catch - reached only when caught, stack: [exception ptr] builder.callImport("begin_catch"); builder.callImport("end_catch"); builder.local("thrown"); @@ -789,7 +796,7 @@ function generate_wasm_body ( builder.appendU8(WasmOpcode.i32_store); builder.appendMemarg(0, 2); - builder.endBlock(); + builder.endBlock(); // end $outer } builder.appendU8(WasmOpcode.return_); diff --git a/src/mono/browser/runtime/jiterpreter-opcodes.ts b/src/mono/browser/runtime/jiterpreter-opcodes.ts index 4d3ab5c3930f1c..27303091de9d07 100644 --- a/src/mono/browser/runtime/jiterpreter-opcodes.ts +++ b/src/mono/browser/runtime/jiterpreter-opcodes.ts @@ -81,11 +81,8 @@ export const enum WasmOpcode { if_, else_, - try_ = 0x06, - catch_, - catch_all = 0x19, - throw_ = 0x08, - rethrow_ = 0x09, + throw_ref = 0x0a, + try_table = 0x1f, end = 0x0b, br, diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 3235406cae7894..2eda8267ca12e0 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -856,6 +856,19 @@ export class WasmBuilder { this.appendU8(WasmOpcode.end); } + // Emits a try_table block (standardized exnref EH proposal) with a single + // 'catch -> label' clause. On catch, the tag's parameters are pushed and control + // branches out by catchLabelDepth levels. Must be closed with endBlock(). + tryTable (type: WasmValtype, catchTagTypeName: string, catchLabelDepth: number) { + this.appendU8(WasmOpcode.try_table); + this.appendU8(type); + this.appendULeb(1); // one catch clause + this.appendU8(0x00); // 0x00 = catch (tag): push tag params, then branch + this.appendULeb(this.getTypeIndex(catchTagTypeName)); + this.appendULeb(catchLabelDepth); + this.activeBlocks++; + } + arg (name: string | number, opcode?: WasmOpcode) { const index = typeof (name) === "string" ? (this.locals.has(name) ? this.locals.get(name)! : undefined) @@ -1969,7 +1982,7 @@ export type JiterpreterOptions = { enableJitCall: boolean; enableBackwardBranches: boolean; enableCallResume: boolean; - enableWasmEh: boolean; + enableWasmFinalEh: boolean; enableSimd: boolean; enableAtomics: boolean; zeroPageOptimization: boolean; diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 98f6dfd30bf24c..379f9e99f40de6 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -6,7 +6,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; -import { exceptions, simd, relaxedSimd } from "wasm-feature-detect"; +import { simd, relaxedSimd, exceptionsFinal } from "wasm-feature-detect"; import gitHash from "consts:gitHash"; @@ -131,7 +131,7 @@ export function setLoaderGlobals ( isDebuggingSupported, // from wasm-feature-detect npm package - exceptions, + exceptionsFinal, simd, relaxedSimd }; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 8f0887c90ef81a..6a43fbf78e52e4 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -83,7 +83,7 @@ export function configureEmscriptenStartup (module: DotnetModuleInternal): void mono_assert(runtimeHelpers.featureWasmSimd, "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); } if (runtimeHelpers.emscriptenBuildOptions.wasmEnableEH) { - mono_assert(runtimeHelpers.featureWasmEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); + mono_assert(runtimeHelpers.featureWasmFinalEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); } module.mainScriptUrlOrBlob = loaderHelpers.scriptUrl;// this is needed by worker threads @@ -419,10 +419,10 @@ async function instantiate_wasm_module ( async function ensureUsedWasmFeatures () { const simd = loaderHelpers.simd(); const relaxedSimd = loaderHelpers.relaxedSimd(); - const exceptions = loaderHelpers.exceptions(); + const exceptions = loaderHelpers.exceptionsFinal(); runtimeHelpers.featureWasmSimd = await simd; runtimeHelpers.featureWasmRelaxedSimd = await relaxedSimd; - runtimeHelpers.featureWasmEh = await exceptions; + runtimeHelpers.featureWasmFinalEh = await exceptions; } export async function start_runtime () { diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index 5412d6292ec6ad..e8af600df33e8f 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -174,7 +174,7 @@ export type LoaderHelpers = { isFirefox: boolean // from wasm-feature-detect npm package - exceptions: () => Promise, + exceptionsFinal: () => Promise, simd: () => Promise, relaxedSimd: () => Promise, } @@ -226,7 +226,7 @@ export type RuntimeHelpers = { afterOnRuntimeInitialized: PromiseAndController, afterPostRun: PromiseAndController, - featureWasmEh: boolean, + featureWasmFinalEh: boolean, featureWasmSimd: boolean, featureWasmRelaxedSimd: boolean, From 65e869af8b7834e2ee8c77bd0ecd5984febecc14 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 21:30:21 +0200 Subject: [PATCH 025/101] bump nodejs --- eng/Version.Details.props | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index ee4c00f01cdcb7..b12b2593e84c7f 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -81,14 +81,14 @@ This file should be imported by eng/Versions.props 23.1.0-alpha.1.26313.1 23.1.0-alpha.1.26313.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 1.0.0-prerelease.26276.2 1.0.0-prerelease.26276.2 From 25cf5aed4f34f60930b9dc91d3548d6547058303 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 22:10:55 +0200 Subject: [PATCH 026/101] kg feedback --- src/mono/browser/runtime/jiterpreter-support.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 2eda8267ca12e0..8083478493c81e 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -856,15 +856,24 @@ export class WasmBuilder { this.appendU8(WasmOpcode.end); } + // Returns the index of an imported tag within the wasm tag index space, which is SEPARATE + // from the type index space (so getTypeIndex must not be used for catch/throw immediates). + // The jiterpreter module imports exactly one tag, __cpp_exception, so it is at tag index 0. + getTagIndex (name: string): number { + if (name !== "__cpp_exception") + throw new Error(`Unknown wasm tag '${name}'`); + return 0; + } + // Emits a try_table block (standardized exnref EH proposal) with a single // 'catch -> label' clause. On catch, the tag's parameters are pushed and control // branches out by catchLabelDepth levels. Must be closed with endBlock(). - tryTable (type: WasmValtype, catchTagTypeName: string, catchLabelDepth: number) { + tryTable (type: WasmValtype, catchTagName: string, catchLabelDepth: number) { this.appendU8(WasmOpcode.try_table); this.appendU8(type); this.appendULeb(1); // one catch clause this.appendU8(0x00); // 0x00 = catch (tag): push tag params, then branch - this.appendULeb(this.getTypeIndex(catchTagTypeName)); + this.appendULeb(this.getTagIndex(catchTagName)); // tag index (separate index space from types) this.appendULeb(catchLabelDepth); this.activeBlocks++; } From 09623f552171dca485fb42ee6f5bd8b9bde21d69 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:12:18 +0200 Subject: [PATCH 027/101] v8 --experimental-wasm-exnref --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 40d9c07a5340a5..61ea562c3bb8f4 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -474,7 +474,7 @@ From 7f3a8399ae9ea7bf42c4a6c50492cee3fcd84dbe Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:25:06 +0200 Subject: [PATCH 028/101] Bump FireFox to 140.11.0esr --- eng/testing/BrowserVersions.props | 8 ++++---- eng/testing/wasm-provisioning.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props index 31f40bbf8ba605..45640424f61f2e 100644 --- a/eng/testing/BrowserVersions.props +++ b/eng/testing/BrowserVersions.props @@ -12,9 +12,9 @@ 1625079 https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1625123 14.9.207 - 125.0.1 - 0.34.0 - 125.0.1 - 0.34.0 + 140.11.0esr + 0.37.0 + 140.11.0esr + 0.37.0 \ No newline at end of file diff --git a/eng/testing/wasm-provisioning.targets b/eng/testing/wasm-provisioning.targets index 20e1e00ddef184..b2cb4f1b1a92d9 100644 --- a/eng/testing/wasm-provisioning.targets +++ b/eng/testing/wasm-provisioning.targets @@ -28,7 +28,7 @@ $(ArtifactsBinDir)geckodriver\ - https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.bz2 + https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.xz https://github.com/mozilla/geckodriver/releases/download/v$(linux_GeckoDriverRevision)/geckodriver-v$(linux_GeckoDriverRevision)-linux64.tar.gz firefox geckodriver From 720eeb77043de0df65d82e79241a3d346193b3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:31:32 +0200 Subject: [PATCH 029/101] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index b12b2593e84c7f..f34ee7fa68bc56 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 11.0.0-alpha.1.26309.1 11.0.0-alpha.1.26309.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e288e7d47e54ec..b3889d271f5f9f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c https://github.com/dotnet/dotnet From 3f12bfc4619d284a5b92515accd4d5347565efbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 19:49:16 +0200 Subject: [PATCH 030/101] [mono][llvm] Sign-extend OP_COMPARE_IMM immediate to pointer width When IntPtrType() is i32 (wasm32) and ins->inst_imm is a negative target_mgreg_t (gint32), the implicit conversion to unsigned long long sign-extends to 0xFFFFFFFFXXXXXXXX. LLVM 23 made ConstantInt::get strict by default about values outside the target type's unsigned width, so passing such a value with SignExtend=FALSE silently produces a malformed ConstantInt in release builds (and asserts in debug builds), miscompiling comparisons against negative immediates. This path is reachable on wasm32 from the long-to-bounded-int overflow checks emitted by decompose.c (OP_LCONV_TO_OVF_I1/I2 and friends), which emit OP_COMPARE_IMM with inst_imm=-1. Pass SignExtend=TRUE so signed inst_imm values are correctly extended to whatever width IntPtrType() resolves to on the target. --- src/mono/mono/mini/mini-llvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 082c7fb219fda3..7c87297671bf8a 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -6406,7 +6406,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) cmp = LLVMBuildICmp (builder, llvm_pred, lhs, LLVMConstNull (LLVMTypeOf (lhs)), ""); } else { - cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), ""); + cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, TRUE), ""); } } else if (ins->opcode == OP_LCOMPARE_IMM) { cmp = LLVMBuildICmp (builder, cond_to_llvm_cond [rel], lhs, rhs, ""); From e844864587091191d6b1b67235d47624a6e979cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 12:24:36 +0200 Subject: [PATCH 031/101] Patch WABT dotnet-install script so it can install the CI build --- .../Sdk/WorkloadTesting.Core.targets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index c8a742387b7183..8f160c76328786 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,6 +84,13 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> + + + + + + + From 42c178c2b3f2ad55f677386eea04445fd3ec2ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:49:02 +0200 Subject: [PATCH 032/101] Log output of HasNonZeroNanoseconds --- .../System.IO.FileSystem.Tests/File/GetSetTimes.cs | 2 +- .../FileInfo/GetSetTimes.cs | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index 566d52cf35058d..36ebfbfe046a8f 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -153,7 +153,7 @@ public void SetLastWriteTimeTicks() Assert.True(firstFileTicks <= secondFileTicks, $"First File Ticks\t{firstFileTicks}\nSecond File Ticks\t{secondFileTicks}"); } - [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format/Browser Platform do not support nanosecond granularity. + [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format does not support nanosecond granularity. public void SetUptoNanoseconds() { string file = GetTestFilePath(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 8f6000cf957787..03b6dcbb94996a 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -60,7 +60,7 @@ public FileInfo GetNonZeroNanoseconds() fileinfo.LastWriteTime = dt; } - Assert.True(HasNonZeroNanoseconds(fileinfo.LastWriteTime)); + Assert.True(HasNonZeroNanoseconds(fileinfo.LastWriteTime), "Expected non-zero nanoseconds, got: " + fileinfo.LastWriteTime.Ticks); return fileinfo; } @@ -140,7 +140,7 @@ public void CopyToNanosecondsPresent() output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); - Assert.True(HasNonZeroNanoseconds(output.LastWriteTime)); + Assert.True(HasNonZeroNanoseconds(output.LastWriteTime), "Expected non-zero nanoseconds, got: " + output.LastWriteTime.Ticks); } [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] @@ -153,13 +153,8 @@ public void CopyToNanosecondsPresent_LowTempRes() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - // On Browser, we sometimes see a difference of exactly 10M, eg., - // Expected: 637949564520000000 - // Actual: 637949564530000000 - double tolerance = PlatformDetection.IsBrowser ? 10_000_000 : 0; - - Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks, tolerance); - Assert.False(HasNonZeroNanoseconds(output.LastWriteTime)); + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); + Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] From 2d47b4c63a9a2c8b40fd4e69da45bb625eca4f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:53:37 +0200 Subject: [PATCH 033/101] Reenable some tests now that emscripten 3.1.74+ supports distinct file atime/mtime/ctime --- .../System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 1 - .../tests/System.IO.FileSystem.Tests/File/Copy.cs | 10 +--------- .../System.IO.FileSystem.Tests/File/GetSetTimes.cs | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 0cc91d011a301e..7af200ac203af9 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -180,7 +180,6 @@ public void SettingPropertiesOnSymlink(bool targetExists) } [Fact] - [PlatformSpecific(~TestPlatforms.Browser)] // Browser is excluded as there is only 1 effective time store. public void SettingUpdatesPropertiesAfterAnother() { T item = GetExistingItem(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs index a3a8c7526bd045..bfe2dd3040937b 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs @@ -142,15 +142,7 @@ public void CopyFileWithData(char[] data, bool readOnly) } // Ensure last write/access time on the new file is appropriate - // - // For browser, there is technically only 1 time. It's the max - // of LastWrite and LastAccess. On browser, File.SetLastWriteTime - // overwrites LastWrite and LastAccess, and File.Copy - // overwrites LastWrite , so this check doesn't apply. - if (PlatformDetection.IsNotBrowser) - { - Assert.InRange(File.GetLastWriteTimeUtc(testFileDest), lastWriteTime.AddSeconds(-1), lastWriteTime.AddSeconds(1)); - } + Assert.InRange(File.GetLastWriteTimeUtc(testFileDest), lastWriteTime.AddSeconds(-1), lastWriteTime.AddSeconds(1)); Assert.Equal(readOnly, (File.GetAttributes(testFileDest) & FileAttributes.ReadOnly) != 0); if (readOnly) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index 36ebfbfe046a8f..f238f5e37a2e8b 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -138,7 +138,6 @@ public override IEnumerable TimeFunctions(bool requiresRoundtrippi } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/83197", TestPlatforms.Browser)] public void SetLastWriteTimeTicks() { string firstFile = GetTestFilePath(); @@ -185,7 +184,6 @@ public void SetDateTimeMax() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/83197", TestPlatforms.Browser)] public void SetLastAccessTimeTicks() { string firstFile = GetTestFilePath(); From d9a5256b126ef4b3e80b605a2770c138c672c1c2 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:56 +0200 Subject: [PATCH 034/101] export memory from Module (cherry picked from commit fa8db40e4e2a6f9f2544d9f632a4086584bf9daa) --- eng/native.wasm.targets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index 5c1238f58dc590..a61e4863d08d6b 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -55,6 +55,16 @@ + + + + + + + + + + From a7a8e0db115d971b81d3cfefcfe0e5842cffd5ad Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:20 +0200 Subject: [PATCH 035/101] don't node flush streams in a browser (cherry picked from commit 4113f8e52586234464f2d00d6846d62c13eb3453) --- src/mono/browser/runtime/loader/exit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index b57d06b993cc48..bfddfbf3f29097 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -204,6 +204,7 @@ function set_exit_code_and_quit_now (exit_code: number, reason?: any): void { } async function flush_node_streams () { + if (!ENVIRONMENT_IS_NODE) return; try { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: From 0aea51d6c7d7c687fcb8ed3be2f5deeb910012ff Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 19:53:10 +0200 Subject: [PATCH 036/101] WASM_BIGINT=0 for node testing (cherry picked from commit 5ad201d14a0a9d809056e05e71063ffdc127b509) --- src/coreclr/hosts/corerun/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 8a7b70e7a915ac..d4a764d47317a5 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -98,11 +98,6 @@ else() -Wl,--error-limit=0) if (CORERUN_IN_BROWSER) - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=1) - # Include the virtual file system data for the # browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") @@ -111,6 +106,10 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() + # Node.js doesn't have good support for WASM_BIGINT + # so it only is added when running in the browser. + target_link_options(corerun PRIVATE + -sWASM_BIGINT=0) # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE From 3a24a58247476ebf17c8e7d5da9a94461c222a22 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:22:52 +0200 Subject: [PATCH 037/101] balance runtimeKeepalivePop (cherry picked from commit 0dab167d17a670eac27902b56db8af048ad4df6c) --- src/mono/browser/runtime/startup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index c086c6b7c4bb6e..8f0887c90ef81a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -291,7 +291,6 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { - Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From c9fa6124f7599708e4687fec3eecb541a6578662 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:50:02 +0200 Subject: [PATCH 038/101] balance clearTimeout (cherry picked from commit 3bcf4d0407494dab5c17593ce9d8b2449e26f296) --- src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts | 1 + src/mono/browser/runtime/scheduling.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts index d0d503db4d5ceb..d11c2834828368 100644 --- a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts +++ b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts @@ -23,6 +23,7 @@ export function collectGcDump (options?:DiagnosticCommandOptions):Promise { stopSent = true; diff --git a/src/mono/browser/runtime/scheduling.ts b/src/mono/browser/runtime/scheduling.ts index 93dde2a5525281..1a374630d3d18e 100644 --- a/src/mono/browser/runtime/scheduling.ts +++ b/src/mono/browser/runtime/scheduling.ts @@ -70,18 +70,19 @@ export function SystemJS_ScheduleTimerImpl (shortestDueTimeMs: number): void { if (lastScheduledTimeoutId) { globalThis.clearTimeout(lastScheduledTimeoutId); lastScheduledTimeoutId = undefined; + Module.runtimeKeepalivePop(); } lastScheduledTimeoutId = Module.safeSetTimeout(mono_wasm_schedule_timer_tick, shortestDueTimeMs); } function mono_wasm_schedule_timer_tick () { if (WasmEnableThreads) return; + lastScheduledTimeoutId = undefined; Module.maybeExit(); forceThreadMemoryViewRefresh(); if (!loaderHelpers.is_runtime_running()) { return; } - lastScheduledTimeoutId = undefined; try { cwraps.mono_wasm_execute_timer(); } catch (ex) { From 2f3d9c274dba1027ff70561082ae94eeb9702bb5 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:50:49 +0200 Subject: [PATCH 039/101] disable WASM_BIGINT for corerun - NodeJS (cherry picked from commit 53a6d163992d4d016677b73e4f6561b274d6ce5a) --- docs/workflow/building/coreclr/wasm.md | 3 ++- eng/native.wasm.targets | 5 +++-- src/coreclr/runtime.proj | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/workflow/building/coreclr/wasm.md b/docs/workflow/building/coreclr/wasm.md index b2de062d88b066..99dd2911483441 100644 --- a/docs/workflow/building/coreclr/wasm.md +++ b/docs/workflow/building/coreclr/wasm.md @@ -146,7 +146,8 @@ In config below please replace `/path/to/runtime/` by a **absolute unix path** t "/**" ], "runtimeArgs": [ - "--stack-trace-limit=1000" + "--stack-trace-limit=10000", + "--experimental-wasm-exnref" ], "args": [ "HelloWorld.dll" diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a61e4863d08d6b..a162ba21910ef6 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,8 +63,9 @@ - - + + + diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 2c968913b26f4c..a0a11f404243b1 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,17 @@ - + + + + + <_WasmDisableBigInt>true + + + From 549e9fdbd7c574c0fe8bb6475757fa619125bce6 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:25:06 +0200 Subject: [PATCH 040/101] Bump FireFox to 140.11.0esr (cherry picked from commit 7f3a8399ae9ea7bf42c4a6c50492cee3fcd84dbe) --- eng/testing/BrowserVersions.props | 8 ++++---- eng/testing/wasm-provisioning.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props index 31f40bbf8ba605..45640424f61f2e 100644 --- a/eng/testing/BrowserVersions.props +++ b/eng/testing/BrowserVersions.props @@ -12,9 +12,9 @@ 1625079 https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1625123 14.9.207 - 125.0.1 - 0.34.0 - 125.0.1 - 0.34.0 + 140.11.0esr + 0.37.0 + 140.11.0esr + 0.37.0 \ No newline at end of file diff --git a/eng/testing/wasm-provisioning.targets b/eng/testing/wasm-provisioning.targets index 20e1e00ddef184..b2cb4f1b1a92d9 100644 --- a/eng/testing/wasm-provisioning.targets +++ b/eng/testing/wasm-provisioning.targets @@ -28,7 +28,7 @@ $(ArtifactsBinDir)geckodriver\ - https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.bz2 + https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.xz https://github.com/mozilla/geckodriver/releases/download/v$(linux_GeckoDriverRevision)/geckodriver-v$(linux_GeckoDriverRevision)-linux64.tar.gz firefox geckodriver From b37867bf7f0ba7b1667bdf11409005d3afc6d566 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:28:35 +0200 Subject: [PATCH 041/101] feedback --- src/mono/browser/runtime/jiterpreter-support.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 8083478493c81e..740a05bb14b4a9 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -481,13 +481,13 @@ export class WasmBuilder { if (includeFunctionTable !== false) throw new Error("function table imports are disabled"); - const enableWasmEh = this.getExceptionTag() !== undefined; + const enableWasmFinalEh = this.getExceptionTag() !== undefined; // Import section this.beginSection(2); this.appendULeb( 1 + // memory - (enableWasmEh ? 1 : 0) + // c++ exception tag + (enableWasmFinalEh ? 1 : 0) + // c++ exception tag importsToEmit.length + ((includeFunctionTable !== false) ? 1 : 0) ); @@ -520,7 +520,7 @@ export class WasmBuilder { this.appendULeb(0x01); } - if (enableWasmEh) { + if (enableWasmFinalEh) { // import the c++ exception tag this.appendName("x"); this.appendName("e"); @@ -2038,7 +2038,7 @@ const optionNames: { [jsName: string]: string } = { "enableJitCall": "jiterpreter-jit-call-enabled", "enableBackwardBranches": "jiterpreter-backward-branch-entries-enabled", "enableCallResume": "jiterpreter-call-resume-enabled", - "enableWasmEh": "jiterpreter-wasm-eh-enabled", + "enableWasmFinalEh": "jiterpreter-wasm-eh-enabled", "enableSimd": "jiterpreter-simd-enabled", "enableAtomics": "jiterpreter-atomics-enabled", "zeroPageOptimization": "jiterpreter-zero-page-optimization", From 26fc32bbe91445f056b5e5c7dbb8c8c7295ed140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 15:26:30 +0200 Subject: [PATCH 042/101] Revert eng/common changes, these are unrelated --- eng/common/SetupNugetSources.ps1 | 5 ---- eng/common/SetupNugetSources.sh | 5 ---- .../core-templates/job/helix-job-monitor.yml | 2 +- eng/common/core-templates/job/job.yml | 6 ----- .../steps/enable-internal-sources.yml | 24 ----------------- eng/common/cross/build-rootfs.sh | 10 +++---- .../native/LocateNativeCompiler.targets | 27 ------------------- eng/common/templates/job/job.yml | 5 ++++ eng/common/templates/vmr-build-pr.yml | 2 +- 9 files changed, 10 insertions(+), 76 deletions(-) delete mode 100644 eng/common/native/LocateNativeCompiler.targets diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 58002808bc841a..fc8d618014e0da 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -32,11 +32,6 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# This script only consumes helper functions from tools.ps1 to configure NuGet feeds. -# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring -# a bootstrap SDK) is not triggered as a side effect of feed configuration. -$disableConfigureToolsetImport = $true - . $PSScriptRoot\tools.ps1 # Adds or enables the package source with the given name diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 67e7e0942ca14e..b97cc536379dfe 100755 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -40,11 +40,6 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -# This script only consumes helper functions from tools.sh to configure NuGet feeds. -# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring -# a bootstrap SDK) is not triggered as a side effect of feed configuration. -disable_configure_toolset_import=1 - . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index a8162c51166735..767450da2fcb03 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -170,7 +170,7 @@ jobs: toolArgs=( --helix-base-uri '${{ parameters.helixBaseUri }}' --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' - --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. + --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 2))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. --stage-name '$(System.StageName)' ) diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index cb60f5297844a4..66c7988f222a65 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -75,12 +75,6 @@ jobs: variables: - name: AllowPtrToDetectTestRunRetryFiles value: true - # Component Governance detection and CodeQL are not run in the public project - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - name: skipComponentGovernanceDetection - value: true - - name: Codeql.SkipTaskAutoInjection - value: true - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 51af9a017091ff..4085512b690910 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -15,56 +15,32 @@ steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token env: Token: ${{ parameters.legacyCredential }} - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - targetType: inline - script: | - "$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token" - env: - Token: ${{ parameters.legacyCredential }} # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh - arguments: $(System.DefaultWorkingDirectory)/NuGet.config - ${{ else }}: - template: /eng/common/templates/steps/get-federated-access-token.yml parameters: federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh - arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token) # This is required in certain scenarios to install the ADO credential provider. # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others # (e.g. dotnet msbuild). diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 273cae651a2b1e..f06854ccc1865e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -618,15 +618,15 @@ elif [[ "$__CodeName" == "openbsd" ]]; then [[ -z "$PKG_FILE" ]] && { echo "ERROR: Package $pkg not found"; exit 1; } if [[ "$__hasWget" == 1 ]]; then - wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - + wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - else - curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - + curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - fi done echo "Creating versionless symlinks for shared libraries..." # Find all versioned .so files and create the base .so symlink - for lib in "$__RootfsDir"/usr/lib/lib*.so.*; do + for lib in "$__RootfsDir/usr/lib/libc++.so."* "$__RootfsDir/usr/lib/libc++abi.so."* "$__RootfsDir/usr/lib/libpthread.so."*; do if [ -f "$lib" ]; then # Extract the filename (e.g., libc++.so.12.0) VERSIONED_NAME=$(basename "$lib") @@ -636,10 +636,6 @@ elif [[ "$__CodeName" == "openbsd" ]]; then ln -sf "$VERSIONED_NAME" "$__RootfsDir/usr/lib/$BASE_NAME" fi done - - echo "Cleaning up unnecessary paths" - # we don't use executables and kernel in rootfs (as we use host's compiler with -sysroot) - rm -rf "$__RootfsDir/usr/share" "$__RootfsDir/usr/bin" elif [[ "$__CodeName" == "illumos" ]]; then mkdir "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp" diff --git a/eng/common/native/LocateNativeCompiler.targets b/eng/common/native/LocateNativeCompiler.targets deleted file mode 100644 index 028b33d944416f..00000000000000 --- a/eng/common/native/LocateNativeCompiler.targets +++ /dev/null @@ -1,27 +0,0 @@ - - - - - clang - $(ROOTFS_DIR) - - - - - - - - $(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';')))) - <_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1)))) - lld - - - diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 85501406a541b6..5e261f34db421b 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -21,6 +21,11 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} + # we don't run CG in public + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable + artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml index d24de935248a68..2f3694fa13239e 100644 --- a/eng/common/templates/vmr-build-pr.yml +++ b/eng/common/templates/vmr-build-pr.yml @@ -33,7 +33,7 @@ resources: - repository: vmr type: github name: dotnet/dotnet - endpoint: public + endpoint: dotnet ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into stages: From f3240dbfae05789cb54d5b362d390d3f98425c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 15:30:47 +0200 Subject: [PATCH 043/101] Copilot feedback Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/coreclr/hosts/corerun/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index d4a764d47317a5..d2c3373bd258d3 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -106,8 +106,7 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. + # Node.js doesn't have good support for WASM_BIGINT, so disable it for the Node/shell scenario. target_link_options(corerun PRIVATE -sWASM_BIGINT=0) # If not running in the browser, add From 151ecdda752c4a6af606c9de0cf7a248f8645c27 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:46:46 +0200 Subject: [PATCH 044/101] improve runtimeKeepalivePop() --- src/mono/browser/runtime/startup.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 8f0887c90ef81a..92bd64d28e5d9a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -197,6 +197,7 @@ async function preRunAsync (userPreRun: ((module:EmscriptenModule) => void)[]) { } async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:EmscriptenModule) => void) { + let keepAlivePushed = false; try { // wait for previous stage await runtimeHelpers.afterPreRun.promise; @@ -227,7 +228,10 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc setTimeout(maybeSaveInterpPgoTable, (runtimeHelpers.config.interpreterPgoSaveDelay || 15) * 1000); + // this push is un-balanced for short while until runtimeReady = true. Accepted trade-off. Module.runtimeKeepalivePush(); + keepAlivePushed = true; + if (WasmEnableThreads && BuildConfiguration === "Debug" && globalThis.setInterval) globalThis.setInterval(() => { mono_log_info("UI thread is alive!"); }, 3000); @@ -291,6 +295,7 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { + if (keepAlivePushed && !runtimeHelpers.runtimeReady) Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From 10a3963b058bbe04129a69c6f23edfe22c26327a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:53:45 +0200 Subject: [PATCH 045/101] WASM_BIGINT feedback --- eng/native.wasm.targets | 5 ++- src/coreclr/hosts/corerun/CMakeLists.txt | 40 +++++++++++++----------- src/coreclr/runtime.proj | 10 ------ 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a162ba21910ef6..a61e4863d08d6b 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,9 +63,8 @@ - - - + + diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index d4a764d47317a5..98add3094ad678 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -79,24 +79,6 @@ else() LINK_DEPENDS "${JS_CORE_RUN};${JS_CORE_RUN_EXTPOST};${JS_SYSTEM_NATIVE_BROWSER};${JS_SYSTEM_BROWSER_UTILS};" LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - target_link_options(corerun PRIVATE - -sINITIAL_MEMORY=134217728 - -sMAXIMUM_MEMORY=4294967296 - -sALLOW_MEMORY_GROWTH=1 - -sALLOW_TABLE_GROWTH=1 - -sSTACK_SIZE=5MB - -sMODULARIZE=1 - -sEXPORT_ES6=1 - -sEXIT_RUNTIME=1 - -sEXPORTED_RUNTIME_METHODS=CORERUN,ENV,${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS} - -sEXPORTED_FUNCTIONS=_main,${CMAKE_EMCC_EXPORTED_FUNCTIONS} - -sEXPORT_NAME=createDotnetRuntime - -sENVIRONMENT=node,shell,web - -lexports.js - -Wl,--export=__stack_pointer - -Wl,--export=__coreclr_wasm_rtlrestorecontext_tag - -Wl,--error-limit=0) - if (CORERUN_IN_BROWSER) # Include the virtual file system data for the # browser scenario. @@ -110,12 +92,34 @@ else() # so it only is added when running in the browser. target_link_options(corerun PRIVATE -sWASM_BIGINT=0) + + # remove HEAP64 and HEAPU64 from CMAKE_EMCC_EXPORTED_RUNTIME_METHODS + string(REPLACE "HEAP64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") + string(REPLACE "HEAPU64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") + # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE -sNODERAWFS=1 -lnodefs.js) endif() + target_link_options(corerun PRIVATE + -sINITIAL_MEMORY=134217728 + -sMAXIMUM_MEMORY=4294967296 + -sALLOW_MEMORY_GROWTH=1 + -sALLOW_TABLE_GROWTH=1 + -sSTACK_SIZE=5MB + -sMODULARIZE=1 + -sEXPORT_ES6=1 + -sEXIT_RUNTIME=1 + -sEXPORTED_RUNTIME_METHODS=CORERUN,ENV,${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS} + -sEXPORTED_FUNCTIONS=_main,${CMAKE_EMCC_EXPORTED_FUNCTIONS} + -sEXPORT_NAME=createDotnetRuntime + -sENVIRONMENT=node,shell,web + -lexports.js + -Wl,--export=__stack_pointer + -Wl,--export=__coreclr_wasm_rtlrestorecontext_tag + -Wl,--error-limit=0) endif() if (CORERUN_IN_BROWSER) diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a0a11f404243b1..a9021cfde100b8 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -16,16 +16,6 @@ - - - - <_WasmDisableBigInt>true - - - From 0bc6b2292458e16bf627cc3ebd182cb363fc5f7d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 16:32:43 +0200 Subject: [PATCH 046/101] cleanup --- eng/native.wasm.targets | 1 + src/coreclr/hosts/corerun/CMakeLists.txt | 19 ++++++------------- src/coreclr/runtime.proj | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a61e4863d08d6b..42f9c581114313 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,6 +63,7 @@ + diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 98add3094ad678..582da971ed4bcc 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -80,28 +80,21 @@ else() LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") if (CORERUN_IN_BROWSER) - # Include the virtual file system data for the - # browser scenario. + # Include the virtual file system data for the browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") if (EXISTS "${WASM_PRELOAD_DIR}") - target_link_options(corerun PRIVATE - --preload-file ${WASM_PRELOAD_DIR}@/) + target_link_options(corerun PRIVATE --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=0) + # Node.js doesn't have good support for WASM_BIGINT, so disable it for the Node/shell. + target_link_options(corerun PRIVATE -sWASM_BIGINT=0) # remove HEAP64 and HEAPU64 from CMAKE_EMCC_EXPORTED_RUNTIME_METHODS string(REPLACE "HEAP64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") string(REPLACE "HEAPU64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") - # If not running in the browser, add - # Node.js file system support. - target_link_options(corerun PRIVATE - -sNODERAWFS=1 - -lnodefs.js) + # Add Node.js host file system support. + target_link_options(corerun PRIVATE -sNODERAWFS=1 -lnodefs.js) endif() target_link_options(corerun PRIVATE -sINITIAL_MEMORY=134217728 diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a9021cfde100b8..2c968913b26f4c 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,7 @@ - + From b65c0a6f2801ee2f43958d9107e4737a4536415c Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Sun, 14 Jun 2026 16:47:53 +0200 Subject: [PATCH 047/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/startup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 92bd64d28e5d9a..25093725766169 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -228,7 +228,7 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc setTimeout(maybeSaveInterpPgoTable, (runtimeHelpers.config.interpreterPgoSaveDelay || 15) * 1000); - // this push is un-balanced for short while until runtimeReady = true. Accepted trade-off. + // this push is unbalanced for short while until runtimeReady = true. Accepted trade-off. Module.runtimeKeepalivePush(); keepAlivePushed = true; From 2dde4e9cba2e6dd669116aa288007e970767fcc7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 16:50:03 +0200 Subject: [PATCH 048/101] feedback --- src/coreclr/hosts/corerun/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 582da971ed4bcc..3052680a13e7dc 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -80,6 +80,7 @@ else() LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") if (CORERUN_IN_BROWSER) + target_link_options(corerun PRIVATE -sWASM_BIGINT=1) # Include the virtual file system data for the browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") if (EXISTS "${WASM_PRELOAD_DIR}") From 68e3aef40efb9f4e6d82de9b9441ee39db858f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 17:50:29 +0200 Subject: [PATCH 049/101] Fix item syntax in WriteLinesToFile Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Sdk/WorkloadTesting.Core.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 8f160c76328786..3a0ee3406f3b7f 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -89,7 +89,7 @@ - + Date: Sun, 14 Jun 2026 18:22:58 +0200 Subject: [PATCH 050/101] Remove obsolete Browser/WASI workaround in SetAccessOrWriteTimeCore Emscripten before 3.1.74 didn't support distinct atime/mtime, so the Browser path set both to the same value. The repo now uses Emscripten 5.0.6, so the workaround is no longer needed and was causing SetLastAccessTime to clobber LastWriteTime (and vice versa). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/System/IO/FileStatus.Unix.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs index 4ffd7cd8cd811c..9a54a0cd620022 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs @@ -394,12 +394,6 @@ private unsafe void SetAccessOrWriteTimeCore(SafeFileHandle? handle, string? pat long seconds = time.ToUnixTimeSeconds(); long nanoseconds = UnixTimeSecondsToNanoseconds(time, seconds); -#if TARGET_BROWSER || TARGET_WASI - buf[0].TvSec = seconds; - buf[0].TvNsec = nanoseconds; - buf[1].TvSec = seconds; - buf[1].TvNsec = nanoseconds; -#else if (isAccessTime) { buf[0].TvSec = seconds; @@ -414,7 +408,6 @@ private unsafe void SetAccessOrWriteTimeCore(SafeFileHandle? handle, string? pat buf[1].TvSec = seconds; buf[1].TvNsec = nanoseconds; } -#endif int rv = handle is not null ? Interop.Sys.FUTimens(handle, buf) : Interop.Sys.UTimensat(path!, buf); From d285468d6d5bd3cf3c6105cfee4052b119eee90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 18:53:20 +0200 Subject: [PATCH 051/101] Improve handling of various filesystem precisions in tests --- .../Base/BaseGetSetTimes.cs | 43 ++++++++----------- .../File/GetSetTimes.cs | 2 +- .../FileInfo/GetSetTimes.cs | 26 +++++------ 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 7af200ac203af9..762e22ad646e99 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -11,28 +11,18 @@ namespace System.IO.Tests { public abstract class BaseGetSetTimes : FileSystemTest { - protected const string HFS = "hfs"; public delegate void SetTime(T item, DateTime time); public delegate DateTime GetTime(T item); // AppContainer restricts access to DriveFormat (::GetVolumeInformation) private static string driveFormat = PlatformDetection.IsInAppContainer ? string.Empty : new DriveInfo(Path.GetTempPath()).DriveFormat; - protected static bool isHFS => driveFormat != null && driveFormat.Equals(HFS, StringComparison.InvariantCultureIgnoreCase); + private static bool isHFS => driveFormat != null && driveFormat.Equals("hfs", StringComparison.InvariantCultureIgnoreCase); - protected static bool LowTemporalResolution => isHFS; - protected static bool HighTemporalResolution => !LowTemporalResolution; - - private static void CheckHighTemporalResolution() - { - if (!HighTemporalResolution) - throw new SkipTestException(nameof(HighTemporalResolution)); - } - - private static void CheckLowTemporalResolution() - { - if (!LowTemporalResolution) - throw new SkipTestException(nameof(LowTemporalResolution)); - } + protected static bool SecondTemporalResolution => true; + protected static bool MilliSecondTemporalResolution => SecondTemporalResolution && !isHFS; // HFS only supports temporal resolution of 1 second + protected static bool NanoSecondTemporalResolution => MilliSecondTemporalResolution && !PlatformDetection.IsBrowser; // Browser does not support nanosecond resolution + protected static bool NotMilliSecondTemporalResolution => !MilliSecondTemporalResolution; + protected static bool NotNanoSecondTemporalResolution => !NanoSecondTemporalResolution; protected abstract bool CanBeReadOnly { get; } @@ -83,7 +73,7 @@ private void SettingUpdatesPropertiesCore(T item, T? linkTarget = default) bool isLink = linkTarget is not null; // Checking that milliseconds are not dropped after setter. - DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, function.Kind); + DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, function.Kind); function.Setter(item, dt); T getTarget = !isLink || ApiTargetsLink ? item : linkTarget; @@ -217,9 +207,9 @@ public void SettingUpdatesPropertiesAfterAnother() bool reverse = functions.reverse; // Checking that milliseconds are not dropped after setter. - DateTime dt1 = new DateTime(2002, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); - DateTime dt2 = new DateTime(2001, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); - DateTime dt3 = new DateTime(2000, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt1 = new DateTime(2002, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt2 = new DateTime(2001, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt3 = new DateTime(2000, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); if (reverse) //reverse the order of setting dates { (dt1, dt3) = (dt3, dt1); @@ -243,10 +233,12 @@ public void CanGetAllTimesAfterCreation() ValidateSetTimes(item, beforeTime, afterTime); } - [ConditionalFact] // OSX HFS driver format does not support millisec granularity + [ConditionalFact] public void TimesIncludeMillisecondPart() { - CheckHighTemporalResolution(); + if (!MilliSecondTemporalResolution) + throw new SkipTestException(nameof(MilliSecondTemporalResolution)); + T item = GetExistingItem(); Assert.All(TimeFunctions(), (function) => { @@ -277,11 +269,12 @@ public void TimesIncludeMillisecondPart() } [ConditionalFact] - public void TimesIncludeMillisecondPart_LowTempRes() + public void TimesNotIncludeMillisecondPart() { - CheckLowTemporalResolution(); + if (MilliSecondTemporalResolution) + throw new SkipTestException(nameof(MilliSecondTemporalResolution)); + T item = GetExistingItem(); - // OSX HFS driver format does not support millisec granularity Assert.All(TimeFunctions(), (function) => { DateTime time = function.Getter(item); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index f238f5e37a2e8b..1273a17d538626 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -152,7 +152,7 @@ public void SetLastWriteTimeTicks() Assert.True(firstFileTicks <= secondFileTicks, $"First File Ticks\t{firstFileTicks}\nSecond File Ticks\t{secondFileTicks}"); } - [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format does not support nanosecond granularity. + [ConditionalFact(typeof(File_GetSetTimes), nameof(NanoSecondTemporalResolution))] public void SetUptoNanoseconds() { string file = GetTestFilePath(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 03b6dcbb94996a..59d65c7c56f77d 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -52,9 +52,6 @@ public FileInfo GetNonZeroNanoseconds() if (!HasNonZeroNanoseconds(fileinfo.LastWriteTime)) { - if (PlatformDetection.IsApplePlatform) - return null; - DateTime dt = fileinfo.LastWriteTime; dt = dt.AddTicks(1); fileinfo.LastWriteTime = dt; @@ -113,7 +110,7 @@ public override IEnumerable TimeFunctions(bool requiresRoundtrippi DateTimeKind.Utc); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(MilliSecondTemporalResolution))] public void CopyToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); @@ -127,13 +124,10 @@ public void CopyToMillisecondPresent() Assert.NotEqual(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NanoSecondTemporalResolution))] public void CopyToNanosecondsPresent() { FileInfo input = GetNonZeroNanoseconds(); - if (input == null) - return; - FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); output.Directory.Create(); @@ -143,8 +137,8 @@ public void CopyToNanosecondsPresent() Assert.True(HasNonZeroNanoseconds(output.LastWriteTime), "Expected non-zero nanoseconds, got: " + output.LastWriteTime.Ticks); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void CopyToNanosecondsPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotNanoSecondTemporalResolution))] + public void CopyToNanosecondsNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); @@ -152,13 +146,13 @@ public void CopyToNanosecondsPresent_LowTempRes() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void MoveToMillisecondPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotMilliSecondTemporalResolution))] + public void MoveToMillisecondNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); @@ -169,7 +163,7 @@ public void MoveToMillisecondPresent_LowTempRes() Assert.Equal(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(MilliSecondTemporalResolution))] public void MoveToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); @@ -180,8 +174,8 @@ public void MoveToMillisecondPresent() Assert.NotEqual(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void CopyToMillisecondPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotMilliSecondTemporalResolution))] + public void CopyToMillisecondNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); From 2c60688559dd92f2b91a32de5ac19329c33c65da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 19:07:22 +0200 Subject: [PATCH 052/101] Fix whitespace --- .../tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 59d65c7c56f77d..2307287976e805 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -146,7 +146,7 @@ public void CopyToNanosecondsNotPresent() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } From cd4af45488944f810c0d7b60b91acaac113d0ca9 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 19:21:39 +0200 Subject: [PATCH 053/101] postpone new exception instructions --- eng/native/configureplatform.cmake | 4 +-- eng/testing/WasmRunnerTemplate.cmd | 2 +- eng/testing/WasmRunnerTemplate.sh | 2 +- src/coreclr/runtime.proj | 12 +------ src/mono/browser/browser.proj | 7 ++-- src/mono/browser/build/BrowserWasmApp.targets | 12 ++----- src/mono/browser/runtime/CMakeLists.txt | 2 +- .../browser/runtime/jiterpreter-jit-call.ts | 31 +++++++----------- .../browser/runtime/jiterpreter-opcodes.ts | 7 ++-- .../browser/runtime/jiterpreter-support.ts | 32 +++---------------- src/mono/browser/runtime/loader/globals.ts | 4 +-- src/mono/browser/runtime/startup.ts | 6 ++-- src/mono/browser/runtime/types/internal.ts | 4 +-- src/mono/mono/mini/CMakeLists.txt | 6 ++-- .../Wasm.Console.Node.Sample.csproj | 2 +- .../console-v8/Wasm.Console.V8.Sample.csproj | 2 +- src/mono/sample/wasm/wasm.mk | 6 ++-- src/mono/wasm/build/WasmApp.Common.targets | 4 +-- 18 files changed, 49 insertions(+), 96 deletions(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 163b68190894ae..046d630bc4793f 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -503,7 +503,7 @@ else() if(CLR_CMAKE_RUNTIME_CORECLR) if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD) add_link_options(-fwasm-exceptions) - add_link_options(-sWASM_LEGACY_EXCEPTIONS=0) + add_link_options(-sWASM_LEGACY_EXCEPTIONS=1) add_link_options(-Wno-unused-command-line-argument) add_link_options(-Wl,--error-limit=0) @@ -517,7 +517,7 @@ else() add_link_options(-lunwind) add_compile_options(-fwasm-exceptions) - add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0) + add_compile_options(-sWASM_LEGACY_EXCEPTIONS=1) add_compile_options(-mbulk-memory) add_compile_options(-msimd128) endif() diff --git a/eng/testing/WasmRunnerTemplate.cmd b/eng/testing/WasmRunnerTemplate.cmd index 0e8b6c9406ee29..463883384bde3d 100644 --- a/eng/testing/WasmRunnerTemplate.cmd +++ b/eng/testing/WasmRunnerTemplate.cmd @@ -47,7 +47,7 @@ if /I [%XHARNESS_COMMAND%] == [test] ( ) if [%JS_ENGINE_ARGS%] == [] ( - set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000 --engine-arg^=--experimental-wasm-exnref" + set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000" ) ) else ( if /I [%SCENARIO%] == [WasmTestOnChrome] ( diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh index 91fcc162f4fbf4..dc9339e1acdd62 100644 --- a/eng/testing/WasmRunnerTemplate.sh +++ b/eng/testing/WasmRunnerTemplate.sh @@ -44,7 +44,7 @@ if [[ "$XHARNESS_COMMAND" == "test" ]]; then fi if [[ -z "$JS_ENGINE_ARGS" ]]; then - JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref" + JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000" fi else if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a0a11f404243b1..2c968913b26f4c 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,17 +15,7 @@ - - - - - <_WasmDisableBigInt>true - - - + diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 50ccb7a426aa63..e466da1f94d169 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -321,9 +321,7 @@ -g -Os -DDEBUG=1 -Oz - - $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1 $(CMakeConfigurationEmccFlags) -fexceptions $(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 @@ -334,8 +332,7 @@ $(CMakeConfigurationLinkFlags) -msimd128 $(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth $(CMakeConfigurationLinkFlags) --emit-symbol-map - - $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1 $(CMakeConfigurationLinkFlags) -fexceptions -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))" diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 61ea562c3bb8f4..ae5ad942d4d7be 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -37,9 +37,7 @@ emcc <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions - - <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=0 - + <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=1 <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm @@ -180,14 +178,10 @@ <_EmccCommonFlags Include="$(EmccFlags)" /> <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> - <_EmccCommonFlags Include="-fexceptions" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" /> <_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> - - <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=0" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> + <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=1" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> @@ -474,7 +468,7 @@ diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt index a133f625d40f89..25338f761a6006 100644 --- a/src/mono/browser/runtime/CMakeLists.txt +++ b/src/mono/browser/runtime/CMakeLists.txt @@ -44,7 +44,7 @@ set(ignoreMeEmsdkPath "${EMSDK_PATH}") if(CMAKE_BUILD_TYPE STREQUAL "Release") add_custom_command(TARGET dotnet.native - POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling --enable-reference-types --enable-multivalue --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm + POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling --enable-multivalue --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm COMMENT "Stripping debug symbols from dotnet.native.wasm using wasm-opt") endif() diff --git a/src/mono/browser/runtime/jiterpreter-jit-call.ts b/src/mono/browser/runtime/jiterpreter-jit-call.ts index cbb50e23118633..3175cc5a758e5a 100644 --- a/src/mono/browser/runtime/jiterpreter-jit-call.ts +++ b/src/mono/browser/runtime/jiterpreter-jit-call.ts @@ -333,11 +333,11 @@ export function mono_interp_flush_jitcall_queue (): void { return; } - if (builder.options.enableWasmFinalEh) { - if (!runtimeHelpers.featureWasmFinalEh) { + if (builder.options.enableWasmEh) { + if (!runtimeHelpers.featureWasmEh) { // The user requested to enable wasm EH but it's not supported, so turn the option back off - applyOptions({ enableWasmFinalEh: false }); - builder.options.enableWasmFinalEh = false; + applyOptions({ enableWasmEh: false }); + builder.options.enableWasmEh = false; } } @@ -639,14 +639,10 @@ function generate_wasm_body ( ): boolean { let stack_index = 0; - // If wasm EH is enabled we perform the call inside a try_table (standardized exnref proposal) - // and set a flag if it throws a C++ exception. Structure: - // (block $outer (block $catch (result i32) (try_table (catch __cpp_exception $catch) ) br $outer) ) - if (builder.options.enableWasmFinalEh) { - builder.block(WasmValtype.void); // $outer - builder.block(WasmValtype.i32); // $catch - receives the exception pointer - builder.tryTable(WasmValtype.void, "__cpp_exception", 1); // catch __cpp_exception -> $catch - } + // If wasm EH is enabled we will perform the call inside a catch-all block and set a flag + // if it throws any exception + if (builder.options.enableWasmEh) + builder.block(WasmValtype.void, WasmOpcode.try_); // Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef // Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx @@ -783,12 +779,9 @@ function generate_wasm_body ( } // If the call threw a JS or wasm exception, set the thrown flag - if (builder.options.enableWasmFinalEh) { - builder.endBlock(); // end try_table - // Normal completion (no exception): skip the handler by branching out to $outer - builder.appendU8(WasmOpcode.br); - builder.appendULeb(1); - builder.endBlock(); // end $catch - reached only when caught, stack: [exception ptr] + if (builder.options.enableWasmEh) { + builder.appendU8(WasmOpcode.catch_); + builder.appendULeb(builder.getTypeIndex("__cpp_exception")); builder.callImport("begin_catch"); builder.callImport("end_catch"); builder.local("thrown"); @@ -796,7 +789,7 @@ function generate_wasm_body ( builder.appendU8(WasmOpcode.i32_store); builder.appendMemarg(0, 2); - builder.endBlock(); // end $outer + builder.endBlock(); } builder.appendU8(WasmOpcode.return_); diff --git a/src/mono/browser/runtime/jiterpreter-opcodes.ts b/src/mono/browser/runtime/jiterpreter-opcodes.ts index 27303091de9d07..4d3ab5c3930f1c 100644 --- a/src/mono/browser/runtime/jiterpreter-opcodes.ts +++ b/src/mono/browser/runtime/jiterpreter-opcodes.ts @@ -81,8 +81,11 @@ export const enum WasmOpcode { if_, else_, - throw_ref = 0x0a, - try_table = 0x1f, + try_ = 0x06, + catch_, + catch_all = 0x19, + throw_ = 0x08, + rethrow_ = 0x09, end = 0x0b, br, diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 740a05bb14b4a9..3235406cae7894 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -481,13 +481,13 @@ export class WasmBuilder { if (includeFunctionTable !== false) throw new Error("function table imports are disabled"); - const enableWasmFinalEh = this.getExceptionTag() !== undefined; + const enableWasmEh = this.getExceptionTag() !== undefined; // Import section this.beginSection(2); this.appendULeb( 1 + // memory - (enableWasmFinalEh ? 1 : 0) + // c++ exception tag + (enableWasmEh ? 1 : 0) + // c++ exception tag importsToEmit.length + ((includeFunctionTable !== false) ? 1 : 0) ); @@ -520,7 +520,7 @@ export class WasmBuilder { this.appendULeb(0x01); } - if (enableWasmFinalEh) { + if (enableWasmEh) { // import the c++ exception tag this.appendName("x"); this.appendName("e"); @@ -856,28 +856,6 @@ export class WasmBuilder { this.appendU8(WasmOpcode.end); } - // Returns the index of an imported tag within the wasm tag index space, which is SEPARATE - // from the type index space (so getTypeIndex must not be used for catch/throw immediates). - // The jiterpreter module imports exactly one tag, __cpp_exception, so it is at tag index 0. - getTagIndex (name: string): number { - if (name !== "__cpp_exception") - throw new Error(`Unknown wasm tag '${name}'`); - return 0; - } - - // Emits a try_table block (standardized exnref EH proposal) with a single - // 'catch -> label' clause. On catch, the tag's parameters are pushed and control - // branches out by catchLabelDepth levels. Must be closed with endBlock(). - tryTable (type: WasmValtype, catchTagName: string, catchLabelDepth: number) { - this.appendU8(WasmOpcode.try_table); - this.appendU8(type); - this.appendULeb(1); // one catch clause - this.appendU8(0x00); // 0x00 = catch (tag): push tag params, then branch - this.appendULeb(this.getTagIndex(catchTagName)); // tag index (separate index space from types) - this.appendULeb(catchLabelDepth); - this.activeBlocks++; - } - arg (name: string | number, opcode?: WasmOpcode) { const index = typeof (name) === "string" ? (this.locals.has(name) ? this.locals.get(name)! : undefined) @@ -1991,7 +1969,7 @@ export type JiterpreterOptions = { enableJitCall: boolean; enableBackwardBranches: boolean; enableCallResume: boolean; - enableWasmFinalEh: boolean; + enableWasmEh: boolean; enableSimd: boolean; enableAtomics: boolean; zeroPageOptimization: boolean; @@ -2038,7 +2016,7 @@ const optionNames: { [jsName: string]: string } = { "enableJitCall": "jiterpreter-jit-call-enabled", "enableBackwardBranches": "jiterpreter-backward-branch-entries-enabled", "enableCallResume": "jiterpreter-call-resume-enabled", - "enableWasmFinalEh": "jiterpreter-wasm-eh-enabled", + "enableWasmEh": "jiterpreter-wasm-eh-enabled", "enableSimd": "jiterpreter-simd-enabled", "enableAtomics": "jiterpreter-atomics-enabled", "zeroPageOptimization": "jiterpreter-zero-page-optimization", diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 379f9e99f40de6..98f6dfd30bf24c 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -6,7 +6,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; -import { simd, relaxedSimd, exceptionsFinal } from "wasm-feature-detect"; +import { exceptions, simd, relaxedSimd } from "wasm-feature-detect"; import gitHash from "consts:gitHash"; @@ -131,7 +131,7 @@ export function setLoaderGlobals ( isDebuggingSupported, // from wasm-feature-detect npm package - exceptionsFinal, + exceptions, simd, relaxedSimd }; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index f978d29202f69c..25093725766169 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -83,7 +83,7 @@ export function configureEmscriptenStartup (module: DotnetModuleInternal): void mono_assert(runtimeHelpers.featureWasmSimd, "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); } if (runtimeHelpers.emscriptenBuildOptions.wasmEnableEH) { - mono_assert(runtimeHelpers.featureWasmFinalEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); + mono_assert(runtimeHelpers.featureWasmEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms"); } module.mainScriptUrlOrBlob = loaderHelpers.scriptUrl;// this is needed by worker threads @@ -424,10 +424,10 @@ async function instantiate_wasm_module ( async function ensureUsedWasmFeatures () { const simd = loaderHelpers.simd(); const relaxedSimd = loaderHelpers.relaxedSimd(); - const exceptions = loaderHelpers.exceptionsFinal(); + const exceptions = loaderHelpers.exceptions(); runtimeHelpers.featureWasmSimd = await simd; runtimeHelpers.featureWasmRelaxedSimd = await relaxedSimd; - runtimeHelpers.featureWasmFinalEh = await exceptions; + runtimeHelpers.featureWasmEh = await exceptions; } export async function start_runtime () { diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index e8af600df33e8f..5412d6292ec6ad 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -174,7 +174,7 @@ export type LoaderHelpers = { isFirefox: boolean // from wasm-feature-detect npm package - exceptionsFinal: () => Promise, + exceptions: () => Promise, simd: () => Promise, relaxedSimd: () => Promise, } @@ -226,7 +226,7 @@ export type RuntimeHelpers = { afterOnRuntimeInitialized: PromiseAndController, afterPostRun: PromiseAndController, - featureWasmFinalEh: boolean, + featureWasmEh: boolean, featureWasmSimd: boolean, featureWasmRelaxedSimd: boolean, diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 57e3786f9f1cf8..3b95c60c1f45da 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -474,12 +474,10 @@ if(HOST_BROWSER) set_target_properties(mono-wasm-eh-js PROPERTIES LINK_FLAGS "-fexceptions") install(TARGETS mono-wasm-eh-js LIBRARY) - # Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one. - # WASM_LEGACY_EXCEPTIONS is a [compile+link] setting, so it must be set on both. add_library(mono-wasm-eh-wasm STATIC llvm-runtime.cpp) target_link_libraries (mono-wasm-eh-wasm PRIVATE monoapi eglib_api) - set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0") - set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0") + set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1") + set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1") install(TARGETS mono-wasm-eh-wasm LIBRARY) endif() diff --git a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj index 65301b3087520a..5e9ae0d965fe6f 100644 --- a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj +++ b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj @@ -6,7 +6,7 @@ true 2 - $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode) + $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode) diff --git a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj index dfc937e8569bea..cbd591be53286b 100644 --- a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj +++ b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj @@ -5,7 +5,7 @@ true true - $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) + $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index 658d77ead989b4..22db9a0d89fa9e 100644 --- a/src/mono/sample/wasm/wasm.mk +++ b/src/mono/sample/wasm/wasm.mk @@ -42,10 +42,10 @@ run-browser: fi run-console: - cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) -- $(ARGS) + cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --single-threaded $(MAIN_JS) -- $(ARGS) run-console-node: - cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS) + cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS) debug-console-node: - cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS) \ No newline at end of file + cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS) \ No newline at end of file diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets index a8e6211aab2741..d154d54a5b5104 100644 --- a/src/mono/wasm/build/WasmApp.Common.targets +++ b/src/mono/wasm/build/WasmApp.Common.targets @@ -930,8 +930,8 @@ <_WasmOptPostLinkFileName Condition="'$([System.IO.Path]::IsPathRooted($(_WasmOptPostLinkFileName)))' != 'true'">$([System.IO.Path]::Combine($(_WasmIntermediateOutputPath), $(_WasmOptPostLinkFileName))) - - + From c947bf2e61e4546682c3cf1ec1198901351036f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 20:43:46 +0200 Subject: [PATCH 054/101] Fix dotnet-install script replacement --- .../Sdk/WorkloadTesting.Core.targets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 3a0ee3406f3b7f..7fece2463ec34f 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -85,11 +85,11 @@ Condition="!Exists($(_DotNetInstallScriptPath))"/> - - - - - + + <_DotNetInstallScriptContent>$([System.IO.File]::ReadAllText('$(_DotNetInstallScriptPath)')) + <_DotNetInstallScriptContent>$(_DotNetInstallScriptContent.Replace('ci.dot.net/public', 'ci.dot.net/dev')) + + Date: Sun, 14 Jun 2026 22:35:18 +0200 Subject: [PATCH 055/101] Fix dotnet-install script replacement --- .../Sdk/WorkloadTesting.Core.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 7fece2463ec34f..33686b45968ef7 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -89,7 +89,8 @@ <_DotNetInstallScriptContent>$([System.IO.File]::ReadAllText('$(_DotNetInstallScriptPath)')) <_DotNetInstallScriptContent>$(_DotNetInstallScriptContent.Replace('ci.dot.net/public', 'ci.dot.net/dev')) - + + Date: Mon, 15 Jun 2026 00:23:50 +0200 Subject: [PATCH 056/101] Use native sed/PowerShell for dotnet-install script replacement Round-tripping the entire shell/PowerShell script through MSBuild properties was fragile (semicolon item-splitting in WriteLinesToFile, line-ending and escaping issues). Since we already invoke sh/powershell right after, do the in-place replacement with sed (Unix) and Get-Content -Raw / Set-Content -NoNewline (Windows) instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Sdk/WorkloadTesting.Core.targets | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 33686b45968ef7..0c35283e30ff59 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,13 +84,19 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> - - - <_DotNetInstallScriptContent>$([System.IO.File]::ReadAllText('$(_DotNetInstallScriptPath)')) - <_DotNetInstallScriptContent>$(_DotNetInstallScriptContent.Replace('ci.dot.net/public', 'ci.dot.net/dev')) - - - + + + + + + Date: Mon, 15 Jun 2026 08:03:21 +0200 Subject: [PATCH 057/101] Escape single quotes as ' in PowerShell command The previous '' (PowerShell-style escape) inside a single-quoted XML attribute value prematurely terminated the attribute, breaking XML parsing of the targets file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Sdk/WorkloadTesting.Core.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 0c35283e30ff59..5075764fa09fe0 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -96,7 +96,7 @@ + Command='powershell -ExecutionPolicy ByPass -NoProfile -Command "(Get-Content -Raw -LiteralPath '$(_DotNetInstallScriptPath)').Replace('ci.dot.net/public', 'ci.dot.net/dev') | Set-Content -NoNewline -LiteralPath '$(_DotNetInstallScriptPath)'"' /> Date: Mon, 15 Jun 2026 08:00:15 +0200 Subject: [PATCH 058/101] Update emsdk --- eng/Version.Details.props | 94 +++++++++++------------ eng/Version.Details.xml | 156 +++++++++++++++++++------------------- global.json | 8 +- 3 files changed, 129 insertions(+), 129 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index f34ee7fa68bc56..9341b75d63858e 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,46 +6,46 @@ This file should be imported by eng/Versions.props - 5.9.0-1.26311.101 - 5.9.0-1.26311.101 - 5.9.0-1.26311.101 - 5.9.0-1.26311.101 - 11.0.100-preview.6.26311.101 - 11.0.100-preview.6.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 0.11.5-preview.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 - 11.0.0-beta.26311.101 + 5.9.0-1.26314.102 + 5.9.0-1.26314.102 + 5.9.0-1.26314.102 + 5.9.0-1.26314.102 + 11.0.100-preview.6.26314.102 + 11.0.100-preview.6.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 0.11.5-preview.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 + 11.0.0-beta.26314.102 3.2.2-beta.26257.113 - 2.9.3-beta.26311.101 - 11.0.0-beta.26311.101 - 5.9.0-1.26311.101 - 11.0.0-preview.6.26311.101 - 11.0.100-preview.6.26311.101 - 11.0.0-preview.6.26311.101 - 11.0.0-preview.6.26311.101 - 7.9.0-rc.31201 - 7.9.0-rc.31201 - 7.9.0-rc.31201 - 7.9.0-rc.31201 - 11.0.0-preview.6.26311.101 - 3.0.0-preview.6.26311.101 - 11.0.0-preview.6.26311.101 - 11.0.0-preview.6.26311.101 - 11.0.0-preview.6.26311.101 + 2.9.3-beta.26314.102 + 11.0.0-beta.26314.102 + 5.9.0-1.26314.102 + 11.0.0-preview.6.26314.102 + 11.0.100-preview.6.26314.102 + 11.0.0-preview.6.26314.102 + 11.0.0-preview.6.26314.102 + 7.9.0-rc.31502 + 7.9.0-rc.31502 + 7.9.0-rc.31502 + 7.9.0-rc.31502 + 11.0.0-preview.6.26314.102 + 3.0.0-preview.6.26314.102 + 11.0.0-preview.6.26314.102 + 11.0.0-preview.6.26314.102 + 11.0.0-preview.6.26314.102 11.0.0-alpha.0.26180.1 @@ -81,14 +81,14 @@ This file should be imported by eng/Versions.props 23.1.0-alpha.1.26314.2 23.1.0-alpha.1.26314.2 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 - 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26279.1 1.0.0-prerelease.26276.2 1.0.0-prerelease.26276.2 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b3889d271f5f9f..c9fd4c28ccb428 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -37,91 +37,91 @@ https://github.com/dotnet/llvm-project 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://github.com/dotnet/dotnet 0eae08ed2f094f44e0151e4815e7cdd1a334fcdf - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://github.com/dotnet/runtime-assets @@ -259,33 +259,33 @@ https://github.com/dotnet/llvm-project 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://github.com/dotnet/xharness @@ -299,9 +299,9 @@ https://github.com/dotnet/xharness fa7fbebf9168e8858971f9d0c71b2b08f2f7b106 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -327,33 +327,33 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -365,21 +365,21 @@ - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 - + https://github.com/dotnet/dotnet - 0d94f75beb811109f9992d20998c35e8b7f91144 + e292112b19f2f2ae57b16f4e2911428b90a85ab6 https://github.com/dotnet/node diff --git a/global.json b/global.json index 8f6f1ee63b47d5..a72151128fe0f0 100644 --- a/global.json +++ b/global.json @@ -13,11 +13,11 @@ "dotnet": "11.0.100-preview.5.26227.104" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26311.101", - "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26311.101", - "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26311.101", + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26314.102", + "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26314.102", + "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26314.102", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26311.101" + "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26314.102" } } From 90b86d9b8f2b33579fd5e74131cf1af6c4168433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Mon, 15 Jun 2026 09:38:31 +0200 Subject: [PATCH 059/101] Add general-testing feed to WABT nuget.config --- src/mono/wasm/Wasm.Build.Tests/data/nuget.config | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/wasm/Wasm.Build.Tests/data/nuget.config b/src/mono/wasm/Wasm.Build.Tests/data/nuget.config index c201e61aab33bf..6b97c38d08cf5b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/data/nuget.config +++ b/src/mono/wasm/Wasm.Build.Tests/data/nuget.config @@ -12,6 +12,7 @@ + From 39da7b19f4f483c965a92e5f32471a84251e3687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Mon, 15 Jun 2026 12:21:39 +0200 Subject: [PATCH 060/101] Remove dotnet.native.worker.mjs references emscripten 3.1.68 (PR #22598) removed the separate .worker.mjs file emission for pthread builds; the worker code is inlined into the main module. After the emsdk bump the file is no longer produced, which broke the WasmBuildTests cctor that used it as a sentinel for the multithreaded runtime pack. Detect the pack via dotnet.native.wasm instead and drop now-dead worker.mjs references in build/test infra. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/liveBuilds.targets | 5 ---- eng/testing/tests.browser.targets | 2 -- .../Directory.Build.props | 1 - src/mono/browser/browser.proj | 5 ---- src/mono/browser/build/BrowserWasmApp.targets | 1 - .../Common/BuildEnvironment.cs | 2 +- .../WasmSdkBasedProjectProvider.cs | 27 ------------------- 7 files changed, 1 insertion(+), 42 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 308e6fc7e2b760..6dd6ce0407489d 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -274,11 +274,6 @@ $(LibrariesNativeArtifactsPath)dotnet.diagnostics.js.map; $(LibrariesNativeArtifactsPath)dotnet.native.js.symbols;" IsNative="true" /> - - <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.wasm'">true - <_HasDotnetJsWorker Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.worker.mjs'">true <_HasDotnetJsSymbols Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.js.symbols'">true <_HasDotnetNativeJs Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.js'">true <_WasmIcuDataFileName Condition="'$(WasmIcuDataFileName)' != '' and Exists('$(WasmIcuDataFileName)')">$(WasmIcuDataFileName) @@ -305,7 +304,6 @@ - - diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index e466da1f94d169..da3d548fbcc341 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -443,11 +443,6 @@ DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> - - diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index ae5ad942d4d7be..abd29df31be14d 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -449,7 +449,6 @@ - <_WasmAssembliesInternal Remove="$(_WasmDedupAssembly)"/> diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs index 61a98572b2464d..d1b9594f1e0d39 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs @@ -213,7 +213,7 @@ private string GetRuntimePackName(RuntimeVariant runtimeType) public string GetRuntimeNativeDir(string tfm, RuntimeVariant runtimeType = RuntimeVariant.SingleThreaded) => Path.Combine(GetRuntimePackDir(tfm, runtimeType), "runtimes", DefaultRuntimeIdentifier, "native"); public bool IsMultiThreadingRuntimePackAvailableFor(string tfm) - => IsWorkload && File.Exists(Path.Combine(GetRuntimeNativeDir(tfm, RuntimeVariant.MultiThreaded), "dotnet.native.worker.mjs")); + => IsWorkload && File.Exists(Path.Combine(GetRuntimeNativeDir(tfm, RuntimeVariant.MultiThreaded), "dotnet.native.wasm")); public static string WasmOverridePacksTargetsPath = Path.Combine(TestDataPath, "WasmOverridePacks.targets"); diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs index 618ae02613e576..38b88048204bfd 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs @@ -55,7 +55,6 @@ protected override IReadOnlyDictionary GetAllKnownDotnetFilesToFin { "dotnet.native.js", true }, { "dotnet.native.js.symbols", true }, { "dotnet.native.wasm", true }, - { "dotnet.native.worker.mjs", true }, { "dotnet.runtime.js", true }, { "dotnet.runtime.js.map", false }, { "dotnet.diagnostics.js", true }, @@ -77,10 +76,6 @@ protected override IReadOnlySet GetDotNetFilesExpectedSet(AssertBundleOp "dotnet.native.js", "dotnet.runtime.js", }; - if (assertOptions.BuildOptions.RuntimeType is RuntimeVariant.MultiThreaded) - { - res.Add("dotnet.native.worker.mjs"); - } if (!assertOptions.BuildOptions.IsPublish) { @@ -162,10 +157,6 @@ private void AssertBundle(AssertBundleOptions assertOptions) string buildType = assertOptions.BuildOptions.IsPublish ? "publish" : "build"; var nativeFilesToCheck = new List() { "dotnet.native.wasm", "dotnet.native.js" }; - if (assertOptions.BuildOptions.RuntimeType == RuntimeVariant.MultiThreaded) - { - nativeFilesToCheck.Add("dotnet.native.worker.mjs"); - } foreach (string nativeFilename in nativeFilesToCheck) { @@ -180,11 +171,6 @@ private void AssertBundle(AssertBundleOptions assertOptions) if (assertOptions.BuildOptions.ExpectedFileType != NativeFilesType.FromRuntimePack) { - if (nativeFilename == "dotnet.native.worker.mjs") - { - Console.WriteLine($"Skipping the verification whether {nativeFilename} is from the runtime pack. The check wouldn't be meaningful as the runtime pack file has the same size as the relinked file"); - continue; - } // Confirm that it doesn't match the file from the runtime pack TestUtils.AssertNotSameFile(Path.Combine(runtimeNativeDir, nativeFilename), actualDotnetFiles[nativeFilename].ActualPath, @@ -284,19 +270,6 @@ private void AssertBuildBundle(Configuration config, MSBuildOptions buildOptions AssertFileNotExists(Path.Combine(objDir, "wasm", "for-build"), file, "wasm/for-build"); } - if (buildOptions.RuntimeType == RuntimeVariant.MultiThreaded) - { - // dotnet.native.worker.mjs is validated for location only and not compared against - // the runtime pack — the publish-path AssertBundle skips the runtime-pack comparison - // for the same reason (the runtime-pack file has the same size as the relinked file, - // so the check is not meaningful). - const string multiThreadedWorkerFile = "dotnet.native.worker.mjs"; - AssertFileExists(nativeDir, multiThreadedWorkerFile); - AssertFileNotExists(objDir, multiThreadedWorkerFile, "obj root"); - if (!isNativeRebuild) - AssertFileNotExists(Path.Combine(objDir, "wasm", "for-build"), multiThreadedWorkerFile, "wasm/for-build"); - } - // --- Assembly files: webcil-converted in webcil/ or materialized DLLs in fx/_framework/ --- if (BuildTestBase.UseWebcil) { From 17fab7b2069805c0af30cec32bcbb185b4d6f0dc Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 16 Jun 2026 10:47:15 +0200 Subject: [PATCH 061/101] jsModuleWorker --- src/mono/browser/runtime/assets.ts | 1 - src/mono/browser/runtime/dotnet.d.ts | 5 ----- src/mono/browser/runtime/loader/assets.ts | 12 +++--------- src/mono/browser/runtime/loader/config.ts | 7 ------- src/mono/browser/runtime/types/index.ts | 5 ----- .../wasm/Wasm.Build.Tests/ProjectProviderBase.cs | 1 - src/native/libs/Common/JavaScript/loader/assets.ts | 4 +--- src/native/libs/Common/JavaScript/loader/config.ts | 2 -- src/native/libs/Common/JavaScript/loader/dotnet.d.ts | 5 ----- .../libs/Common/JavaScript/types/public-api.ts | 5 ----- .../BootJsonBuilderHelper.cs | 6 +----- .../BootJsonData.cs | 8 +------- 12 files changed, 6 insertions(+), 55 deletions(-) diff --git a/src/mono/browser/runtime/assets.ts b/src/mono/browser/runtime/assets.ts index a899e1eb690565..e1d94fda04dc2d 100644 --- a/src/mono/browser/runtime/assets.ts +++ b/src/mono/browser/runtime/assets.ts @@ -24,7 +24,6 @@ export function instantiate_asset (asset: AssetEntry, url: string, bytes: Uint8A switch (asset.behavior) { case "dotnetwasm": - case "js-module-threads": case "js-module-diagnostics": case "symbols": // do nothing diff --git a/src/mono/browser/runtime/dotnet.d.ts b/src/mono/browser/runtime/dotnet.d.ts index 20057f71828688..2b99018f6f2897 100644 --- a/src/mono/browser/runtime/dotnet.d.ts +++ b/src/mono/browser/runtime/dotnet.d.ts @@ -261,7 +261,6 @@ interface Assets { lazyAssembly?: AssemblyAsset[]; corePdb?: PdbAsset[]; pdb?: PdbAsset[]; - jsModuleWorker?: JsAsset[]; jsModuleDiagnostics?: JsAsset[]; jsModuleNative: JsAsset[]; jsModuleRuntime: JsAsset[]; @@ -422,10 +421,6 @@ type SingleAssetBehaviors = * The javascript module for loader. */ | "js-module-dotnet" -/** - * The javascript module for threads. - */ - | "js-module-threads" /** * The javascript module for diagnostic server and client. */ diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 76b3291d7de9f9..2993c2c70d9587 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -27,7 +27,6 @@ const worker_empty_prefix = " - "; const jsRuntimeModulesAssetTypes: { [k: string]: boolean } = { - "js-module-threads": true, "js-module-runtime": true, "js-module-dotnet": true, "js-module-native": true, @@ -294,16 +293,12 @@ export function prepareAssets () { mono_assert(resources.wasmNative, "resources.wasmNative must be defined"); mono_assert(resources.jsModuleNative, "resources.jsModuleNative must be defined"); mono_assert(resources.jsModuleRuntime, "resources.jsModuleRuntime must be defined"); - mono_assert(!WasmEnableThreads || resources.jsModuleWorker, "resources.jsModuleWorker must be defined"); convert_single_asset(assetsToLoad, resources.wasmNative, "dotnetwasm"); convert_single_asset(modulesAssets, resources.jsModuleNative, "js-module-native"); convert_single_asset(modulesAssets, resources.jsModuleRuntime, "js-module-runtime"); if (resources.jsModuleDiagnostics) { convert_single_asset(modulesAssets, resources.jsModuleDiagnostics, "js-module-diagnostics"); } - if (WasmEnableThreads) { - convert_single_asset(modulesAssets, resources.jsModuleWorker, "js-module-threads"); - } const addAsset = (asset: Asset, behavior: AssetBehaviors, isCore: boolean) => { const assetEntry = asset as AssetEntryInternal; @@ -704,8 +699,7 @@ const monoToBlazorAssetTypeMap: { [key: string]: WebAssemblyBootResourceType | u "dotnetwasm": "dotnetwasm", "js-module-dotnet": "dotnetjs", "js-module-native": "dotnetjs", - "js-module-runtime": "dotnetjs", - "js-module-threads": "dotnetjs" + "js-module-runtime": "dotnetjs" }; function invokeLoadBootResource (asset: AssetEntryInternal): string | Promise | Promise | null | undefined { @@ -777,11 +771,11 @@ export async function streamingCompileWasm () { export function preloadWorkers () { if (!WasmEnableThreads) return; - const jsModuleWorker = resolve_single_asset_path("js-module-threads"); + const jsModuleNative = resolve_single_asset_path("js-module-native"); const loadingWorkers = []; for (let i = 0; i < loaderHelpers.config.pthreadPoolInitialSize!; i++) { const workerNumber = loaderHelpers.workerNextNumber++; - const worker: Partial = new Worker(jsModuleWorker.resolvedUrl!, { + const worker: Partial = new Worker(jsModuleNative.resolvedUrl!, { name: "dotnet-worker-" + workerNumber.toString().padStart(3, "0"), type: "module", }); diff --git a/src/mono/browser/runtime/loader/config.ts b/src/mono/browser/runtime/loader/config.ts index 36128ce2230754..6c833df15c0e88 100644 --- a/src/mono/browser/runtime/loader/config.ts +++ b/src/mono/browser/runtime/loader/config.ts @@ -70,9 +70,6 @@ function deep_merge_resources (target: Assets, source: Assets): Assets { if (providedResources.pdb !== undefined) { providedResources.pdb = [...(target.pdb || []), ...(providedResources.pdb || [])]; } - if (providedResources.jsModuleWorker !== undefined) { - providedResources.jsModuleWorker = [...(target.jsModuleWorker || []), ...(providedResources.jsModuleWorker || [])]; - } if (providedResources.jsModuleNative !== undefined) { providedResources.jsModuleNative = [...(target.jsModuleNative || []), ...(providedResources.jsModuleNative || [])]; } @@ -129,7 +126,6 @@ export function normalizeConfig () { config.resources = config.resources || { assembly: [], jsModuleNative: [], - jsModuleWorker: [], jsModuleRuntime: [], wasmNative: [], vfs: [], @@ -163,9 +159,6 @@ export function normalizeConfig () { case "dotnetwasm": toMerge.wasmNative = [asset as WasmAsset]; break; - case "js-module-threads": - toMerge.jsModuleWorker = [asset as JsAsset]; - break; case "js-module-runtime": toMerge.jsModuleRuntime = [asset as JsAsset]; break; diff --git a/src/mono/browser/runtime/types/index.ts b/src/mono/browser/runtime/types/index.ts index c6c3aca3bae53f..1a06897003c298 100644 --- a/src/mono/browser/runtime/types/index.ts +++ b/src/mono/browser/runtime/types/index.ts @@ -220,7 +220,6 @@ export interface Assets { corePdb?: PdbAsset[]; pdb?: PdbAsset[]; - jsModuleWorker?: JsAsset[]; jsModuleDiagnostics?: JsAsset[]; jsModuleNative: JsAsset[]; jsModuleRuntime: JsAsset[]; @@ -399,10 +398,6 @@ export type SingleAssetBehaviors = * The javascript module for loader. */ | "js-module-dotnet" - /** - * The javascript module for threads. - */ - | "js-module-threads" /** * The javascript module for diagnostic server and client. */ diff --git a/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs b/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs index c1480d70fa91ee..301661f69af9f3 100644 --- a/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs @@ -606,7 +606,6 @@ public BootJsonData AssertBootJson(AssertBundleOptions options) var bootJsonEntries = assets.jsModuleNative.Select(a => a.name) .Union(assets.wasmNative.Select(a => a.name)) .Union(assets.jsModuleRuntime.Select(a => a.name)) - .Union(assets.jsModuleWorker?.Select(a => a.name) ?? Enumerable.Empty()) .Union(assets.jsModuleDiagnostics?.Select(a => a.name) ?? Enumerable.Empty()) .Union(assets.wasmSymbols?.Select(a => a.name) ?? Enumerable.Empty()) .ToArray(); diff --git a/src/native/libs/Common/JavaScript/loader/assets.ts b/src/native/libs/Common/JavaScript/loader/assets.ts index bb8313ad8f64e7..c7325c9cc20577 100644 --- a/src/native/libs/Common/JavaScript/loader/assets.ts +++ b/src/native/libs/Common/JavaScript/loader/assets.ts @@ -583,8 +583,7 @@ const behaviorToBlazorAssetTypeMap: { [key: string]: WebAssemblyBootResourceType "webcil": "assembly", "js-module-dotnet": "dotnetjs", "js-module-native": "dotnetjs", - "js-module-runtime": "dotnetjs", - "js-module-threads": "dotnetjs" + "js-module-runtime": "dotnetjs" }; const behaviorToContentTypeMap: { [key: string]: string | undefined } = { @@ -662,7 +661,6 @@ export async function prefetchAllResources(extraVfs?: VfsAsset[]): Promise ...(resources.jsModuleNative || []), ...(resources.jsModuleRuntime || []), ...(resources.jsModuleDiagnostics || []), - ...(resources.jsModuleWorker || []), ...(resources.modulesAfterConfigLoaded || []), ...(resources.modulesAfterRuntimeReady || []), ]); diff --git a/src/native/libs/Common/JavaScript/loader/config.ts b/src/native/libs/Common/JavaScript/loader/config.ts index 033a3834a8b669..a3e6a841e82f5f 100644 --- a/src/native/libs/Common/JavaScript/loader/config.ts +++ b/src/native/libs/Common/JavaScript/loader/config.ts @@ -66,7 +66,6 @@ function mergeResources(target: Assets, source: Assets): Assets { target.lazyAssembly = [...target.lazyAssembly!, ...source.lazyAssembly || []]; target.corePdb = [...target.corePdb!, ...source.corePdb || []]; target.pdb = [...target.pdb!, ...source.pdb || []]; - target.jsModuleWorker = [...target.jsModuleWorker!, ...source.jsModuleWorker || []]; target.jsModuleNative = [...target.jsModuleNative!, ...source.jsModuleNative || []]; target.jsModuleDiagnostics = [...target.jsModuleDiagnostics!, ...source.jsModuleDiagnostics || []]; target.jsModuleRuntime = [...target.jsModuleRuntime!, ...source.jsModuleRuntime || []]; @@ -118,7 +117,6 @@ function normalizeResources(target: Assets) { if (!target.lazyAssembly) target.lazyAssembly = []; if (!target.corePdb) target.corePdb = []; if (!target.pdb) target.pdb = []; - if (!target.jsModuleWorker) target.jsModuleWorker = []; if (!target.jsModuleNative) target.jsModuleNative = []; if (!target.jsModuleDiagnostics) target.jsModuleDiagnostics = []; if (!target.jsModuleRuntime) target.jsModuleRuntime = []; diff --git a/src/native/libs/Common/JavaScript/loader/dotnet.d.ts b/src/native/libs/Common/JavaScript/loader/dotnet.d.ts index 60946334f7e9f4..edec8bb8668075 100644 --- a/src/native/libs/Common/JavaScript/loader/dotnet.d.ts +++ b/src/native/libs/Common/JavaScript/loader/dotnet.d.ts @@ -245,7 +245,6 @@ interface Assets { lazyAssembly?: AssemblyAsset[]; corePdb?: PdbAsset[]; pdb?: PdbAsset[]; - jsModuleWorker?: JsAsset[]; jsModuleDiagnostics?: JsAsset[]; jsModuleNative: JsAsset[]; jsModuleRuntime: JsAsset[]; @@ -396,10 +395,6 @@ type SingleAssetBehaviors = * The javascript module for loader. */ | "js-module-dotnet" -/** - * The javascript module for threads. - */ - | "js-module-threads" /** * The javascript module for diagnostic server and client. */ diff --git a/src/native/libs/Common/JavaScript/types/public-api.ts b/src/native/libs/Common/JavaScript/types/public-api.ts index a187a04f1639a0..f3f0a520a978e9 100644 --- a/src/native/libs/Common/JavaScript/types/public-api.ts +++ b/src/native/libs/Common/JavaScript/types/public-api.ts @@ -209,7 +209,6 @@ export interface Assets { lazyAssembly?: AssemblyAsset[]; corePdb?: PdbAsset[]; pdb?: PdbAsset[]; - jsModuleWorker?: JsAsset[]; jsModuleDiagnostics?: JsAsset[]; jsModuleNative: JsAsset[]; jsModuleRuntime: JsAsset[]; @@ -360,10 +359,6 @@ export type SingleAssetBehaviors = * The javascript module for loader. */ | "js-module-dotnet" - /** - * The javascript module for threads. - */ - | "js-module-threads" /** * The javascript module for diagnostic server and client. */ diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs index bf1b1061772d32..2c1b4ee152e1e4 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs @@ -118,7 +118,6 @@ static void AddDictionary(StringBuilder sb, Dictionary? res) AddDictionary(sb, resources.assembly); AddDictionary(sb, resources.coreAssembly); - AddDictionary(sb, resources.jsModuleWorker); AddDictionary(sb, resources.jsModuleDiagnostics); AddDictionary(sb, resources.jsModuleNative); AddDictionary(sb, resources.jsModuleRuntime); @@ -154,9 +153,7 @@ static void AddDictionary(StringBuilder sb, Dictionary? res) ResourcesData resources = (ResourcesData)bootConfig.resources; string resourceExtension = Path.GetExtension(resourceName); - if (resourceName.StartsWith("dotnet.native.worker", StringComparison.OrdinalIgnoreCase) && string.Equals(resourceExtension, ".mjs", StringComparison.OrdinalIgnoreCase)) - return resources.jsModuleWorker ??= new(); - else if (resourceName.StartsWith("dotnet.diagnostics", StringComparison.OrdinalIgnoreCase) && string.Equals(resourceExtension, ".js", StringComparison.OrdinalIgnoreCase)) + if (resourceName.StartsWith("dotnet.diagnostics", StringComparison.OrdinalIgnoreCase) && string.Equals(resourceExtension, ".js", StringComparison.OrdinalIgnoreCase)) return resources.jsModuleDiagnostics ??= new(); else if (resourceName.StartsWith("dotnet.native", StringComparison.OrdinalIgnoreCase) && string.Equals(resourceExtension, ".js", StringComparison.OrdinalIgnoreCase)) return resources.jsModuleNative ??= new(); @@ -216,7 +213,6 @@ public string TransformResourcesToAssets(BootJsonData config, bool bundlerFriend assets.hash = resources.hash; assets.jsModuleRuntime = MapJsAssets(resources.jsModuleRuntime); assets.jsModuleNative = MapJsAssets(resources.jsModuleNative); - assets.jsModuleWorker = MapJsAssets(resources.jsModuleWorker); assets.jsModuleDiagnostics = MapJsAssets(resources.jsModuleDiagnostics); assets.wasmNative = resources.wasmNative?.Select(a => diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs index 716e468f6836af..063a365ae53163 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs @@ -182,14 +182,11 @@ public class ResourcesData /// .NET Wasm runtime resources (dotnet.wasm, dotnet.js) etc. /// /// - /// Deprecated in .NET 8, use , , , , , . + /// Deprecated in .NET 8, use , , , , . /// [DataMember(EmitDefaultValue = false)] public ResourceHashesByNameDictionary runtime { get; set; } - [DataMember(EmitDefaultValue = false)] - public ResourceHashesByNameDictionary jsModuleWorker { get; set; } - [DataMember(EmitDefaultValue = false)] public ResourceHashesByNameDictionary jsModuleDiagnostics { get; set; } @@ -284,9 +281,6 @@ public class AssetsData /// public string hash { get; set; } - [DataMember(EmitDefaultValue = false)] - public List jsModuleWorker { get; set; } - [DataMember(EmitDefaultValue = false)] public List jsModuleDiagnostics { get; set; } From 046eeae627871ee4e228f652e197f42f9d17ad5b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 16 Jun 2026 10:48:02 +0200 Subject: [PATCH 062/101] pthread_self --- src/mono/browser/build/BrowserWasmApp.targets | 3 +++ src/mono/browser/runtime/cwraps.ts | 2 ++ src/mono/browser/runtime/pthreads/index.ts | 2 +- src/mono/browser/runtime/pthreads/shared.ts | 5 ----- src/mono/browser/runtime/pthreads/ui-thread.ts | 9 +++++---- src/mono/browser/runtime/pthreads/worker-thread.ts | 7 ++++--- src/mono/browser/runtime/startup.ts | 4 ++-- .../browser-threads/Wasm.Browser.Threads.Sample.csproj | 4 ++++ 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index abd29df31be14d..3937ca4624c841 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -311,6 +311,9 @@ + + + <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-js.a diff --git a/src/mono/browser/runtime/cwraps.ts b/src/mono/browser/runtime/cwraps.ts index 1acc3e00204907..6a4f602484a990 100644 --- a/src/mono/browser/runtime/cwraps.ts +++ b/src/mono/browser/runtime/cwraps.ts @@ -27,6 +27,7 @@ const threading_cwraps: SigLine[] = WasmEnableThreads ? [ [true, "mono_wasm_print_thread_dump", "void", []], [true, "mono_wasm_synchronization_context_pump", "void", []], [true, "mono_threads_wasm_sync_run_in_target_thread_done", "void", ["number"]], + [true, "pthread_self", "number", []], ] : []; // when the method is assigned/cached at usage, instead of being invoked directly from cwraps, it can't be marked lazy, because it would be re-bound on each call @@ -149,6 +150,7 @@ export interface t_ThreadingCwraps { mono_wasm_print_thread_dump(): void; mono_wasm_synchronization_context_pump(): void; mono_threads_wasm_sync_run_in_target_thread_done(sem: VoidPtr): void; + pthread_self(): PThreadPtr; } export interface t_ProfilerCwraps { diff --git a/src/mono/browser/runtime/pthreads/index.ts b/src/mono/browser/runtime/pthreads/index.ts index 484f66ddf3c9aa..953412e8043193 100644 --- a/src/mono/browser/runtime/pthreads/index.ts +++ b/src/mono/browser/runtime/pthreads/index.ts @@ -6,7 +6,7 @@ import { utf16ToString } from "../strings"; export { mono_wasm_main_thread_ptr, - mono_wasm_pthread_ptr, update_thread_info, isMonoThreadMessage, monoThreadInfo, + update_thread_info, isMonoThreadMessage, monoThreadInfo, } from "./shared"; export { SystemInteropJS_InstallWebWorkerInteropImpl, SystemInteropJS_UninstallWebWorkerInterop } from "./worker-interop"; export { diff --git a/src/mono/browser/runtime/pthreads/shared.ts b/src/mono/browser/runtime/pthreads/shared.ts index 93e62b0a289191..3596bcf47b4edf 100644 --- a/src/mono/browser/runtime/pthreads/shared.ts +++ b/src/mono/browser/runtime/pthreads/shared.ts @@ -89,11 +89,6 @@ export function mono_wasm_schedule_synchronization_context (): void { Module.safeSetTimeout(exec_synchronization_context_pump, 0); } -export function mono_wasm_pthread_ptr (): PThreadPtr { - if (!WasmEnableThreads) return PThreadPtrNull; - return (Module)["_pthread_self"](); -} - export function mono_wasm_main_thread_ptr (): PThreadPtr { if (!WasmEnableThreads) return PThreadPtrNull; return (Module)["_emscripten_main_runtime_thread_id"](); diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index b9036aecfbeae6..83a2e74889ef51 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -5,10 +5,11 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import BuildConfiguration from "consts:configuration"; import { } from "../globals"; -import { MonoWorkerToMainMessage, monoThreadInfo, mono_wasm_pthread_ptr, update_thread_info, worker_empty_prefix } from "./shared"; +import { MonoWorkerToMainMessage, monoThreadInfo, update_thread_info, worker_empty_prefix } from "./shared"; import { Module, ENVIRONMENT_IS_WORKER, createPromiseController, loaderHelpers, mono_assert, runtimeHelpers } from "../globals"; import { PThreadLibrary, MainToWorkerMessageType, MonoThreadMessage, PThreadInfo, PThreadPtr, PThreadPtrNull, PThreadWorker, PromiseController, Thread, WorkerToMainMessageType, monoMessageSymbol } from "../types/internal"; import { mono_log_info, mono_log_debug, mono_log_warn } from "../logging"; +import { threads_c_functions as tcwraps } from "../cwraps"; const threadPromises: Map[]> = new Map(); @@ -142,7 +143,7 @@ export async function mono_wasm_init_threads () { if (!WasmEnableThreads) return; // setup the UI thread - runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = mono_wasm_pthread_ptr(); + runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = tcwraps.pthread_self(); monoThreadInfo.threadName = "UI Thread"; monoThreadInfo.isUI = true; monoThreadInfo.isRunning = true; @@ -281,9 +282,9 @@ function getNewWorker (modulePThread: PThreadLibrary): PThreadWorker { function allocateUnusedWorker (): PThreadWorker { if (!WasmEnableThreads) return null as any; - const asset = loaderHelpers.resolve_single_asset_path("js-module-threads"); + const asset = loaderHelpers.resolve_single_asset_path("js-module-native"); const uri = asset.resolvedUrl; - mono_assert(uri !== undefined, "could not resolve the uri for the js-module-threads asset"); + mono_assert(uri !== undefined, "could not resolve the uri for the js-module-native asset"); const workerNumber = loaderHelpers.workerNextNumber++; const worker = new Worker(uri, { name: "dotnet-worker-" + workerNumber.toString().padStart(3, "0"), diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 5b2a0b551ced5e..48d44c15da3d41 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -6,7 +6,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import { ENVIRONMENT_IS_PTHREAD, Module, loaderHelpers, mono_assert, runtimeHelpers } from "../globals"; -import { PThreadSelf, monoThreadInfo, mono_wasm_pthread_ptr, postMessageToMain, update_thread_info } from "./shared"; +import { PThreadSelf, monoThreadInfo, postMessageToMain, update_thread_info } from "./shared"; import { PThreadLibrary, MonoThreadMessage, PThreadInfo, PThreadPtr, WorkerToMainMessageType } from "../types/internal"; import { makeWorkerThreadEvent, @@ -19,6 +19,7 @@ import { mono_log_debug, mono_log_error } from "../logging"; import { CharPtr } from "../types/emscripten"; import { utf8ToString } from "../strings"; import { forceThreadMemoryViewRefresh } from "../memory"; +import { threads_c_functions as tcwraps } from "../cwraps"; // re-export some of the events types export { @@ -80,8 +81,8 @@ export function mono_wasm_pthread_on_pthread_created (): void { if (!WasmEnableThreads) return; try { forceThreadMemoryViewRefresh(); - const pthread_id = mono_wasm_pthread_ptr(); - mono_assert(pthread_id == monoThreadInfo.pthreadId, `needs to match (mono_wasm_pthread_ptr ${pthread_id}, threadId from thread info ${monoThreadInfo.pthreadId})`); + const pthread_id = tcwraps.pthread_self(); + mono_assert(pthread_id == monoThreadInfo.pthreadId, `needs to match (pthread_ptr ${pthread_id}, threadId from thread info ${monoThreadInfo.pthreadId})`); monoThreadInfo.reuseCount++; monoThreadInfo.updateCount++; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 25093725766169..70c0e60da5594c 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -25,7 +25,7 @@ import { mono_log_debug, mono_log_error, mono_log_info, mono_log_warn } from "./ // threads import { populateEmscriptenPool, mono_wasm_init_threads } from "./pthreads"; import { currentWorkerThreadEvents, dotnetPthreadCreated, initWorkerThreadEvents, monoThreadInfo } from "./pthreads"; -import { mono_wasm_pthread_ptr, update_thread_info } from "./pthreads"; +import { update_thread_info } from "./pthreads"; import { jiterpreter_allocate_tables } from "./jiterpreter-support"; import { localHeapViewU8, malloc, setU32, fixupPointer } from "./memory"; import { assertNoProxies } from "./gc-handles"; @@ -473,7 +473,7 @@ export async function start_runtime () { monoThreadInfo.isAttached = true; monoThreadInfo.isRunning = true; monoThreadInfo.isRegistered = true; - runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = runtimeHelpers.managedThreadTID = mono_wasm_pthread_ptr(); + runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = runtimeHelpers.managedThreadTID = tcwraps.pthread_self(); update_thread_info(); runtimeHelpers.isManagedRunningOnCurrentThread = true; } diff --git a/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj b/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj index 95f97960be068c..1858d246b3dd50 100644 --- a/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj +++ b/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj @@ -1,6 +1,10 @@ true + true + false + false + false From 7062e2a3d37267bebf05cbd235efeb7c3d747d05 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 16 Jun 2026 16:30:28 +0200 Subject: [PATCH 063/101] fix MT --- src/mono/browser/runtime/loader/assets.ts | 3 +- src/mono/browser/runtime/loader/config.ts | 2 +- src/mono/browser/runtime/loader/globals.ts | 2 +- src/mono/browser/runtime/loader/run.ts | 18 +++++++-- src/mono/browser/runtime/loader/worker.ts | 15 +++++--- .../browser/runtime/pthreads/ui-thread.ts | 37 ++++++++++--------- .../browser/runtime/pthreads/worker-thread.ts | 6 +-- src/mono/browser/runtime/startup.ts | 1 + src/mono/browser/runtime/types/internal.ts | 4 +- .../wasm/browser-threads/wwwroot/main.js | 1 + 10 files changed, 54 insertions(+), 35 deletions(-) diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 2993c2c70d9587..249d2ec8a224e6 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -771,11 +771,10 @@ export async function streamingCompileWasm () { export function preloadWorkers () { if (!WasmEnableThreads) return; - const jsModuleNative = resolve_single_asset_path("js-module-native"); const loadingWorkers = []; for (let i = 0; i < loaderHelpers.config.pthreadPoolInitialSize!; i++) { const workerNumber = loaderHelpers.workerNextNumber++; - const worker: Partial = new Worker(jsModuleNative.resolvedUrl!, { + const worker: Partial = new Worker(loaderHelpers.scriptUrl, { name: "dotnet-worker-" + workerNumber.toString().padStart(3, "0"), type: "module", }); diff --git a/src/mono/browser/runtime/loader/config.ts b/src/mono/browser/runtime/loader/config.ts index 6c833df15c0e88..13a58da1a58132 100644 --- a/src/mono/browser/runtime/loader/config.ts +++ b/src/mono/browser/runtime/loader/config.ts @@ -194,7 +194,7 @@ export function normalizeConfig () { if (WasmEnableThreads) { if (!Number.isInteger(config.pthreadPoolInitialSize)) { - config.pthreadPoolInitialSize = 5; + config.pthreadPoolInitialSize = 7; } if (!Number.isInteger(config.pthreadPoolUnusedSize)) { config.pthreadPoolUnusedSize = 1; diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 98f6dfd30bf24c..f0fa34da47596a 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -20,7 +20,7 @@ import { invokeLibraryInitializers } from "./libraryInitializers"; import { deep_merge_config, isDebuggingSupported } from "./config"; // if we are ST build or the first script loaded in the web worker, we are expected to become the sidecar -if (typeof importScripts === "function" && (!WasmEnableThreads || !globalThis.onmessage)) { +if (typeof importScripts === "function" && (!WasmEnableThreads)) { (globalThis as any).dotnetSidecar = true; } diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index ba803cc29d87de..2fc2be03753fbd 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -324,9 +324,7 @@ export async function createEmscripten (moduleFactory: DotnetModuleConfig | ((ap registerEmscriptenExitHandlers(); - return emscriptenModule.ENVIRONMENT_IS_PTHREAD - ? createEmscriptenWorker() - : createEmscriptenMain(); + return createEmscriptenMain(); } let jsModuleRuntimePromise: Promise; @@ -463,7 +461,21 @@ async function createEmscriptenWorker (): Promise { const promises = importModules(); const es6Modules = await Promise.all(promises); + (globalThis as any).name = "em-pthread"; await initializeModules(es6Modules as any); + self.dispatchEvent(new MessageEvent("message", { + data: { + cmd: "load", + handlers: emscriptenModule.handlers, + wasmMemory: emscriptenModule.wasmMemory, + wasmModule: emscriptenModule.wasmModule + } + })); + return emscriptenModule; } + +if (ENVIRONMENT_IS_WORKER) { + createEmscriptenWorker(); +} diff --git a/src/mono/browser/runtime/loader/worker.ts b/src/mono/browser/runtime/loader/worker.ts index c171211c0c6d8f..8d7b9f6f87a3c4 100644 --- a/src/mono/browser/runtime/loader/worker.ts +++ b/src/mono/browser/runtime/loader/worker.ts @@ -2,9 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. import { MonoConfigInternal, PThreadInfo, WorkerToMainMessageType, monoMessageSymbol } from "../types/internal"; -import { MonoConfig } from "../types"; import { deep_merge_config, normalizeConfig } from "./config"; -import { ENVIRONMENT_IS_WEB, loaderHelpers, runtimeHelpers } from "./globals"; +import { emscriptenModule, ENVIRONMENT_IS_WEB, loaderHelpers, runtimeHelpers } from "./globals"; import { mono_log_debug } from "./logging"; export function setupPreloadChannelToMainThread () { @@ -12,9 +11,7 @@ export function setupPreloadChannelToMainThread () { const workerPort = channel.port1; const mainPort = channel.port2; workerPort.addEventListener("message", (event) => { - const config = JSON.parse(event.data.config) as MonoConfig; - const monoThreadInfo = JSON.parse(event.data.monoThreadInfo) as PThreadInfo; - onMonoConfigReceived(config, monoThreadInfo); + onMonoConfigReceived(event.data); workerPort.close(); mainPort.close(); }, { once: true }); @@ -31,7 +28,13 @@ export function setupPreloadChannelToMainThread () { let workerMonoConfigReceived = false; // called when the main thread sends us the mono config -function onMonoConfigReceived (config: MonoConfigInternal, monoThreadInfo: PThreadInfo): void { +async function onMonoConfigReceived (data: any): Promise { + const config = JSON.parse(data.config) as MonoConfigInternal; + const monoThreadInfo = JSON.parse(data.monoThreadInfo) as PThreadInfo; + emscriptenModule.config = config; + emscriptenModule.wasmModule = data.wasmModule; + emscriptenModule.wasmMemory = data.wasmMemory; + emscriptenModule.handlers = data.handlers; if (workerMonoConfigReceived) { mono_log_debug("mono config already received"); return; diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 83a2e74889ef51..0bf380c9e6869d 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -54,7 +54,7 @@ export function resolveThreadPromises (pthreadPtr: PThreadPtr, thread?: Thread): } // handler that runs in the main thread when a message is received from a pthread worker -function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent): void { +function monoWorkerMessageHandler (worker: PThreadWorker, wasmModule: WebAssembly.Module, ev: MessageEvent): void { if (!WasmEnableThreads) return; let pthreadId: PThreadPtr; // this is emscripten message @@ -75,6 +75,14 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) let thread: Thread; pthreadId = message.info?.pthreadId ?? 0; worker.info = Object.assign({}, worker.info, message.info); + const wasmMemory = runtimeHelpers.getMemory(); + const handlers = []; + const knownHandlers = ["onExit", "onAbort", "print", "printErr"]; + for (const handler of knownHandlers) { + if (Object.prototype.propertyIsEnumerable.call(Module, handler)) { + handlers.push(handler); + } + } switch (message.monoCmd) { case WorkerToMainMessageType.preload: // this one shot port from setupPreloadChannelToMainThread @@ -83,6 +91,9 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) cmd: MainToWorkerMessageType.applyConfig, config: JSON.stringify(runtimeHelpers.config), monoThreadInfo: JSON.stringify(worker.info), + handlers, + wasmMemory, + wasmModule }); break; case WorkerToMainMessageType.pthreadCreated: @@ -118,17 +129,6 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) } } -/// Called by Emscripten internals on the browser thread when a new pthread worker is created and added to the pthread worker pool. -/// At this point the worker doesn't have any pthread assigned to it, yet. -export function onWorkerLoadInitiated (worker: PThreadWorker, loaded: Promise): void { - if (!WasmEnableThreads) return; - worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, ev)); - loaded.then(() => { - worker.info.isLoaded = true; - }); -} - - export async function populateEmscriptenPool (): Promise { if (!WasmEnableThreads) return; const unused = getUnusedWorkerPool(); @@ -211,9 +211,13 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void const originalLoadWasmModuleToWorker = modulePThread.loadWasmModuleToWorker; const originalReturnWorkerToPool = modulePThread.returnWorkerToPool; - modulePThread.loadWasmModuleToWorker = (worker: PThreadWorker): Promise => { + modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { + const wasmModule = await loaderHelpers.wasmCompilePromise.promise; + worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, wasmModule, ev)); const afterLoaded = originalLoadWasmModuleToWorker(worker); - onWorkerLoadInitiated(worker, afterLoaded); + afterLoaded.then(() => { + worker.info.isLoaded = true; + }); if (loaderHelpers.config.exitOnUnhandledError) { worker.onerror = (e) => { loaderHelpers.mono_exit(1, e); @@ -282,9 +286,8 @@ function getNewWorker (modulePThread: PThreadLibrary): PThreadWorker { function allocateUnusedWorker (): PThreadWorker { if (!WasmEnableThreads) return null as any; - const asset = loaderHelpers.resolve_single_asset_path("js-module-native"); - const uri = asset.resolvedUrl; - mono_assert(uri !== undefined, "could not resolve the uri for the js-module-native asset"); + const uri = loaderHelpers.scriptUrl; + mono_assert(uri !== undefined, "could not resolve the uri for the js-module-dotnet asset"); const workerNumber = loaderHelpers.workerNextNumber++; const worker = new Worker(uri, { name: "dotnet-worker-" + workerNumber.toString().padStart(3, "0"), diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 48d44c15da3d41..26acddaa7b53fd 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -14,7 +14,7 @@ import { dotnetPthreadAttached, WorkerThreadEventTarget } from "./worker-events"; -import { postRunWorker, preRunWorker } from "../startup"; +import { postRunWorker } from "../startup"; import { mono_log_debug, mono_log_error } from "../logging"; import { CharPtr } from "../types/emscripten"; import { utf8ToString } from "../strings"; @@ -81,8 +81,7 @@ export function mono_wasm_pthread_on_pthread_created (): void { if (!WasmEnableThreads) return; try { forceThreadMemoryViewRefresh(); - const pthread_id = tcwraps.pthread_self(); - mono_assert(pthread_id == monoThreadInfo.pthreadId, `needs to match (pthread_ptr ${pthread_id}, threadId from thread info ${monoThreadInfo.pthreadId})`); + monoThreadInfo.pthreadId = tcwraps.pthread_self(); monoThreadInfo.reuseCount++; monoThreadInfo.updateCount++; @@ -129,7 +128,6 @@ export function mono_wasm_pthread_on_pthread_registered (pthread_id: PThreadPtr) monoCmd: WorkerToMainMessageType.monoRegistered, info: monoThreadInfo, }); - preRunWorker(); } catch (err) { mono_log_error("mono_wasm_pthread_on_pthread_registered () failed", err); loaderHelpers.mono_exit(1, err); diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 70c0e60da5594c..37fa068809cbd2 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -146,6 +146,7 @@ async function instantiateWasmWorker ( const instance = new WebAssembly.Instance(Module.wasmModule!, imports); successCallback(instance, undefined); Module.wasmModule = null; + preRunWorker(); } diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index 5412d6292ec6ad..e4fd0e3bd4607a 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -436,7 +436,9 @@ export declare interface EmscriptenModuleInternal { mainScriptUrlOrBlob?: string; ENVIRONMENT_IS_PTHREAD?: boolean; FS: any; - wasmModule: WebAssembly.Instance | null; + wasmModule: WebAssembly.Module | null; + wasmMemory: WebAssembly.Memory | null; + handlers: any; wasmExports: any; getWasmTableEntry(index: number): any; removeRunDependency(id: string): void; diff --git a/src/mono/sample/wasm/browser-threads/wwwroot/main.js b/src/mono/sample/wasm/browser-threads/wwwroot/main.js index 9befe7d600c693..5653a68c15a1cf 100644 --- a/src/mono/sample/wasm/browser-threads/wwwroot/main.js +++ b/src/mono/sample/wasm/browser-threads/wwwroot/main.js @@ -19,6 +19,7 @@ try { exitOnUnhandledError: true, logExitCode: true, jsThreadBlockingMode: "WarnWhenBlockingWait", + pthreadPoolInitialSize: 15, }) .create(); From 1c17b78857a32ef7ab7819d9a1e5bae1839d9fc7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 16 Jun 2026 17:36:50 +0200 Subject: [PATCH 064/101] fix MT --- src/mono/browser/build/BrowserWasmApp.targets | 3 ++ src/mono/browser/runtime/cwraps.ts | 2 + src/mono/browser/runtime/loader/config.ts | 2 +- src/mono/browser/runtime/loader/worker.ts | 15 +++++--- src/mono/browser/runtime/pthreads/index.ts | 2 +- src/mono/browser/runtime/pthreads/shared.ts | 5 --- .../browser/runtime/pthreads/ui-thread.ts | 37 +++++++++++-------- .../browser/runtime/pthreads/worker-thread.ts | 9 ++--- src/mono/browser/runtime/startup.ts | 5 ++- src/mono/browser/runtime/types/internal.ts | 4 +- .../Wasm.Browser.Threads.Sample.csproj | 4 ++ .../wasm/browser-threads/wwwroot/main.js | 1 + 12 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index ea0b33bb83ebeb..32541ff00fd668 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -309,6 +309,9 @@ + + + <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-js.a diff --git a/src/mono/browser/runtime/cwraps.ts b/src/mono/browser/runtime/cwraps.ts index 1acc3e00204907..6a4f602484a990 100644 --- a/src/mono/browser/runtime/cwraps.ts +++ b/src/mono/browser/runtime/cwraps.ts @@ -27,6 +27,7 @@ const threading_cwraps: SigLine[] = WasmEnableThreads ? [ [true, "mono_wasm_print_thread_dump", "void", []], [true, "mono_wasm_synchronization_context_pump", "void", []], [true, "mono_threads_wasm_sync_run_in_target_thread_done", "void", ["number"]], + [true, "pthread_self", "number", []], ] : []; // when the method is assigned/cached at usage, instead of being invoked directly from cwraps, it can't be marked lazy, because it would be re-bound on each call @@ -149,6 +150,7 @@ export interface t_ThreadingCwraps { mono_wasm_print_thread_dump(): void; mono_wasm_synchronization_context_pump(): void; mono_threads_wasm_sync_run_in_target_thread_done(sem: VoidPtr): void; + pthread_self(): PThreadPtr; } export interface t_ProfilerCwraps { diff --git a/src/mono/browser/runtime/loader/config.ts b/src/mono/browser/runtime/loader/config.ts index 36128ce2230754..e0618be5918a46 100644 --- a/src/mono/browser/runtime/loader/config.ts +++ b/src/mono/browser/runtime/loader/config.ts @@ -201,7 +201,7 @@ export function normalizeConfig () { if (WasmEnableThreads) { if (!Number.isInteger(config.pthreadPoolInitialSize)) { - config.pthreadPoolInitialSize = 5; + config.pthreadPoolInitialSize = 7; } if (!Number.isInteger(config.pthreadPoolUnusedSize)) { config.pthreadPoolUnusedSize = 1; diff --git a/src/mono/browser/runtime/loader/worker.ts b/src/mono/browser/runtime/loader/worker.ts index c171211c0c6d8f..8d7b9f6f87a3c4 100644 --- a/src/mono/browser/runtime/loader/worker.ts +++ b/src/mono/browser/runtime/loader/worker.ts @@ -2,9 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. import { MonoConfigInternal, PThreadInfo, WorkerToMainMessageType, monoMessageSymbol } from "../types/internal"; -import { MonoConfig } from "../types"; import { deep_merge_config, normalizeConfig } from "./config"; -import { ENVIRONMENT_IS_WEB, loaderHelpers, runtimeHelpers } from "./globals"; +import { emscriptenModule, ENVIRONMENT_IS_WEB, loaderHelpers, runtimeHelpers } from "./globals"; import { mono_log_debug } from "./logging"; export function setupPreloadChannelToMainThread () { @@ -12,9 +11,7 @@ export function setupPreloadChannelToMainThread () { const workerPort = channel.port1; const mainPort = channel.port2; workerPort.addEventListener("message", (event) => { - const config = JSON.parse(event.data.config) as MonoConfig; - const monoThreadInfo = JSON.parse(event.data.monoThreadInfo) as PThreadInfo; - onMonoConfigReceived(config, monoThreadInfo); + onMonoConfigReceived(event.data); workerPort.close(); mainPort.close(); }, { once: true }); @@ -31,7 +28,13 @@ export function setupPreloadChannelToMainThread () { let workerMonoConfigReceived = false; // called when the main thread sends us the mono config -function onMonoConfigReceived (config: MonoConfigInternal, monoThreadInfo: PThreadInfo): void { +async function onMonoConfigReceived (data: any): Promise { + const config = JSON.parse(data.config) as MonoConfigInternal; + const monoThreadInfo = JSON.parse(data.monoThreadInfo) as PThreadInfo; + emscriptenModule.config = config; + emscriptenModule.wasmModule = data.wasmModule; + emscriptenModule.wasmMemory = data.wasmMemory; + emscriptenModule.handlers = data.handlers; if (workerMonoConfigReceived) { mono_log_debug("mono config already received"); return; diff --git a/src/mono/browser/runtime/pthreads/index.ts b/src/mono/browser/runtime/pthreads/index.ts index 484f66ddf3c9aa..953412e8043193 100644 --- a/src/mono/browser/runtime/pthreads/index.ts +++ b/src/mono/browser/runtime/pthreads/index.ts @@ -6,7 +6,7 @@ import { utf16ToString } from "../strings"; export { mono_wasm_main_thread_ptr, - mono_wasm_pthread_ptr, update_thread_info, isMonoThreadMessage, monoThreadInfo, + update_thread_info, isMonoThreadMessage, monoThreadInfo, } from "./shared"; export { SystemInteropJS_InstallWebWorkerInteropImpl, SystemInteropJS_UninstallWebWorkerInterop } from "./worker-interop"; export { diff --git a/src/mono/browser/runtime/pthreads/shared.ts b/src/mono/browser/runtime/pthreads/shared.ts index 93e62b0a289191..3596bcf47b4edf 100644 --- a/src/mono/browser/runtime/pthreads/shared.ts +++ b/src/mono/browser/runtime/pthreads/shared.ts @@ -89,11 +89,6 @@ export function mono_wasm_schedule_synchronization_context (): void { Module.safeSetTimeout(exec_synchronization_context_pump, 0); } -export function mono_wasm_pthread_ptr (): PThreadPtr { - if (!WasmEnableThreads) return PThreadPtrNull; - return (Module)["_pthread_self"](); -} - export function mono_wasm_main_thread_ptr (): PThreadPtr { if (!WasmEnableThreads) return PThreadPtrNull; return (Module)["_emscripten_main_runtime_thread_id"](); diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index b9036aecfbeae6..b15de7dd887230 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -5,10 +5,11 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import BuildConfiguration from "consts:configuration"; import { } from "../globals"; -import { MonoWorkerToMainMessage, monoThreadInfo, mono_wasm_pthread_ptr, update_thread_info, worker_empty_prefix } from "./shared"; +import { MonoWorkerToMainMessage, monoThreadInfo, update_thread_info, worker_empty_prefix } from "./shared"; import { Module, ENVIRONMENT_IS_WORKER, createPromiseController, loaderHelpers, mono_assert, runtimeHelpers } from "../globals"; import { PThreadLibrary, MainToWorkerMessageType, MonoThreadMessage, PThreadInfo, PThreadPtr, PThreadPtrNull, PThreadWorker, PromiseController, Thread, WorkerToMainMessageType, monoMessageSymbol } from "../types/internal"; import { mono_log_info, mono_log_debug, mono_log_warn } from "../logging"; +import { threads_c_functions as tcwraps } from "../cwraps"; const threadPromises: Map[]> = new Map(); @@ -53,7 +54,7 @@ export function resolveThreadPromises (pthreadPtr: PThreadPtr, thread?: Thread): } // handler that runs in the main thread when a message is received from a pthread worker -function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent): void { +function monoWorkerMessageHandler (worker: PThreadWorker, wasmModule: WebAssembly.Module, ev: MessageEvent): void { if (!WasmEnableThreads) return; let pthreadId: PThreadPtr; // this is emscripten message @@ -74,6 +75,14 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) let thread: Thread; pthreadId = message.info?.pthreadId ?? 0; worker.info = Object.assign({}, worker.info, message.info); + const wasmMemory = runtimeHelpers.getMemory(); + const handlers = []; + const knownHandlers = ["onExit", "onAbort", "print", "printErr"]; + for (const handler of knownHandlers) { + if (Object.prototype.propertyIsEnumerable.call(Module, handler)) { + handlers.push(handler); + } + } switch (message.monoCmd) { case WorkerToMainMessageType.preload: // this one shot port from setupPreloadChannelToMainThread @@ -82,6 +91,9 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) cmd: MainToWorkerMessageType.applyConfig, config: JSON.stringify(runtimeHelpers.config), monoThreadInfo: JSON.stringify(worker.info), + handlers, + wasmMemory, + wasmModule }); break; case WorkerToMainMessageType.pthreadCreated: @@ -117,17 +129,6 @@ function monoWorkerMessageHandler (worker: PThreadWorker, ev: MessageEvent) } } -/// Called by Emscripten internals on the browser thread when a new pthread worker is created and added to the pthread worker pool. -/// At this point the worker doesn't have any pthread assigned to it, yet. -export function onWorkerLoadInitiated (worker: PThreadWorker, loaded: Promise): void { - if (!WasmEnableThreads) return; - worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, ev)); - loaded.then(() => { - worker.info.isLoaded = true; - }); -} - - export async function populateEmscriptenPool (): Promise { if (!WasmEnableThreads) return; const unused = getUnusedWorkerPool(); @@ -142,7 +143,7 @@ export async function mono_wasm_init_threads () { if (!WasmEnableThreads) return; // setup the UI thread - runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = mono_wasm_pthread_ptr(); + runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = tcwraps.pthread_self(); monoThreadInfo.threadName = "UI Thread"; monoThreadInfo.isUI = true; monoThreadInfo.isRunning = true; @@ -210,9 +211,13 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void const originalLoadWasmModuleToWorker = modulePThread.loadWasmModuleToWorker; const originalReturnWorkerToPool = modulePThread.returnWorkerToPool; - modulePThread.loadWasmModuleToWorker = (worker: PThreadWorker): Promise => { + modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { + const wasmModule = await loaderHelpers.wasmCompilePromise.promise; + worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, wasmModule, ev)); const afterLoaded = originalLoadWasmModuleToWorker(worker); - onWorkerLoadInitiated(worker, afterLoaded); + afterLoaded.then(() => { + worker.info.isLoaded = true; + }); if (loaderHelpers.config.exitOnUnhandledError) { worker.onerror = (e) => { loaderHelpers.mono_exit(1, e); diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 5b2a0b551ced5e..26acddaa7b53fd 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -6,7 +6,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import { ENVIRONMENT_IS_PTHREAD, Module, loaderHelpers, mono_assert, runtimeHelpers } from "../globals"; -import { PThreadSelf, monoThreadInfo, mono_wasm_pthread_ptr, postMessageToMain, update_thread_info } from "./shared"; +import { PThreadSelf, monoThreadInfo, postMessageToMain, update_thread_info } from "./shared"; import { PThreadLibrary, MonoThreadMessage, PThreadInfo, PThreadPtr, WorkerToMainMessageType } from "../types/internal"; import { makeWorkerThreadEvent, @@ -14,11 +14,12 @@ import { dotnetPthreadAttached, WorkerThreadEventTarget } from "./worker-events"; -import { postRunWorker, preRunWorker } from "../startup"; +import { postRunWorker } from "../startup"; import { mono_log_debug, mono_log_error } from "../logging"; import { CharPtr } from "../types/emscripten"; import { utf8ToString } from "../strings"; import { forceThreadMemoryViewRefresh } from "../memory"; +import { threads_c_functions as tcwraps } from "../cwraps"; // re-export some of the events types export { @@ -80,8 +81,7 @@ export function mono_wasm_pthread_on_pthread_created (): void { if (!WasmEnableThreads) return; try { forceThreadMemoryViewRefresh(); - const pthread_id = mono_wasm_pthread_ptr(); - mono_assert(pthread_id == monoThreadInfo.pthreadId, `needs to match (mono_wasm_pthread_ptr ${pthread_id}, threadId from thread info ${monoThreadInfo.pthreadId})`); + monoThreadInfo.pthreadId = tcwraps.pthread_self(); monoThreadInfo.reuseCount++; monoThreadInfo.updateCount++; @@ -128,7 +128,6 @@ export function mono_wasm_pthread_on_pthread_registered (pthread_id: PThreadPtr) monoCmd: WorkerToMainMessageType.monoRegistered, info: monoThreadInfo, }); - preRunWorker(); } catch (err) { mono_log_error("mono_wasm_pthread_on_pthread_registered () failed", err); loaderHelpers.mono_exit(1, err); diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 25093725766169..37fa068809cbd2 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -25,7 +25,7 @@ import { mono_log_debug, mono_log_error, mono_log_info, mono_log_warn } from "./ // threads import { populateEmscriptenPool, mono_wasm_init_threads } from "./pthreads"; import { currentWorkerThreadEvents, dotnetPthreadCreated, initWorkerThreadEvents, monoThreadInfo } from "./pthreads"; -import { mono_wasm_pthread_ptr, update_thread_info } from "./pthreads"; +import { update_thread_info } from "./pthreads"; import { jiterpreter_allocate_tables } from "./jiterpreter-support"; import { localHeapViewU8, malloc, setU32, fixupPointer } from "./memory"; import { assertNoProxies } from "./gc-handles"; @@ -146,6 +146,7 @@ async function instantiateWasmWorker ( const instance = new WebAssembly.Instance(Module.wasmModule!, imports); successCallback(instance, undefined); Module.wasmModule = null; + preRunWorker(); } @@ -473,7 +474,7 @@ export async function start_runtime () { monoThreadInfo.isAttached = true; monoThreadInfo.isRunning = true; monoThreadInfo.isRegistered = true; - runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = runtimeHelpers.managedThreadTID = mono_wasm_pthread_ptr(); + runtimeHelpers.currentThreadTID = monoThreadInfo.pthreadId = runtimeHelpers.managedThreadTID = tcwraps.pthread_self(); update_thread_info(); runtimeHelpers.isManagedRunningOnCurrentThread = true; } diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index 5412d6292ec6ad..e4fd0e3bd4607a 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -436,7 +436,9 @@ export declare interface EmscriptenModuleInternal { mainScriptUrlOrBlob?: string; ENVIRONMENT_IS_PTHREAD?: boolean; FS: any; - wasmModule: WebAssembly.Instance | null; + wasmModule: WebAssembly.Module | null; + wasmMemory: WebAssembly.Memory | null; + handlers: any; wasmExports: any; getWasmTableEntry(index: number): any; removeRunDependency(id: string): void; diff --git a/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj b/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj index 95f97960be068c..1858d246b3dd50 100644 --- a/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj +++ b/src/mono/sample/wasm/browser-threads/Wasm.Browser.Threads.Sample.csproj @@ -1,6 +1,10 @@ true + true + false + false + false diff --git a/src/mono/sample/wasm/browser-threads/wwwroot/main.js b/src/mono/sample/wasm/browser-threads/wwwroot/main.js index 9befe7d600c693..5653a68c15a1cf 100644 --- a/src/mono/sample/wasm/browser-threads/wwwroot/main.js +++ b/src/mono/sample/wasm/browser-threads/wwwroot/main.js @@ -19,6 +19,7 @@ try { exitOnUnhandledError: true, logExitCode: true, jsThreadBlockingMode: "WarnWhenBlockingWait", + pthreadPoolInitialSize: 15, }) .create(); From 0d0113c603bb448fcf7f00c192bc3a941c973d20 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 10:25:28 +0200 Subject: [PATCH 065/101] fix MT --- src/mono/browser/browser.proj | 1 + src/mono/browser/runtime/loader/assets.ts | 3 +++ src/mono/browser/runtime/loader/run.ts | 22 ++++++++++--------- .../browser/runtime/pthreads/ui-thread.ts | 7 ++++++ .../browser/runtime/pthreads/worker-thread.ts | 2 ++ src/mono/browser/runtime/startup.ts | 1 - src/mono/browser/runtime/types/internal.ts | 2 ++ 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index da3d548fbcc341..34270be1895f80 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -142,6 +142,7 @@ + diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 249d2ec8a224e6..b2fc92a80891c4 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -786,6 +786,9 @@ export function preloadWorkers () { threadPrefix: worker_empty_prefix, threadName: "emscripten-pool", } as any; + worker.queue = []; + worker.handler = (ev) => worker.queue!.push(ev); + worker.addEventListener!("message", worker.handler); loadingWorkers.push(worker as any); } loaderHelpers.loadingWorkers.promise_control.resolve(loadingWorkers); diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index 2fc2be03753fbd..a79dfe24af4cee 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -449,21 +449,23 @@ async function createEmscriptenWorker (): Promise { await loaderHelpers.afterConfigLoaded.promise; prepareAssetsWorker(); - - setTimeout(async () => { - try { - // load subset which is on JS heap rather than in WASM linear memory - await mono_download_assets(); - } catch (err) { - mono_exit(1, err); - } - }, 0); - const promises = importModules(); const es6Modules = await Promise.all(promises); (globalThis as any).name = "em-pthread"; await initializeModules(es6Modules as any); + if (loaderHelpers.config.exitOnUnhandledError) { + installUnhandledErrorHandler(); + } + registerEmscriptenExitHandlers(); + if (ENVIRONMENT_IS_WEB && loaderHelpers.config.forwardConsole && typeof globalThis.WebSocket != "undefined") { + setup_proxy_console("main", globalThis.console, globalThis.location.origin); + } + + await detect_features_and_polyfill(emscriptenModule); + + await mono_download_assets(); + self.dispatchEvent(new MessageEvent("message", { data: { cmd: "load", diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 0bf380c9e6869d..4899011e14d62e 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -213,6 +213,10 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { const wasmModule = await loaderHelpers.wasmCompilePromise.promise; + for (const ev in worker.queue) { + monoWorkerMessageHandler(worker, wasmModule, worker.queue[ev]); + } + worker.queue.length = 0; worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, wasmModule, ev)); const afterLoaded = originalLoadWasmModuleToWorker(worker); afterLoaded.then(() => { @@ -303,6 +307,9 @@ function allocateUnusedWorker (): PThreadWorker { threadPrefix: worker_empty_prefix, threadName: "emscripten-pool", }; + worker.queue = []; + worker.handler = (ev) => worker.queue!.push(ev); + worker.addEventListener!("message", worker.handler); return worker; } diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 26acddaa7b53fd..32cd178db3db83 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -20,6 +20,7 @@ import { CharPtr } from "../types/emscripten"; import { utf8ToString } from "../strings"; import { forceThreadMemoryViewRefresh } from "../memory"; import { threads_c_functions as tcwraps } from "../cwraps"; +import { jiterpreter_allocate_tables } from "../jiterpreter-support"; // re-export some of the events types export { @@ -87,6 +88,7 @@ export function mono_wasm_pthread_on_pthread_created (): void { monoThreadInfo.updateCount++; monoThreadInfo.threadName = "pthread-assigned"; update_thread_info(); + jiterpreter_allocate_tables(); // don't do this callback for the main thread if (!ENVIRONMENT_IS_PTHREAD) return; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 37fa068809cbd2..3d7116f8df0cab 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -158,7 +158,6 @@ export function preRunWorker () { mono_log_debug("preRunWorker"); init_c_exports(); cwraps_internal(INTERNAL); - jiterpreter_allocate_tables(); // this will return quickly if already allocated runtimeHelpers.nativeExit = nativeExit; runtimeHelpers.nativeAbort = nativeAbort; runtimeHelpers.runtimeReady = true; diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index e4fd0e3bd4607a..48f989867fbc81 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -538,6 +538,8 @@ export interface PThreadWorker extends Worker { // this info is updated via async messages from the worker, it could be stale info: PThreadInfo; thread?: Thread; + queue: MessageEvent[]; + handler: ((ev: MessageEvent) => void) | null; } export interface PThreadInfo { From 75669344265c065b4d994caacf7dd5ff7f6a04bc Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 11:00:35 +0200 Subject: [PATCH 066/101] disable MT --- .../templates/browser-wasm-build-tests.yml | 32 ++++++------- eng/pipelines/common/xplat-setup.yml | 4 +- .../runtime-extra-platforms-wasm.yml | 48 +++++++++---------- eng/pipelines/runtime.yml | 20 ++++---- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/eng/pipelines/common/templates/browser-wasm-build-tests.yml b/eng/pipelines/common/templates/browser-wasm-build-tests.yml index 39fca50137411f..278b12ff72ceba 100644 --- a/eng/pipelines/common/templates/browser-wasm-build-tests.yml +++ b/eng/pipelines/common/templates/browser-wasm-build-tests.yml @@ -42,10 +42,10 @@ jobs: jobParameters: dependsOn: - ${{ if eq(platform, 'browser_wasm') }}: - - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly + # - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly - build_browser_wasm_linux_Release_SingleThreaded_BuildOnly - ${{ if eq(platform, 'browser_wasm_win') }}: - - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly + # - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly - build_browser_wasm_windows_Release_SingleThreaded_BuildOnly isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} testGroup: innerloop @@ -69,21 +69,21 @@ jobs: CleanTargetFolder: false # Download for multi-threaded - - task: DownloadBuildArtifacts@0 - displayName: Download built nugets for multi-threaded runtime - inputs: - buildType: current - artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly - downloadType: single - downloadPath: '$(Build.SourcesDirectory)/artifacts' + # - task: DownloadBuildArtifacts@0 + # displayName: Download built nugets for multi-threaded runtime + # inputs: + # buildType: current + # artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly + # downloadType: single + # downloadPath: '$(Build.SourcesDirectory)/artifacts' - - task: CopyFiles@2 - displayName: Copy multithreading runtime pack - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' - Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* - TargetFolder: '$(Build.SourcesDirectory)/artifacts' - CleanTargetFolder: false + # - task: CopyFiles@2 + # displayName: Copy multithreading runtime pack + # inputs: + # SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' + # Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* + # TargetFolder: '$(Build.SourcesDirectory)/artifacts' + # CleanTargetFolder: false # Download WBT - task: DownloadBuildArtifacts@0 diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 1f28b57b49f943..6f4ab2d00f874d 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -139,8 +139,8 @@ jobs: # needed for Wasm.Build.Tests - name: wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline - value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] + # - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline + # value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - ${{ each variable in parameters.variables }}: - ${{ variable }} diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 1fd298c4ecead8..87d6ace0d820a2 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -77,21 +77,21 @@ jobs: - WasmTestOnChrome # Library tests with full threading - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - browser_wasm - #- browser_wasm_win - nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - extraHelixArguments: /p:WasmEnableThreads=true - shouldContinueOnError: true - isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} - isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} - alwaysRun: ${{ parameters.isWasmOnlyBuild }} - shouldRunSmokeOnly: onLibrariesAndIllinkChanges - scenarios: - - WasmTestOnChrome + # - template: /eng/pipelines/common/templates/wasm-library-tests.yml + # parameters: + # platforms: + # - browser_wasm + # #- browser_wasm_win + # nameSuffix: _Threading + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # extraHelixArguments: /p:WasmEnableThreads=true + # shouldContinueOnError: true + # isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} + # isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} + # alwaysRun: ${{ parameters.isWasmOnlyBuild }} + # shouldRunSmokeOnly: onLibrariesAndIllinkChanges + # scenarios: + # - WasmTestOnChrome # EAT Library tests - only run on linux - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml @@ -177,15 +177,15 @@ jobs: publishArtifactsForWorkload: true publishWBT: true - - template: /eng/pipelines/common/templates/wasm-build-only.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - nameSuffix: MultiThreaded - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - publishArtifactsForWorkload: true - publishWBT: false + # - template: /eng/pipelines/common/templates/wasm-build-only.yml + # parameters: + # platforms: + # - browser_wasm + # - browser_wasm_win + # nameSuffix: MultiThreaded + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # publishArtifactsForWorkload: true + # publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 18afad1723cead..dd6ed7996e62fa 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -1040,16 +1040,16 @@ extends: publishArtifactsForWorkload: true publishWBT: true - - template: /eng/pipelines/common/templates/wasm-build-only.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) - nameSuffix: MultiThreaded - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - publishArtifactsForWorkload: true - publishWBT: false + # - template: /eng/pipelines/common/templates/wasm-build-only.yml + # parameters: + # platforms: + # - browser_wasm + # - browser_wasm_win + # condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) + # nameSuffix: MultiThreaded + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # publishArtifactsForWorkload: true + # publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml From c0364e0dc694d1004e7c8e347a9f0e2938719f99 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 11:48:44 +0200 Subject: [PATCH 067/101] =?UTF-8?q?fptrunc=20=E2=86=92=20half=20=E2=86=92?= =?UTF-8?q?=20Infinity=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../System.Runtime.Tests/System/HalfTests.cs | 2 + src/mono/mono/mini/mini-llvm.c | 102 +++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs index 9afb3ce6cfab37..372f5000176490 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs @@ -556,6 +556,7 @@ public static IEnumerable ExplicitConversion_FromSingle_TestData() [MemberData(nameof(ExplicitConversion_FromSingle_TestData))] [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS, TestRuntimes.Mono)] public static void ExplicitConversion_FromSingle(float f, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)f; @@ -654,6 +655,7 @@ public static IEnumerable ExplicitConversion_FromDouble_TestData() [MemberData(nameof(ExplicitConversion_FromDouble_TestData))] [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS, TestRuntimes.Mono)] public static void ExplicitConversion_FromDouble(double d, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)d; diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 7c87297671bf8a..868d3f215fbc99 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -1374,6 +1374,8 @@ resolve_patch (MonoCompile *cfg, MonoJumpInfoType type, gconstpointer target) return res; } +static LLVMValueRef emit_fpnarrow (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype); + /* * convert_full: * @@ -1411,6 +1413,23 @@ convert_full (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype, gboolean is_u if (stype == LLVMDoubleType () && dtype == LLVMFloatType ()) return LLVMBuildFPTrunc (ctx->builder, v, dtype, ""); + /* + * Narrowing a float/double to half (IEEE binary16) must preserve NaN. Route it + * through emit_fpnarrow, which detects a NaN input explicitly and selects a + * canonical quiet NaN, so a target that drops the NaN mantissa during the + * fptrunc (yielding +/-Infinity) cannot turn a NaN into an infinity. Handles + * both scalar and vector half destinations. Mono itself does not emit half + * typed IR today, but keep the central converter correct and NaN-safe instead + * of hitting g_assert_not_reached () below. + */ + if (dtype == LLVMHalfType () && (stype == LLVMFloatType () || stype == LLVMDoubleType ())) + return emit_fpnarrow (ctx, v, dtype); + if (LLVMGetTypeKind (stype) == LLVMVectorTypeKind && LLVMGetTypeKind (dtype) == LLVMVectorTypeKind && + LLVMGetVectorSize (stype) == LLVMGetVectorSize (dtype) && + LLVMGetElementType (dtype) == LLVMHalfType () && + (LLVMGetElementType (stype) == LLVMFloatType () || LLVMGetElementType (stype) == LLVMDoubleType ())) + return emit_fpnarrow (ctx, v, dtype); + #ifdef USE_OPAQUE_POINTERS if (LLVMGetTypeKind (stype) == LLVMPointerTypeKind && LLVMGetTypeKind (dtype) == LLVMPointerTypeKind) return v; @@ -1451,6 +1470,75 @@ convert (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype) return convert_full (ctx, v, dtype, FALSE); } +/* + * quiet_nan_for_fptype: + * + * Return a constant quiet NaN matching the floating point type T. T can be a + * scalar (half/float/double) or a vector of those. + */ +#if LLVM_API_VERSION >= 2300 +static LLVMValueRef +quiet_nan_for_fptype (LLVMTypeRef t) +{ + LLVMTypeRef elem_t = LLVMGetTypeKind (t) == LLVMVectorTypeKind ? LLVMGetElementType (t) : t; + guint64 bits; + LLVMTypeRef int_t; + + switch (LLVMGetTypeKind (elem_t)) { + case LLVMHalfTypeKind: + bits = 0x7e00; /* IEEE binary16 quiet NaN */ + int_t = LLVMInt16Type (); + break; + case LLVMFloatTypeKind: + bits = 0x7fc00000; /* IEEE binary32 quiet NaN */ + int_t = LLVMInt32Type (); + break; + default: + bits = 0x7ff8000000000000ULL; /* IEEE binary64 quiet NaN */ + int_t = LLVMInt64Type (); + break; + } + + LLVMValueRef nan = LLVMConstBitCast (LLVMConstInt (int_t, bits, FALSE), elem_t); + if (LLVMGetTypeKind (t) == LLVMVectorTypeKind) { + unsigned int n = LLVMGetVectorSize (t); + LLVMValueRef elems [MAX_VECTOR_ELEMS]; + g_assert (n <= MAX_VECTOR_ELEMS); + for (unsigned int i = 0; i < n; ++i) + elems [i] = nan; + nan = LLVMConstVector (elems, n); + } + return nan; +} +#endif + +/* + * emit_fpnarrow: + * + * Emit a floating point narrowing conversion (fptrunc) of V to DTYPE which is + * guaranteed to preserve NaN. + * + * Background: the branchless software float->Half (IEEE binary16) conversion used + * by System.Half is, starting with LLVM 23, recognized by the optimizer and may be + * lowered to a hardware narrowing 'fptrunc to '. On some targets + * (e.g. arm64) that narrowing drops the NaN mantissa, leaving an all-ones exponent + * with a zero mantissa, i.e. +/-Infinity. The result is that operations which must + * produce or propagate NaN end up yielding +/-inf. To stay robust against the + * toolchain mis-handling NaN during FP narrowing, detect NaN inputs explicitly and + * select a canonical quiet NaN of the destination type. + */ +static LLVMValueRef +emit_fpnarrow (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype) +{ + LLVMValueRef trunc = LLVMBuildFPTrunc (ctx->builder, v, dtype, ""); +#if LLVM_API_VERSION >= 2300 + /* 'uno' (unordered) is true iff V is NaN, since a NaN is unordered with itself. */ + LLVMValueRef is_nan = LLVMBuildFCmp (ctx->builder, LLVMRealUNO, v, v, ""); + trunc = LLVMBuildSelect (ctx->builder, is_nan, quiet_nan_for_fptype (dtype), trunc, ""); +#endif + return trunc; +} + static void emit_memset (EmitContext *ctx, LLVMValueRef dest, LLVMValueRef val, LLVMValueRef size, int alignment) { @@ -7032,7 +7120,7 @@ MONO_RESTORE_WARNING values [ins->dreg] = LLVMBuildSIToFP (builder, lhs, LLVMFloatType (), ""); break; case OP_FCONV_TO_R4: - values [ins->dreg] = LLVMBuildFPTrunc (builder, lhs, LLVMFloatType (), ""); + values [ins->dreg] = emit_fpnarrow (ctx, lhs, LLVMFloatType ()); break; case OP_RCONV_TO_R8: values [ins->dreg] = LLVMBuildFPExt (builder, lhs, LLVMDoubleType (), dname); @@ -7220,7 +7308,17 @@ MONO_RESTORE_WARNING index = const_int32 (GTMREG_TO_INT (ins->inst_offset / size)); addr = LLVMBuildGEP2 (builder, t, convert (ctx, base, pointer_type (t)), &index, 1, ""); } - LLVMValueRef srcval = convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t); +#if TARGET_SIZEOF_VOID_P == 4 + /* On 32-bit targets IntPtrType () is i32. ins->inst_imm is a host-width value + * that may be negative (i.e. have its upper bits set). Passing it unmasked makes + * LLVMConstInt receive a value outside i32's unsigned width; starting with LLVM 23 + * that produces a malformed ConstantInt with SignExtend FALSE. Mask to 32 bits, + * matching the existing truncation behavior on older LLVM. See const_int32. */ + LLVMValueRef imm_const = LLVMConstInt (IntPtrType (), (guint32)ins->inst_imm, FALSE); +#else + LLVMValueRef imm_const = LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE); +#endif + LLVMValueRef srcval = convert (ctx, imm_const, t); LLVMValueRef ptrdst = convert (ctx, addr, pointer_type (t)); if (is_unaligned) mono_llvm_build_aligned_store (builder, srcval, ptrdst, is_volatile, 1); From 3e9019e42e52d4dba3cd36a7d12e57518eb1f37b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 11:50:17 +0200 Subject: [PATCH 068/101] active issue https://github.com/dotnet/runtime/issues/129508 --- .../JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs | 1 + src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs | 1 + .../JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs | 1 + src/tests/JIT/jit64/localloc/call/call05_large.il | 5 +++++ src/tests/JIT/jit64/localloc/call/call05_small.il | 5 +++++ 5 files changed, 13 insertions(+) diff --git a/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs b/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs index 8d7d0ccb64ef94..89fceaef8a6a2e 100644 --- a/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs +++ b/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs @@ -4696,6 +4696,7 @@ public static void Run() public class Test_boxunboxvaluetype { + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs b/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs index 1d7bbed45bdd2e..d5b23f43397160 100644 --- a/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs +++ b/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs @@ -4695,6 +4695,7 @@ public static void Run() public class Test_castclassvaluetype { + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs b/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs index d958abe234da5e..51106edc3fb893 100644 --- a/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs +++ b/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs @@ -38,6 +38,7 @@ static void WmGetMinMaxInfo(IntPtr lParam) Marshal.StructureToPtr(mmi, lParam, true); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public unsafe static int TestEntryPoint() { diff --git a/src/tests/JIT/jit64/localloc/call/call05_large.il b/src/tests/JIT/jit64/localloc/call/call05_large.il index 4414f6a91377bc..c4b74924e68fa6 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_large.il +++ b/src/tests/JIT/jit64/localloc/call/call05_large.il @@ -7,6 +7,7 @@ .ver 4:0:0:0 } .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .assembly extern mscorlib{} .assembly extern localloc_common{} .assembly 'call05_large'{} @@ -20,6 +21,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 11 .locals (int32* intArray1, diff --git a/src/tests/JIT/jit64/localloc/call/call05_small.il b/src/tests/JIT/jit64/localloc/call/call05_small.il index b973a565fd1563..d78aaeb6e2882c 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_small.il +++ b/src/tests/JIT/jit64/localloc/call/call05_small.il @@ -7,6 +7,7 @@ .ver 4:0:0:0 } .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .assembly extern mscorlib{} .assembly extern localloc_common{} .assembly 'call05_small'{} @@ -20,6 +21,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 11 .locals (int32* intArray1, From dff06ef6df4d9cb0a3f3dd5bb712ee6abfd28207 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 12:02:38 +0200 Subject: [PATCH 069/101] fix MT --- src/mono/browser/browser.proj | 1 + src/mono/browser/runtime/loader/assets.ts | 3 ++ src/mono/browser/runtime/loader/run.ts | 39 ++++++++++++------- .../browser/runtime/pthreads/ui-thread.ts | 7 ++++ .../browser/runtime/pthreads/worker-thread.ts | 2 + src/mono/browser/runtime/startup.ts | 1 - src/mono/browser/runtime/types/internal.ts | 2 + .../Wasm.Advanced.Sample.csproj | 2 + 8 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index b9f72ca324b0fd..93a3f0bd930ccf 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -142,6 +142,7 @@ + diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 76b3291d7de9f9..b23d66a3eac962 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -793,6 +793,9 @@ export function preloadWorkers () { threadPrefix: worker_empty_prefix, threadName: "emscripten-pool", } as any; + worker.queue = []; + worker.handler = (ev) => worker.queue!.push(ev); + worker.addEventListener!("message", worker.handler); loadingWorkers.push(worker as any); } loaderHelpers.loadingWorkers.promise_control.resolve(loadingWorkers); diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index ba803cc29d87de..ce9cca3ed43c28 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -324,9 +324,7 @@ export async function createEmscripten (moduleFactory: DotnetModuleConfig | ((ap registerEmscriptenExitHandlers(); - return emscriptenModule.ENVIRONMENT_IS_PTHREAD - ? createEmscriptenWorker() - : createEmscriptenMain(); + return createEmscriptenMain(); } let jsModuleRuntimePromise: Promise; @@ -451,19 +449,34 @@ async function createEmscriptenWorker (): Promise { await loaderHelpers.afterConfigLoaded.promise; prepareAssetsWorker(); - - setTimeout(async () => { - try { - // load subset which is on JS heap rather than in WASM linear memory - await mono_download_assets(); - } catch (err) { - mono_exit(1, err); - } - }, 0); - const promises = importModules(); const es6Modules = await Promise.all(promises); await initializeModules(es6Modules as any); + if (loaderHelpers.config.exitOnUnhandledError) { + installUnhandledErrorHandler(); + } + registerEmscriptenExitHandlers(); + if (ENVIRONMENT_IS_WEB && loaderHelpers.config.forwardConsole && typeof globalThis.WebSocket != "undefined") { + setup_proxy_console("main", globalThis.console, globalThis.location.origin); + } + + await detect_features_and_polyfill(emscriptenModule); + + await mono_download_assets(); + + self.dispatchEvent(new MessageEvent("message", { + data: { + cmd: "load", + handlers: emscriptenModule.handlers, + wasmMemory: emscriptenModule.wasmMemory, + wasmModule: emscriptenModule.wasmModule + } + })); + return emscriptenModule; } + +if (ENVIRONMENT_IS_WORKER) { + createEmscriptenWorker(); +} diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index b15de7dd887230..24151eb9c86a79 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -213,6 +213,10 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { const wasmModule = await loaderHelpers.wasmCompilePromise.promise; + for (const ev in worker.queue) { + monoWorkerMessageHandler(worker, wasmModule, worker.queue[ev]); + } + worker.queue.length = 0; worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, wasmModule, ev)); const afterLoaded = originalLoadWasmModuleToWorker(worker); afterLoaded.then(() => { @@ -304,6 +308,9 @@ function allocateUnusedWorker (): PThreadWorker { threadPrefix: worker_empty_prefix, threadName: "emscripten-pool", }; + worker.queue = []; + worker.handler = (ev) => worker.queue!.push(ev); + worker.addEventListener!("message", worker.handler); return worker; } diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 26acddaa7b53fd..32cd178db3db83 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -20,6 +20,7 @@ import { CharPtr } from "../types/emscripten"; import { utf8ToString } from "../strings"; import { forceThreadMemoryViewRefresh } from "../memory"; import { threads_c_functions as tcwraps } from "../cwraps"; +import { jiterpreter_allocate_tables } from "../jiterpreter-support"; // re-export some of the events types export { @@ -87,6 +88,7 @@ export function mono_wasm_pthread_on_pthread_created (): void { monoThreadInfo.updateCount++; monoThreadInfo.threadName = "pthread-assigned"; update_thread_info(); + jiterpreter_allocate_tables(); // don't do this callback for the main thread if (!ENVIRONMENT_IS_PTHREAD) return; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 37fa068809cbd2..3d7116f8df0cab 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -158,7 +158,6 @@ export function preRunWorker () { mono_log_debug("preRunWorker"); init_c_exports(); cwraps_internal(INTERNAL); - jiterpreter_allocate_tables(); // this will return quickly if already allocated runtimeHelpers.nativeExit = nativeExit; runtimeHelpers.nativeAbort = nativeAbort; runtimeHelpers.runtimeReady = true; diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index e4fd0e3bd4607a..48f989867fbc81 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -538,6 +538,8 @@ export interface PThreadWorker extends Worker { // this info is updated via async messages from the worker, it could be stale info: PThreadInfo; thread?: Thread; + queue: MessageEvent[]; + handler: ((ev: MessageEvent) => void) | null; } export interface PThreadInfo { diff --git a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj index 815953ebc35a40..365a61629523a8 100644 --- a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj +++ b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj @@ -8,6 +8,8 @@ true true web,worker + false + <_WasmAllowAOTDebug>true -s USE_CLOSURE_COMPILER=1 -s LEGACY_GL_EMULATION=1 -lGL -lSDL -lidbfs.js From 0d1e5b3e8de0f205f97fc0b626cb3b79c2c1798f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 12:02:50 +0200 Subject: [PATCH 070/101] disable MT --- .../templates/browser-wasm-build-tests.yml | 32 ++++++------- eng/pipelines/common/xplat-setup.yml | 4 +- .../runtime-extra-platforms-wasm.yml | 48 +++++++++---------- eng/pipelines/runtime.yml | 20 ++++---- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/eng/pipelines/common/templates/browser-wasm-build-tests.yml b/eng/pipelines/common/templates/browser-wasm-build-tests.yml index 39fca50137411f..278b12ff72ceba 100644 --- a/eng/pipelines/common/templates/browser-wasm-build-tests.yml +++ b/eng/pipelines/common/templates/browser-wasm-build-tests.yml @@ -42,10 +42,10 @@ jobs: jobParameters: dependsOn: - ${{ if eq(platform, 'browser_wasm') }}: - - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly + # - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly - build_browser_wasm_linux_Release_SingleThreaded_BuildOnly - ${{ if eq(platform, 'browser_wasm_win') }}: - - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly + # - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly - build_browser_wasm_windows_Release_SingleThreaded_BuildOnly isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} testGroup: innerloop @@ -69,21 +69,21 @@ jobs: CleanTargetFolder: false # Download for multi-threaded - - task: DownloadBuildArtifacts@0 - displayName: Download built nugets for multi-threaded runtime - inputs: - buildType: current - artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly - downloadType: single - downloadPath: '$(Build.SourcesDirectory)/artifacts' + # - task: DownloadBuildArtifacts@0 + # displayName: Download built nugets for multi-threaded runtime + # inputs: + # buildType: current + # artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly + # downloadType: single + # downloadPath: '$(Build.SourcesDirectory)/artifacts' - - task: CopyFiles@2 - displayName: Copy multithreading runtime pack - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' - Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* - TargetFolder: '$(Build.SourcesDirectory)/artifacts' - CleanTargetFolder: false + # - task: CopyFiles@2 + # displayName: Copy multithreading runtime pack + # inputs: + # SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' + # Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* + # TargetFolder: '$(Build.SourcesDirectory)/artifacts' + # CleanTargetFolder: false # Download WBT - task: DownloadBuildArtifacts@0 diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 1f28b57b49f943..6f4ab2d00f874d 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -139,8 +139,8 @@ jobs: # needed for Wasm.Build.Tests - name: wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline - value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] + # - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline + # value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - ${{ each variable in parameters.variables }}: - ${{ variable }} diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 1fd298c4ecead8..87d6ace0d820a2 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -77,21 +77,21 @@ jobs: - WasmTestOnChrome # Library tests with full threading - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - browser_wasm - #- browser_wasm_win - nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - extraHelixArguments: /p:WasmEnableThreads=true - shouldContinueOnError: true - isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} - isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} - alwaysRun: ${{ parameters.isWasmOnlyBuild }} - shouldRunSmokeOnly: onLibrariesAndIllinkChanges - scenarios: - - WasmTestOnChrome + # - template: /eng/pipelines/common/templates/wasm-library-tests.yml + # parameters: + # platforms: + # - browser_wasm + # #- browser_wasm_win + # nameSuffix: _Threading + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # extraHelixArguments: /p:WasmEnableThreads=true + # shouldContinueOnError: true + # isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} + # isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} + # alwaysRun: ${{ parameters.isWasmOnlyBuild }} + # shouldRunSmokeOnly: onLibrariesAndIllinkChanges + # scenarios: + # - WasmTestOnChrome # EAT Library tests - only run on linux - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml @@ -177,15 +177,15 @@ jobs: publishArtifactsForWorkload: true publishWBT: true - - template: /eng/pipelines/common/templates/wasm-build-only.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - nameSuffix: MultiThreaded - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - publishArtifactsForWorkload: true - publishWBT: false + # - template: /eng/pipelines/common/templates/wasm-build-only.yml + # parameters: + # platforms: + # - browser_wasm + # - browser_wasm_win + # nameSuffix: MultiThreaded + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # publishArtifactsForWorkload: true + # publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 18afad1723cead..dd6ed7996e62fa 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -1040,16 +1040,16 @@ extends: publishArtifactsForWorkload: true publishWBT: true - - template: /eng/pipelines/common/templates/wasm-build-only.yml - parameters: - platforms: - - browser_wasm - - browser_wasm_win - condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) - nameSuffix: MultiThreaded - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - publishArtifactsForWorkload: true - publishWBT: false + # - template: /eng/pipelines/common/templates/wasm-build-only.yml + # parameters: + # platforms: + # - browser_wasm + # - browser_wasm_win + # condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) + # nameSuffix: MultiThreaded + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # publishArtifactsForWorkload: true + # publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml From b85b1d11c18b9e6ba5df4cc9240809e4c1fd5871 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 14:15:41 +0200 Subject: [PATCH 071/101] fix --- .../tests/System.Runtime.Tests/System/HalfTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs index 372f5000176490..c1271ec32fd10a 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs @@ -556,7 +556,7 @@ public static IEnumerable ExplicitConversion_FromSingle_TestData() [MemberData(nameof(ExplicitConversion_FromSingle_TestData))] [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromSingle(float f, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)f; @@ -655,7 +655,7 @@ public static IEnumerable ExplicitConversion_FromDouble_TestData() [MemberData(nameof(ExplicitConversion_FromDouble_TestData))] [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromDouble(double d, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)d; From 631164763b4672f9450c9eaf48bf572c646df0ba Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 14:44:42 +0200 Subject: [PATCH 072/101] fix --- src/mono/browser/runtime/loader/run.ts | 27 +++----------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index ce9cca3ed43c28..b11bfddd8716e6 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -324,7 +324,9 @@ export async function createEmscripten (moduleFactory: DotnetModuleConfig | ((ap registerEmscriptenExitHandlers(); - return createEmscriptenMain(); + return emscriptenModule.ENVIRONMENT_IS_PTHREAD + ? createEmscriptenWorker() + : createEmscriptenMain(); } let jsModuleRuntimePromise: Promise; @@ -453,30 +455,7 @@ async function createEmscriptenWorker (): Promise { const es6Modules = await Promise.all(promises); await initializeModules(es6Modules as any); - if (loaderHelpers.config.exitOnUnhandledError) { - installUnhandledErrorHandler(); - } - registerEmscriptenExitHandlers(); - if (ENVIRONMENT_IS_WEB && loaderHelpers.config.forwardConsole && typeof globalThis.WebSocket != "undefined") { - setup_proxy_console("main", globalThis.console, globalThis.location.origin); - } - - await detect_features_and_polyfill(emscriptenModule); - await mono_download_assets(); - self.dispatchEvent(new MessageEvent("message", { - data: { - cmd: "load", - handlers: emscriptenModule.handlers, - wasmMemory: emscriptenModule.wasmMemory, - wasmModule: emscriptenModule.wasmModule - } - })); - return emscriptenModule; } - -if (ENVIRONMENT_IS_WORKER) { - createEmscriptenWorker(); -} From 73e76a6911f76826c3b5e9d1d7b5ca3e65703120 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 17:03:31 +0200 Subject: [PATCH 073/101] disable broken stuff --- eng/testing/tests.browser.targets | 10 ++++++++-- src/libraries/tests.proj | 4 +--- .../Microsoft.NET.Sdk.WebAssembly.Browser.targets | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/eng/testing/tests.browser.targets b/eng/testing/tests.browser.targets index cefc5b3b52caae..0db156f0ec40be 100644 --- a/eng/testing/tests.browser.targets +++ b/eng/testing/tests.browser.targets @@ -127,10 +127,14 @@ <_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs) $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true - - $(WasmXHarnessMonoArgs) --setenv=IsBrowserThreadingSupported=true 8 + + + + + + <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasm $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT @@ -148,7 +152,9 @@ <_XHarnessArgs Condition="'$(WasmXHarnessVerbosity)' != ''" >$(_XHarnessArgs) --verbosity=$(WasmXHarnessVerbosity) <_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli) + <_AppArgs Condition="'$(WasmXHarnessMaxParallelThreads)' != ''">$(_AppArgs) -parallelThreads $(WasmXHarnessMaxParallelThreads) $HARNESS_RUNNER $(_XHarnessArgs) %24XHARNESS_ARGS %24WasmXHarnessArgs -- $(WasmXHarnessMonoArgs) %24WasmXHarnessMonoArgs $(_AppArgs) %24WasmTestAppArgs diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 7d669d21533042..3783247c6871ff 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -582,9 +582,7 @@ - - - + diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets index ab8d6606aba35e..7e2a6bdb54f174 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets @@ -248,6 +248,9 @@ Copyright (c) .NET Foundation. All rights reserved. + + + From fa63024b192aa19645d5197df52a3de3786390ce Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 17 Jun 2026 17:57:48 +0200 Subject: [PATCH 074/101] keep MT pipelines --- .../templates/browser-wasm-build-tests.yml | 32 ++++++------- eng/pipelines/common/xplat-setup.yml | 4 +- .../runtime-extra-platforms-wasm.yml | 48 +++++++++---------- eng/pipelines/runtime.yml | 20 ++++---- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/eng/pipelines/common/templates/browser-wasm-build-tests.yml b/eng/pipelines/common/templates/browser-wasm-build-tests.yml index 278b12ff72ceba..39fca50137411f 100644 --- a/eng/pipelines/common/templates/browser-wasm-build-tests.yml +++ b/eng/pipelines/common/templates/browser-wasm-build-tests.yml @@ -42,10 +42,10 @@ jobs: jobParameters: dependsOn: - ${{ if eq(platform, 'browser_wasm') }}: - # - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly + - build_browser_wasm_linux_Release_MultiThreaded_BuildOnly - build_browser_wasm_linux_Release_SingleThreaded_BuildOnly - ${{ if eq(platform, 'browser_wasm_win') }}: - # - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly + - build_browser_wasm_windows_Release_MultiThreaded_BuildOnly - build_browser_wasm_windows_Release_SingleThreaded_BuildOnly isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} testGroup: innerloop @@ -69,21 +69,21 @@ jobs: CleanTargetFolder: false # Download for multi-threaded - # - task: DownloadBuildArtifacts@0 - # displayName: Download built nugets for multi-threaded runtime - # inputs: - # buildType: current - # artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly - # downloadType: single - # downloadPath: '$(Build.SourcesDirectory)/artifacts' + - task: DownloadBuildArtifacts@0 + displayName: Download built nugets for multi-threaded runtime + inputs: + buildType: current + artifactName: BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly + downloadType: single + downloadPath: '$(Build.SourcesDirectory)/artifacts' - # - task: CopyFiles@2 - # displayName: Copy multithreading runtime pack - # inputs: - # SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' - # Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* - # TargetFolder: '$(Build.SourcesDirectory)/artifacts' - # CleanTargetFolder: false + - task: CopyFiles@2 + displayName: Copy multithreading runtime pack + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_MultiThreaded_BuildOnly' + Contents: packages/$(_BuildConfig)/Shipping/Microsoft.NETCore.App.Runtime.Mono.multithread.* + TargetFolder: '$(Build.SourcesDirectory)/artifacts' + CleanTargetFolder: false # Download WBT - task: DownloadBuildArtifacts@0 diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 6f4ab2d00f874d..1f28b57b49f943 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -139,8 +139,8 @@ jobs: # needed for Wasm.Build.Tests - name: wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - # - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline - # value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] + - name: wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline + value: $[ variables['shouldRunWasmBuildTestsOnDefaultPipeline'] ] - ${{ each variable in parameters.variables }}: - ${{ variable }} diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 87d6ace0d820a2..1fd298c4ecead8 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -77,21 +77,21 @@ jobs: - WasmTestOnChrome # Library tests with full threading - # - template: /eng/pipelines/common/templates/wasm-library-tests.yml - # parameters: - # platforms: - # - browser_wasm - # #- browser_wasm_win - # nameSuffix: _Threading - # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # extraHelixArguments: /p:WasmEnableThreads=true - # shouldContinueOnError: true - # isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} - # isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} - # alwaysRun: ${{ parameters.isWasmOnlyBuild }} - # shouldRunSmokeOnly: onLibrariesAndIllinkChanges - # scenarios: - # - WasmTestOnChrome + - template: /eng/pipelines/common/templates/wasm-library-tests.yml + parameters: + platforms: + - browser_wasm + #- browser_wasm_win + nameSuffix: _Threading + extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + extraHelixArguments: /p:WasmEnableThreads=true + shouldContinueOnError: true + isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} + isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} + alwaysRun: ${{ parameters.isWasmOnlyBuild }} + shouldRunSmokeOnly: onLibrariesAndIllinkChanges + scenarios: + - WasmTestOnChrome # EAT Library tests - only run on linux - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml @@ -177,15 +177,15 @@ jobs: publishArtifactsForWorkload: true publishWBT: true - # - template: /eng/pipelines/common/templates/wasm-build-only.yml - # parameters: - # platforms: - # - browser_wasm - # - browser_wasm_win - # nameSuffix: MultiThreaded - # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # publishArtifactsForWorkload: true - # publishWBT: false + - template: /eng/pipelines/common/templates/wasm-build-only.yml + parameters: + platforms: + - browser_wasm + - browser_wasm_win + nameSuffix: MultiThreaded + extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + publishArtifactsForWorkload: true + publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index dd6ed7996e62fa..18afad1723cead 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -1040,16 +1040,16 @@ extends: publishArtifactsForWorkload: true publishWBT: true - # - template: /eng/pipelines/common/templates/wasm-build-only.yml - # parameters: - # platforms: - # - browser_wasm - # - browser_wasm_win - # condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) - # nameSuffix: MultiThreaded - # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - # publishArtifactsForWorkload: true - # publishWBT: false + - template: /eng/pipelines/common/templates/wasm-build-only.yml + parameters: + platforms: + - browser_wasm + - browser_wasm_win + condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true)) + nameSuffix: MultiThreaded + extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + publishArtifactsForWorkload: true + publishWBT: false # Browser Wasm.Build.Tests - template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml From b59d6ac5cd0f6ef8470d334db0201eabd2be451e Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Wed, 17 Jun 2026 18:16:00 +0200 Subject: [PATCH 075/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/pthreads/ui-thread.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 24151eb9c86a79..3f7b8d2765698c 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -213,11 +213,20 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { const wasmModule = await loaderHelpers.wasmCompilePromise.promise; - for (const ev in worker.queue) { - monoWorkerMessageHandler(worker, wasmModule, worker.queue[ev]); + + // Stop queueing once we can process messages synchronously. + if (worker.handler) { + worker.removeEventListener("message", worker.handler); + } + + for (const queuedEvent of worker.queue) { + monoWorkerMessageHandler(worker, wasmModule, queuedEvent); } + worker.queue.length = 0; - worker.addEventListener("message", (ev) => monoWorkerMessageHandler(worker, wasmModule, ev)); + worker.handler = (ev) => monoWorkerMessageHandler(worker, wasmModule, ev); + worker.addEventListener("message", worker.handler); + const afterLoaded = originalLoadWasmModuleToWorker(worker); afterLoaded.then(() => { worker.info.isLoaded = true; From 06673e39dc544d52454ccb4d997068817948f8be Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 09:03:11 +0200 Subject: [PATCH 076/101] feedback --- src/mono/browser/runtime/loader/worker.ts | 2 +- .../browser/runtime/pthreads/ui-thread.ts | 38 ++++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/mono/browser/runtime/loader/worker.ts b/src/mono/browser/runtime/loader/worker.ts index 8d7b9f6f87a3c4..05bc8655ff931c 100644 --- a/src/mono/browser/runtime/loader/worker.ts +++ b/src/mono/browser/runtime/loader/worker.ts @@ -28,7 +28,7 @@ export function setupPreloadChannelToMainThread () { let workerMonoConfigReceived = false; // called when the main thread sends us the mono config -async function onMonoConfigReceived (data: any): Promise { +function onMonoConfigReceived (data: any): void { const config = JSON.parse(data.config) as MonoConfigInternal; const monoThreadInfo = JSON.parse(data.monoThreadInfo) as PThreadInfo; emscriptenModule.config = config; diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 3f7b8d2765698c..6027a041d9d987 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -75,26 +75,28 @@ function monoWorkerMessageHandler (worker: PThreadWorker, wasmModule: WebAssembl let thread: Thread; pthreadId = message.info?.pthreadId ?? 0; worker.info = Object.assign({}, worker.info, message.info); - const wasmMemory = runtimeHelpers.getMemory(); - const handlers = []; - const knownHandlers = ["onExit", "onAbort", "print", "printErr"]; - for (const handler of knownHandlers) { - if (Object.prototype.propertyIsEnumerable.call(Module, handler)) { - handlers.push(handler); - } - } switch (message.monoCmd) { case WorkerToMainMessageType.preload: - // this one shot port from setupPreloadChannelToMainThread - message.port!.postMessage({ - type: "pthread", - cmd: MainToWorkerMessageType.applyConfig, - config: JSON.stringify(runtimeHelpers.config), - monoThreadInfo: JSON.stringify(worker.info), - handlers, - wasmMemory, - wasmModule - }); + { + const wasmMemory = runtimeHelpers.getMemory(); + const handlers = []; + const knownHandlers = ["onExit", "onAbort", "print", "printErr"]; + for (const handler of knownHandlers) { + if (Object.prototype.propertyIsEnumerable.call(Module, handler)) { + handlers.push(handler); + } + } + // this one shot port from setupPreloadChannelToMainThread + message.port!.postMessage({ + type: "pthread", + cmd: MainToWorkerMessageType.applyConfig, + config: JSON.stringify(runtimeHelpers.config), + monoThreadInfo: JSON.stringify(worker.info), + handlers, + wasmMemory, + wasmModule + }); + } break; case WorkerToMainMessageType.pthreadCreated: thread = new ThreadImpl(pthreadId, worker, message.port!); From 2bbcf89ea654a9ba5f1a73f75285a845f259c02f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 09:19:16 +0200 Subject: [PATCH 077/101] feedback --- src/mono/browser/runtime/pthreads/worker-thread.ts | 1 + src/mono/browser/runtime/startup.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index 32cd178db3db83..7121a59e26d402 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -130,6 +130,7 @@ export function mono_wasm_pthread_on_pthread_registered (pthread_id: PThreadPtr) monoCmd: WorkerToMainMessageType.monoRegistered, info: monoThreadInfo, }); + runtimeHelpers.runtimeReady = true; } catch (err) { mono_log_error("mono_wasm_pthread_on_pthread_registered () failed", err); loaderHelpers.mono_exit(1, err); diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 3d7116f8df0cab..a1a9eb6cdcf6c9 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -345,7 +345,6 @@ export function postRunWorker () { // signal next stage runtimeHelpers.runtimeReady = false; - runtimeHelpers.afterPreRun = createPromiseController(); endMeasure(mark, MeasuredBlock.postRunWorker); } catch (err) { mono_log_error("postRunWorker() failed", err); From 815554a9f7cdd6ace26fd22fcbbdf194ecacff29 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 10:20:16 +0200 Subject: [PATCH 078/101] - drop FEATURE_WASM_MANAGED_THREADS use PlatformDetection.IsMultithreadingSupported - disable WebWorkerTest --- ...me.InteropServices.JavaScript.Tests.csproj | 5 +- .../JavaScript/JSImportTest.cs | 49 +++++++++++-------- .../JavaScript/JavaScriptTestHelper.cs | 5 +- .../JavaScript/YieldAwaitableTests.cs | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj index 15e2c682f6ecab..28eaa65f1d0ebf 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj @@ -10,11 +10,10 @@ $(WasmXHarnessMonoArgs) --setenv=TZ=Europe/Berlin true true - $(DefineConstants);FEATURE_WASM_MANAGED_THREADS true 1 - true + true $(NoWarn);IL2103;IL2025;IL2111;IL2122 true diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs index ee9271e52c2859..7a8cbeacd36931 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs @@ -58,8 +58,8 @@ public async Task MissingImportAsync() Assert.Contains("intentionallyMissingImportAsync must be a Function but was undefined", ex.Message); } -#if !FEATURE_WASM_MANAGED_THREADS // because in MT JSHost.ImportAsync is really async, it will finish before the caller could cancel it - [Fact] + // because in MT JSHost.ImportAsync is really async, it will finish before the caller could cancel it + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMultithreadingSupported))] public async Task CancelableImportAsync() { var cts = new CancellationTokenSource(); @@ -71,7 +71,6 @@ public async Task CancelableImportAsync() var actualEx = await Assert.ThrowsAsync(async () => await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs", new CancellationToken(true))); Assert.Equal("Error: OperationCanceledException", actualEx.Message); } -#endif [Fact] public unsafe void GlobalThis() @@ -286,11 +285,14 @@ public unsafe void CreateFunctionDoubleThrow() var ex = Assert.Throws(() => doubleThrows(1, 2)); Assert.Equal("Error: test 1 2", ex.Message); -#if !FEATURE_WASM_MANAGED_THREADS - Assert.Contains("create_function", ex.StackTrace); -#else - Assert.Contains("omitted JavaScript stack trace", ex.StackTrace); -#endif + if (!PlatformDetection.IsMultithreadingSupported) + { + Assert.Contains("create_function", ex.StackTrace); + } + else + { + Assert.Contains("omitted JavaScript stack trace", ex.StackTrace); + } } [Fact] @@ -1297,9 +1299,12 @@ public async Task JsImportTaskAwait() public async Task JsImportResolvedPromiseReturnsCompletedTask() { var promise = JavaScriptTestHelper.ReturnResolvedPromise(); -#if !FEATURE_WASM_MANAGED_THREADS - Assert.False(promise.IsCompleted); -#endif + + if (!PlatformDetection.IsMultithreadingSupported) + { + Assert.False(promise.IsCompleted); + } + await promise; Assert.True(promise.IsCompleted); } @@ -1587,20 +1592,22 @@ public void JsImportMath() var exThrow0 = Assert.Throws(() => JavaScriptTestHelper.throw0()); Assert.Contains("throw-0-msg", exThrow0.Message); Assert.DoesNotContain(" at ", exThrow0.Message); -#if !FEATURE_WASM_MANAGED_THREADS - Assert.Contains("throw0fn", exThrow0.StackTrace); -#else - Assert.Contains("omitted JavaScript stack trace", exThrow0.StackTrace); -#endif + if (!PlatformDetection.IsMultithreadingSupported) + { + Assert.Contains("throw0fn", exThrow0.StackTrace); + } var exThrow1 = Assert.Throws(() => throw1(value)); Assert.Contains("throw1-msg", exThrow1.Message); Assert.DoesNotContain(" at ", exThrow1.Message); -#if !FEATURE_WASM_MANAGED_THREADS - Assert.Contains("throw1fn", exThrow1.StackTrace); -#else - Assert.Contains("omitted JavaScript stack trace", exThrow0.StackTrace); -#endif + if (!PlatformDetection.IsMultithreadingSupported) + { + Assert.Contains("throw1fn", exThrow1.StackTrace); + } + else + { + Assert.Contains("omitted JavaScript stack trace", exThrow0.StackTrace); + } // anything is a system.object, sometimes it would be JSObject wrapper if (typeof(T).IsPrimitive) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs index d1fffe5517452d..531e56179ea5f5 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs @@ -1235,10 +1235,7 @@ public static async Task InitializeAsync() await Setup(); } -#if FEATURE_WASM_MANAGED_THREADS - // are we in the UI thread ? - if (Environment.CurrentManagedThreadId == 1) -#endif + if (!PlatformDetection.IsMultithreadingSupported || Environment.CurrentManagedThreadId == 1) { // this gives browser chance to serve UI thread event loop before every test await Task.Yield(); diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/YieldAwaitableTests.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/YieldAwaitableTests.cs index f268006739441b..99a26e7eede274 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/YieldAwaitableTests.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/YieldAwaitableTests.cs @@ -22,7 +22,7 @@ public async Task TaskYieldsToBrowserLoop() Assert.True(JavaScriptTestHelper.IsPromiseThenHit()); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMultithreadingSupported))] public async Task TaskDelay0DoesNotYieldToBrowserLoop() { JavaScriptTestHelper.BeforeYield(); From ed12a1bd25a94d92e2ff631d32b55dbcfc033c8f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 11:19:58 +0200 Subject: [PATCH 079/101] more --- src/libraries/tests.proj | 3 +++ src/mono/browser/runtime/startup.ts | 2 +- src/mono/browser/test-main.mjs | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 3783247c6871ff..b825adca5bc245 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -583,6 +583,9 @@ + + + diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index a1a9eb6cdcf6c9..3b88f0161a4120 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -5,7 +5,7 @@ import WasmEnableThreads from "consts:wasmEnableThreads"; import BuildConfiguration from "consts:configuration"; import { DotnetModuleInternal, CharPtrNull, MainToWorkerMessageType } from "./types/internal"; -import { exportedRuntimeAPI, INTERNAL, loaderHelpers, Module, runtimeHelpers, createPromiseController, mono_assert, browserVirtualAppBase } from "./globals"; +import { exportedRuntimeAPI, INTERNAL, loaderHelpers, Module, runtimeHelpers, mono_assert, browserVirtualAppBase } from "./globals"; import cwraps, { init_c_exports, threads_c_functions as tcwraps } from "./cwraps"; import { mono_wasm_raise_debug_event, mono_wasm_runtime_ready } from "./debug"; import { toBase64StringImpl } from "./base64"; diff --git a/src/mono/browser/test-main.mjs b/src/mono/browser/test-main.mjs index 7db3721bb44eaf..b256d8bba5ab56 100644 --- a/src/mono/browser/test-main.mjs +++ b/src/mono/browser/test-main.mjs @@ -263,6 +263,7 @@ function configureRuntime(dotnet, runArgs) { dumpThreadsOnNonZeroExit: true, loadAllSatelliteResources: true, jsThreadBlockingMode: "ThrowWhenBlockingWait", + pthreadPoolInitialSize: 15, }); if (ENVIRONMENT_IS_NODE) { From 562c5a0e65a2a38343993d5f3c10b0030022e482 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 15:45:37 +0200 Subject: [PATCH 080/101] progress on MT --- .../FunctionalTests/System.Net.Http.Functional.Tests.csproj | 2 +- .../tests/System.Net.WebSockets.Client.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index b699cc0dafd7fd..28306cba768a64 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -29,7 +29,7 @@ $(DefineConstants);TARGET_BROWSER 01:15:00 - true + true diff --git a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj index 83cf148c6a9fd6..49690818a4c74c 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj +++ b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj @@ -17,7 +17,7 @@ $(TestArchiveTestsRoot)$(OSPlatformConfig)/ $(DefineConstants);TARGET_BROWSER 1 - true + true From 7b5676364689bbfbcdcec1039c54d5f1e1816124 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 18:07:52 +0200 Subject: [PATCH 081/101] fix async --- .../tests/System.Threading.Tests.csproj | 1 + .../browser/runtime/pthreads/ui-thread.ts | 30 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/libraries/System.Threading/tests/System.Threading.Tests.csproj b/src/libraries/System.Threading/tests/System.Threading.Tests.csproj index cb21b19ae3a8c9..7717d16d56bf31 100644 --- a/src/libraries/System.Threading/tests/System.Threading.Tests.csproj +++ b/src/libraries/System.Threading/tests/System.Threading.Tests.csproj @@ -7,6 +7,7 @@ <_WasmPThreadPoolUnusedSize>10 + true diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 6027a041d9d987..8a2e4f7fed7fe9 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -213,26 +213,26 @@ export function replaceEmscriptenPThreadUI (modulePThread: PThreadLibrary): void const originalLoadWasmModuleToWorker = modulePThread.loadWasmModuleToWorker; const originalReturnWorkerToPool = modulePThread.returnWorkerToPool; - modulePThread.loadWasmModuleToWorker = async (worker: PThreadWorker): Promise => { - const wasmModule = await loaderHelpers.wasmCompilePromise.promise; - - // Stop queueing once we can process messages synchronously. - if (worker.handler) { - worker.removeEventListener("message", worker.handler); - } - - for (const queuedEvent of worker.queue) { - monoWorkerMessageHandler(worker, wasmModule, queuedEvent); - } - - worker.queue.length = 0; - worker.handler = (ev) => monoWorkerMessageHandler(worker, wasmModule, ev); - worker.addEventListener("message", worker.handler); + modulePThread.loadWasmModuleToWorker = (worker: PThreadWorker): Promise => { const afterLoaded = originalLoadWasmModuleToWorker(worker); afterLoaded.then(() => { worker.info.isLoaded = true; }); + + loaderHelpers.wasmCompilePromise.promise.then((wasmModule) => { + // Stop queueing once we can process messages synchronously. + for (const queuedEvent of worker.queue) { + monoWorkerMessageHandler(worker, wasmModule, queuedEvent); + } + worker.queue.length = 0; + if (worker.handler) { + worker.removeEventListener("message", worker.handler); + } + worker.handler = (ev) => monoWorkerMessageHandler(worker, wasmModule, ev); + worker.addEventListener("message", worker.handler); + }); + if (loaderHelpers.config.exitOnUnhandledError) { worker.onerror = (e) => { loaderHelpers.mono_exit(1, e); From 7f7e2fa2aefb161be832a2c684bc5a003a8dccfc Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 18:10:56 +0200 Subject: [PATCH 082/101] disable failing tests --- .../System/HalfTests.GenericMath.cs | 12 ++++++++++++ .../tests/System.Runtime.Tests/System/HalfTests.cs | 10 ++++++++++ .../Blazor/EventPipeDiagnosticsTests.cs | 2 ++ .../ArrayMarshalling/SafeArray/SafeArrayTest.cs | 4 ++++ .../PInvoke/Variant/VariantTest.BuiltInCom.cs | 1 + .../PInvoke/Variant/VariantTest.ComWrappers.cs | 1 + .../DelegatePInvoke/DelegatePInvokeTest.cs | 1 + .../ReversePInvokeManaged/ReversePInvokeTest.cs | 1 + .../CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il | 5 +++++ .../UnitTest/UnitTest_GVM_TypeLoadException.il | 4 ++++ 10 files changed, 41 insertions(+) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs index af8cc2c1e1bb81..0bd10ea462393b 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs @@ -48,6 +48,7 @@ private static void AssertBitwiseEqual(Half expected, Half actual) // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_AdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_Addition(Half.NegativeInfinity, One)); @@ -68,6 +69,7 @@ public static void op_AdditionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedAdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_CheckedAddition(Half.NegativeInfinity, One)); @@ -237,6 +239,7 @@ public static void op_LessThanOrEqualTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_Decrement(Half.NegativeInfinity)); @@ -257,6 +260,7 @@ public static void op_DecrementTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_CheckedDecrement(Half.NegativeInfinity)); @@ -281,6 +285,7 @@ public static void op_CheckedDecrementTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_Division(Half.NegativeInfinity, Two)); @@ -301,6 +306,7 @@ public static void op_DivisionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_CheckedDivision(Half.NegativeInfinity, Two)); @@ -737,6 +743,7 @@ public static void TryWriteSignificandLittleEndianTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_IncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_Increment(Half.NegativeInfinity)); @@ -757,6 +764,7 @@ public static void op_IncrementTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedIncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_CheckedIncrement(Half.NegativeInfinity)); @@ -837,6 +845,7 @@ public static void MultiplicativeIdentityTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_MultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_Multiply(Half.NegativeInfinity, Two)); @@ -857,6 +866,7 @@ public static void op_MultiplyTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedMultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_CheckedMultiply(Half.NegativeInfinity, Two)); @@ -2341,6 +2351,7 @@ public static void NegativeOneTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_SubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_Subtraction(Half.NegativeInfinity, One)); @@ -2361,6 +2372,7 @@ public static void op_SubtractionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedSubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_CheckedSubtraction(Half.NegativeInfinity, One)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs index c1271ec32fd10a..7736ce89e80200 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs @@ -1493,6 +1493,7 @@ public static IEnumerable ExpM1_TestData() [Theory] [MemberData(nameof(ExpM1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExpM1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.ExpM1(value), allowedVariance); @@ -1581,6 +1582,7 @@ public static IEnumerable Exp2M1_TestData() [Theory] [MemberData(nameof(Exp2M1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp2M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp2M1(value), allowedVariance); @@ -1669,6 +1671,7 @@ public static IEnumerable Exp10M1_TestData() [Theory] [MemberData(nameof(Exp10M1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp10M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp10M1(value), allowedVariance); @@ -2011,6 +2014,7 @@ public static IEnumerable AcosPi_TestData() [Theory] [MemberData(nameof(AcosPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AcosPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.AcosPi(value), allowedVariance); @@ -2038,6 +2042,7 @@ public static IEnumerable AsinPi_TestData() [Theory] [MemberData(nameof(AsinPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AsinPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AsinPi(-value), allowedVariance); @@ -2076,6 +2081,7 @@ public static IEnumerable Atan2Pi_TestData() [Theory] [MemberData(nameof(Atan2Pi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Atan2PiTest(Half y, Half x, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.Atan2Pi(-y, +x), allowedVariance); @@ -2104,6 +2110,7 @@ public static IEnumerable AtanPi_TestData() [Theory] [MemberData(nameof(AtanPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AtanPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AtanPi(-value), allowedVariance); @@ -2340,6 +2347,7 @@ public static IEnumerable Lerp_TestData() [Theory] [MemberData(nameof(Lerp_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void LerpTest(Half value1, Half value2, Half amount, Half expectedResult) { AssertExtensions.Equal(+expectedResult, Half.Lerp(+value1, +value2, amount), Half.Zero); @@ -2375,6 +2383,7 @@ public static IEnumerable DegreesToRadians_TestData() [Theory] [MemberData(nameof(DegreesToRadians_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void DegreesToRadiansTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.DegreesToRadians(-value), allowedVariance); @@ -2410,6 +2419,7 @@ public static IEnumerable RadiansToDegrees_TestData() [Theory] [MemberData(nameof(RadiansToDegrees_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void RadiansToDegreesTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.RadiansToDegrees(-value), allowedVariance); diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs index 00045911bda7a2..b3b91ab00abc38 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs @@ -30,11 +30,13 @@ public EventPipeDiagnosticsTests(ITestOutputHelper output, SharedBuildPerTestCla [Fact] [TestCategory("native-mono")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129584", typeof(BuildTestBase), nameof(BuildTestBase.IsMonoRuntime))] public Task BlazorEventPipeTestWithCpuSamplesAOT() => BlazorEventPipeTestWithCpuSamples(Configuration.Release, aot: true); [Theory] [InlineData(Configuration.Debug, false)] [InlineData(Configuration.Release, false)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129584", typeof(BuildTestBase), nameof(BuildTestBase.IsMonoRuntime))] public async Task BlazorEventPipeTestWithCpuSamples(Configuration config, bool aot) { string extraProperties = @" diff --git a/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs b/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs index 293e89883a982c..97a3c981626961 100644 --- a/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs +++ b/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs @@ -89,6 +89,7 @@ public static int TestEntryPoint() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalIntArray() { const int rows = 3; @@ -120,6 +121,7 @@ public static void MultidimensionalIntArrayRoundTrip() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalBoolArray() { const int rows = 2; @@ -151,6 +153,7 @@ public static void MultidimensionalBoolArrayRoundTrip() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalStringArray() { const int rows = 2; @@ -171,6 +174,7 @@ public static void MultidimensionalStringArray() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalStringArrayRoundTrip() { const int rows = 2; diff --git a/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs b/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs index 0d3a9ef1e79381..ad46489addb557 100644 --- a/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs +++ b/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs @@ -12,6 +12,7 @@ public partial class Test_VariantTest [Fact] [PlatformSpecific(TestPlatforms.Windows)] [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] [Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)] public static int TestEntryPoint() { diff --git a/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs b/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs index f83f5a4f263102..85c7b2106f3309 100644 --- a/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs +++ b/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs @@ -15,6 +15,7 @@ public partial class Test_VariantTest [Fact] [PlatformSpecific(TestPlatforms.Windows)] [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] [Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)] public static int TestEntryPoint() { diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs index 3cf6f2d883077d..7c5f2043b5b445 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs @@ -690,6 +690,7 @@ private static void TestMethod_DelegatePInvoke_MarshalByVal_Stdcall(StructID str [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static int TestEntryPoint() { try diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs index dda5d7a27e8a1c..b213ddd76b2c71 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs @@ -745,6 +745,7 @@ public static bool TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Expl [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static int TestEntryPoint() { try{ diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il b/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il index ca53f66aa7f2b5..2565bcc03b270e 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il @@ -9,6 +9,7 @@ .assembly 'b143840' {} .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .class private auto ansi beforefieldinit ExternalClass extends [mscorlib]System.Object { @@ -44,6 +45,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 3 .locals init (class [System.Threading.Thread]System.Threading.Thread V_0, diff --git a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il index cb631bf64f517f..65df84dbdafa64 100644 --- a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il +++ b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il @@ -478,6 +478,10 @@ 01 00 00 00 ) .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = {string('Tests that expect TypeLoadException') type([TestLibrary]TestLibrary.Utilities) string[1] ('IsNativeAot') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 2 .locals init ( bool result ) From e0e722213fd5be220a5d7ffca5157d05d82523f1 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 18:33:33 +0200 Subject: [PATCH 083/101] fix pthread creation --- src/mono/browser/runtime/startup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 3b88f0161a4120..343283935a6cda 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -144,9 +144,10 @@ async function instantiateWasmWorker ( // Instantiate from the module posted from the main thread. // We can just use sync instantiation in the worker. const instance = new WebAssembly.Instance(Module.wasmModule!, imports); - successCallback(instance, undefined); Module.wasmModule = null; + preRunWorker(); + successCallback(instance, undefined); } From 4e8f7580e6e4a204cd700d0ce83428a0e6029a2d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 18:42:36 +0200 Subject: [PATCH 084/101] feedback, cleanup --- ...me.InteropServices.JavaScript.Tests.csproj | 13 - .../JavaScript/WebWorkerTest.Http.cs | 94 --- .../JavaScript/WebWorkerTest.WebSocket.cs | 111 --- .../JavaScript/WebWorkerTest.cs | 646 ------------------ .../JavaScript/WebWorkerTestBase.cs | 225 ------ .../JavaScript/WebWorkerTestHelper.cs | 403 ----------- .../JavaScript/WebWorkerTestHelper.mjs | 85 --- .../InteropServices/JavaScript/test.json | 3 - 8 files changed, 1580 deletions(-) delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.Http.cs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestBase.cs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.mjs delete mode 100644 src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/test.json diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj index 28eaa65f1d0ebf..d5a40b9c28f982 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj @@ -61,17 +61,4 @@ - - diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.Http.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.Http.cs deleted file mode 100644 index 4550bef70dd4f5..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.Http.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Threading.Tasks; -using System.Threading; -using System.Net.Http; -using Xunit; -using System.IO; -using System.Text; - -namespace System.Runtime.InteropServices.JavaScript.Tests -{ - public class WebWorkerHttpTest : WebWorkerTestBase - { - #region HTTP - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task HttpClient_ContentInSameThread(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - var uri = WebWorkerTestHelper.GetOriginUrl() + "/test.json"; - - await executor.Execute(async () => - { - using var client = new HttpClient(); - using var response = await client.GetAsync(uri); - response.EnsureSuccessStatusCode(); - var body = await response.Content.ReadAsStringAsync(); - Assert.Contains("hello", body); - Assert.Contains("world", body); - }, cts.Token); - } - - private static HttpRequestOptionsKey WebAssemblyEnableStreamingRequestKey = new("WebAssemblyEnableStreamingRequest"); - private static string HelloJson = "{'hello':'world'}".Replace('\'', '"'); - private static string EchoStart = "{\"Method\":\"POST\",\"Url\":\"/Echo.ashx"; - - private async Task HttpClient_ActionInDifferentThread(string url, Executor executor1, Executor executor2, Func e2Job) - { - using var cts = CreateTestCaseTimeoutSource(); - - var e1Job = async (Task e2done, TaskCompletionSource e1State) => - { - using var ms = new MemoryStream(); - await ms.WriteAsync(Encoding.UTF8.GetBytes(HelloJson)); - - using var req = new HttpRequestMessage(HttpMethod.Post, url); - req.Content = new StreamContent(ms); - using var client = new HttpClient(); - var pr = client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead); - using var response = await pr; - - // share the state with the E2 continuation - e1State.SetResult(response); - - await e2done; - }; - await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); - } - - [Theory, MemberData(nameof(GetTargetThreads2x))] - public async Task HttpClient_ContentInDifferentThread(Executor executor1, Executor executor2) - { - var url = WebWorkerTestHelper.LocalHttpEcho + "?guid=" + Guid.NewGuid(); - await HttpClient_ActionInDifferentThread(url, executor1, executor2, async (HttpResponseMessage response) => - { - response.EnsureSuccessStatusCode(); - var body = await response.Content.ReadAsStringAsync(); - Assert.StartsWith(EchoStart, body); - }); - } - - [ActiveIssue("https://github.com/dotnet/runtime/issues/98101")] - [Theory, MemberData(nameof(GetTargetThreads2x))] - public async Task HttpClient_CancelInDifferentThread(Executor executor1, Executor executor2) - { - var url = WebWorkerTestHelper.LocalHttpEcho + "?delay10sec=true&guid=" + Guid.NewGuid(); - await HttpClient_ActionInDifferentThread(url, executor1, executor2, async (HttpResponseMessage response) => - { - await Assert.ThrowsAsync(async () => - { - CancellationTokenSource cts = new CancellationTokenSource(); - var promise = response.Content.ReadAsStringAsync(cts.Token); - WebWorkerTestHelper.Log("HttpClient_CancelInDifferentThread: ManagedThreadId: " + Environment.CurrentManagedThreadId + " NativeThreadId: " + WebWorkerTestHelper.NativeThreadId); - cts.Cancel(); - var res = await promise; - throw new Exception("This should be unreachable: " + res); - }); - }); - } - - #endregion - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs deleted file mode 100644 index 10153ee995ecc8..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Threading.Tasks; -using System.Threading; -using Xunit; -using System.Net.WebSockets; -using System.Text; - -namespace System.Runtime.InteropServices.JavaScript.Tests -{ - public class WebWorkerWebSocketTest : WebWorkerTestBase - { - #region WebSocket - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task WebSocketClient_ContentInSameThread(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - - var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); - var message = "hello"; - var send = Encoding.UTF8.GetBytes(message); - var receive = new byte[100]; - - await executor.Execute(async () => - { - using var client = new ClientWebSocket(); - await client.ConnectAsync(uri, CancellationToken.None); - await client.SendAsync(send, WebSocketMessageType.Text, true, CancellationToken.None); - - var res = await client.ReceiveAsync(receive, CancellationToken.None); - Assert.Equal(WebSocketMessageType.Text, res.MessageType); - Assert.True(res.EndOfMessage); - Assert.Equal(send.Length, res.Count); - Assert.Equal(message, Encoding.UTF8.GetString(receive, 0, res.Count)); - }, cts.Token); - } - - - [Theory, MemberData(nameof(GetTargetThreads2x))] - public async Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2) - { - using var cts = CreateTestCaseTimeoutSource(); - - var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); - var message = "hello"; - var send = Encoding.UTF8.GetBytes(message); - var receive = new byte[100]; - - var e1Job = async (Task e2done, TaskCompletionSource e1State) => - { - using var client = new ClientWebSocket(); - await client.ConnectAsync(uri, CancellationToken.None); - await client.SendAsync(send, WebSocketMessageType.Text, true, CancellationToken.None); - - // share the state with the E2 continuation - e1State.SetResult(client); - await e2done; - }; - - var e2Job = async (ClientWebSocket client) => - { - var res = await client.ReceiveAsync(receive, CancellationToken.None); - Assert.Equal(WebSocketMessageType.Text, res.MessageType); - Assert.True(res.EndOfMessage); - Assert.Equal(send.Length, res.Count); - Assert.Equal(message, Encoding.UTF8.GetString(receive, 0, res.Count)); - - await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None); - }; - - await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); - } - - [Theory, MemberData(nameof(GetTargetThreads2x))] - public async Task WebSocketClient_CancelInDifferentThread(Executor executor1, Executor executor2) - { - using var cts = CreateTestCaseTimeoutSource(); - - var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); - var message = ".delay5sec"; // this will make the loopback server slower - var send = Encoding.UTF8.GetBytes(message); - var receive = new byte[100]; - - var e1Job = async (Task e2done, TaskCompletionSource e1State) => - { - using var client = new ClientWebSocket(); - await client.ConnectAsync(uri, CancellationToken.None); - await client.SendAsync(send, WebSocketMessageType.Text, true, CancellationToken.None); - - // share the state with the E2 continuation - e1State.SetResult(client); - await e2done; - }; - - var e2Job = async (ClientWebSocket client) => - { - CancellationTokenSource cts2 = new CancellationTokenSource(); - var resTask = client.ReceiveAsync(receive, cts2.Token); - cts2.Cancel(); - var ex = await Assert.ThrowsAnyAsync(() => resTask); - Assert.Equal(cts2.Token, ex.CancellationToken); - }; - - await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); - } - - #endregion - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs deleted file mode 100644 index 278270b470b871..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ /dev/null @@ -1,646 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.IO; -using System.Threading.Tasks; -using System.Threading; -using Xunit; - -namespace System.Runtime.InteropServices.JavaScript.Tests -{ - - // TODO test: - // JSExport 2x - // ProxyContext flow, child thread, child task - // use JSObject after JSWebWorker finished, especially HTTP - // event pipe - // JS setTimeout till after JSWebWorker close - // synchronous .Wait for JS setTimeout on the same thread -> deadlock problem **7)** - - public class WebWorkerTest : WebWorkerTestBase - { - #region Executors - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task Executor_Cancellation(Executor executor) - { - var cts = new CancellationTokenSource(); - - TaskCompletionSource ready = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var canceledTask = executor.Execute(() => - { - TaskCompletionSource never = new TaskCompletionSource(); - ready.SetResult(); - return never.Task; - }, cts.Token); - - await ready.Task; - - cts.Cancel(); - - await Assert.ThrowsAnyAsync(() => canceledTask); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSDelay_Cancellation(Executor executor) - { - var cts = new CancellationTokenSource(); - TaskCompletionSource ready = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var canceledTask = executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - - var never = WebWorkerTestHelper.JSDelay(int.MaxValue); - ready.SetResult(); - await never; - }, cts.Token); - - await ready.Task; - - cts.Cancel(); - - await Assert.ThrowsAnyAsync(() => canceledTask); - } - - [Theory, MemberData(nameof(GetBlockingFriendlyTargetThreads))] - public async Task JSDelay_Blocking_Wait(Executor executor) - { - var cts = new CancellationTokenSource(); - var blockedTask = executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - var promise = WebWorkerTestHelper.JSDelay(100); - promise.Wait(); - }, cts.Token); - - await blockedTask; - } - - [Theory, MemberData(nameof(GetBlockingFriendlyTargetThreads))] - public async Task JSDelay_Blocking_GetResult(Executor executor) - { - var cts = new CancellationTokenSource(); - var blockedTask = executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - var promise = WebWorkerTestHelper.JSDelay(100); - promise.GetAwaiter().GetResult(); - }, cts.Token); - - await blockedTask; - } - - [Fact] - public async Task JSSynchronizationContext_Send_Post_Items_Cancellation() - { - var cts = new CancellationTokenSource(); - - ManualResetEventSlim blocker = new ManualResetEventSlim(false); - TaskCompletionSource never = new TaskCompletionSource(); - TaskCompletionSource canceled = new TaskCompletionSource(); - SynchronizationContext capturedSynchronizationContext = null; - TaskCompletionSource jswReady = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - TaskCompletionSource sendReady = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - TaskCompletionSource postReady = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var canceledTask = JSWebWorker.RunAsync(() => - { - capturedSynchronizationContext = SynchronizationContext.Current; - jswReady.SetResult(); - - // blocking the worker, so that JSSynchronizationContext could enqueue next tasks - Thread.ForceBlockingWait(static (b) => ((ManualResetEventSlim)b).Wait(), blocker); - - return never.Task; - }, cts.Token); - - await jswReady.Task; - Assert.Equal("System.Runtime.InteropServices.JavaScript.JSSynchronizationContext", capturedSynchronizationContext!.GetType().FullName); - - var shouldNotHitSend = false; - var shouldNotHitPost = false; - var hitAfterPost = false; - var hitAfterSend = false; - - var canceledSend = Task.Run(() => - { - sendReady.SetResult(); - // this will be blocked until blocker.Set() - try - { - capturedSynchronizationContext.Send(_ => - { - // then it should get canceled and not executed - shouldNotHitSend = true; - }, null); - } - catch (Exception ex) - { - return Task.FromException(ex); - } - hitAfterSend = true; - return Task.FromException(new Exception("Should be unreachable")); - }); - - var canceledPost = Task.Run(() => - { - try - { - capturedSynchronizationContext.Post(_ => - { - // then it should get canceled and not executed - shouldNotHitPost = true; - }, null); - } - catch (Exception ex) - { - WebWorkerTestHelper.Log("Unexpected exception " + ex); - postReady.SetException(ex); - return Task.FromException(ex); - } - hitAfterPost = true; - postReady.SetResult(); - return Task.CompletedTask; - }); - - // make sure that jobs got the chance to enqueue - await postReady.Task; - await sendReady.Task; - await Task.Delay(200); // make sure that - - // this could should be delivered immediately - cts.Cancel(); - - // now we release helpers to use capturedSynchronizationContext - canceled.SetResult(); - - // this will unblock the current pending work item - blocker.Set(); - - await Assert.ThrowsAnyAsync(() => canceledSend); - await canceledPost; // this shouldn't throw - - Assert.False(shouldNotHitSend); - Assert.False(shouldNotHitPost); - Assert.True(hitAfterPost); - Assert.False(hitAfterSend); - } - - [Fact] - public async Task JSSynchronizationContext_Send_Post_To_Canceled() - { - var cts = new CancellationTokenSource(); - - TaskCompletionSource never = new TaskCompletionSource(); - SynchronizationContext capturedSynchronizationContext = null; - TaskCompletionSource jswReady = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - JSObject capturedGlobalThis = null; - - var canceledTask = JSWebWorker.RunAsync(() => - { - capturedSynchronizationContext = SynchronizationContext.Current; - capturedGlobalThis = JSHost.GlobalThis; - jswReady.SetResult(); - return never.Task; - }, cts.Token); - - await jswReady.Task; - Assert.Equal("System.Runtime.InteropServices.JavaScript.JSSynchronizationContext", capturedSynchronizationContext!.GetType().FullName); - - cts.Cancel(); - - // give it chance to dispose the thread - await Task.Delay(100); - - Assert.True(capturedGlobalThis.IsDisposed); - - var shouldNotHitSend = false; - var shouldNotHitPost = false; - - Assert.Throws(() => - { - capturedGlobalThis.HasProperty("document"); - }); - - Assert.Throws(() => - { - capturedSynchronizationContext.Send(_ => - { - // then it should get canceled and not executed - shouldNotHitSend = true; - }, null); - }); - - Assert.Throws(() => - { - capturedSynchronizationContext.Post(_ => - { - // then it should get canceled and not executed - shouldNotHitPost = true; - }, null); - }); - - Assert.False(shouldNotHitSend); - Assert.False(shouldNotHitPost); - } - - [ActiveIssue("https://github.com/dotnet/runtime/issues/96628#issuecomment-1907602744")] - [Fact] - // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. - public async Task JSWebWorker_Abandon_Running() - { - TaskCompletionSource never = new TaskCompletionSource(); - TaskCompletionSource ready = new TaskCompletionSource(); - -#pragma warning disable CS4014 - // intentionally not awaiting it - JSWebWorker.RunAsync(() => - { - ready.SetResult(); - return never.Task; - }, CancellationToken.None); -#pragma warning restore CS4014 - - await ready.Task; - - // it should not get collected - GC.Collect(); - - // it should not prevent mono and the test suite from exiting - } - - [Fact] - // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. - public async Task JSWebWorker_Abandon_Running_JS() - { - TaskCompletionSource ready = new TaskCompletionSource(); - -#pragma warning disable CS4014 - // intentionally not awaiting it - JSWebWorker.RunAsync(async () => - { - await WebWorkerTestHelper.CreateDelay(); - var never = WebWorkerTestHelper.JSDelay(int.MaxValue); - ready.SetResult(); - await never; - }, CancellationToken.None); -#pragma warning restore CS4014 - - await ready.Task; - - // it should not get collected - GC.Collect(); - - // it should not prevent mono and the test suite from exiting - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task Executor_Propagates(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - bool hit = false; - var failedTask = executor.Execute(() => - { - hit = true; - throw new InvalidOperationException("Test"); - }, cts.Token); - - var ex = await Assert.ThrowsAsync(() => failedTask); - Assert.True(hit); - Assert.Equal("Test", ex.Message); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task Executor_Propagates_After_Delay(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - bool hit = false; - var failedTask = executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - await WebWorkerTestHelper.JSDelay(10); - - hit = true; - throw new InvalidOperationException("Test"); - }, cts.Token); - - var ex = await Assert.ThrowsAsync(async () => await failedTask); - Assert.True(hit); - Assert.Equal("Test", ex.Message); - } - - #endregion - - #region Console, Yield, Delay, Timer - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task ManagedConsole(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(() => - { - WebWorkerTestHelper.Log("C# Hello from ManagedThreadId: " + Environment.CurrentManagedThreadId); - Console.Clear(); - return Task.CompletedTask; - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSConsole(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(() => - { - WebWorkerTestHelper.Log("JS Hello from ManagedThreadId: " + Environment.CurrentManagedThreadId + " NativeThreadId: " + WebWorkerTestHelper.NativeThreadId); - return Task.CompletedTask; - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task NativeThreadId(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.InitializeAsync(), cts.Token); - - var jsTid = WebWorkerTestHelper.GetTid(); - var csTid = WebWorkerTestHelper.NativeThreadId; - if (executor.Type == ExecutorType.JSWebWorker) - { - Assert.Equal(jsTid, csTid); - } - else - { - Assert.NotEqual(jsTid, csTid); - } - - await WebWorkerTestHelper.DisposeAsync(); - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task ThreadingTimer(Executor executor) - { - var hit = false; - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - TaskCompletionSource tcs = new TaskCompletionSource(); - WebWorkerTestHelper.Log("ThreadingTimer: Start Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " ManagedThreadId: " + Environment.CurrentManagedThreadId + " NativeThreadId: " + WebWorkerTestHelper.NativeThreadId); - - using var timer = new Timer(_ => - { - Assert.NotEqual(1, Environment.CurrentManagedThreadId); - Assert.True(Thread.CurrentThread.IsThreadPoolThread); - hit = true; - tcs.SetResult(); - }, null, 100, Timeout.Infinite); - - await tcs.Task; - }, cts.Token); - - WebWorkerTestHelper.Log("ThreadingTimer: End Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " ManagedThreadId: " + Environment.CurrentManagedThreadId + " NativeThreadId: " + WebWorkerTestHelper.NativeThreadId); - Assert.True(hit); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSDelay_ContinueWith_Async(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - - await WebWorkerTestHelper.JSDelay(10).ContinueWith(_ => - { - Assert.True(Thread.CurrentThread.IsThreadPoolThread); - }, TaskContinuationOptions.RunContinuationsAsynchronously); - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSDelay_ContinueWith_Sync(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - - await WebWorkerTestHelper.JSDelay(10).ContinueWith(_ => - { - Assert.True(Thread.CurrentThread.IsThreadPoolThread); - }, TaskContinuationOptions.ExecuteSynchronously); // ExecuteSynchronously is ignored - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSDelay_ConfigureAwait_True(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - - await WebWorkerTestHelper.JSDelay(10).ConfigureAwait(true); - - executor.AssertAwaitCapturedContext(); - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task JSDelay_ConfigureAwait_False(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.CreateDelay(), cts.Token); - - await WebWorkerTestHelper.JSDelay(10).ConfigureAwait(false); - - // resolve/reject on I/O thread -> thread pool - Assert.True(Thread.CurrentThread.IsThreadPoolThread); - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task ManagedDelay_ContinueWith(Executor executor) - { - var hit = false; - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await Task.Delay(10, cts.Token).ContinueWith(_ => - { - hit = true; - }, TaskContinuationOptions.ExecuteSynchronously); - }, cts.Token); - Assert.True(hit); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task ManagedDelay_ConfigureAwait_True(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await Task.Delay(10, cts.Token).ConfigureAwait(true); - - executor.AssertAwaitCapturedContext(); - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/99951")] - public async Task WaitInAsyncAssertsOnlyOnJSWebWorker(Executor executor, NamedCall method) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.InitializeAsync(), cts.Token); - - Exception? exception = null; - try - { - method.Call(cts.Token); - } - catch (Exception ex) - { - exception = ex; - } - - if (method.IsBlocking && executor.Type == ExecutorType.JSWebWorker) - { - Assert.NotNull(exception); - Assert.IsType(exception); - } - else - { - Assert.Null(exception); - } - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/99951")] - public async Task WaitAssertsOnSyncCallback(Executor executor, NamedCall method) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.InitializeAsync(), cts.Token); - - Exception? exception = null; - // the callback will hit Main or JSWebWorker, not the original executor thread - await WebWorkerTestHelper.CallMeBackSync(() => - { - // when we are inside of synchronous callback, all blocking .Wait is forbidden - try - { - method.Call(cts.Token); - } - catch (Exception ex) - { - exception = ex; - } - }); - - if (method.IsBlocking) - { - Assert.NotNull(exception); - Assert.IsType(exception); - } - else - { - Assert.Null(exception); - } - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/99951")] - public async Task WaitAssertsOnSyncJSExport(Executor executor, NamedCall method) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await executor.StickyAwait(WebWorkerTestHelper.InitializeAsync(), cts.Token); - - WebWorkerTestHelper.CurrentCallback = method; - WebWorkerTestHelper.CurrentCancellationToken = cts.Token; - // the callback will hit Main or JSWebWorker, not the original executor thread - await WebWorkerTestHelper.CallExportBackSync(nameof(WebWorkerTestHelper.CallCurrentCallback)); - - if (method.IsBlocking) - { - Assert.NotNull(WebWorkerTestHelper.LastException); - Assert.IsType(WebWorkerTestHelper.LastException); - } - else - { - Assert.Null(WebWorkerTestHelper.LastException); - } - }, cts.Token); - } - - [Theory, MemberData(nameof(GetTargetThreads))] - public async Task ManagedYield(Executor executor) - { - using var cts = CreateTestCaseTimeoutSource(); - await executor.Execute(async () => - { - await Task.Yield(); - - executor.AssertAwaitCapturedContext(); - }, cts.Token); - } - - [Fact] - public async Task FinalizerWorks() - { - var ft = new FinalizerTest(); - GC.Collect(); - await Task.Delay(100); - GC.Collect(); - await Task.Delay(100); - Assert.True(FinalizerTest.FinalizerHit); - } - - #endregion - - #region Thread Affinity - - [Theory, MemberData(nameof(GetTargetThreads2x))] - public async Task JSObject_CapturesAffinity(Executor executor1, Executor executor2) - { - using var cts = CreateTestCaseTimeoutSource(); - - var e1Job = async (Task e2done, TaskCompletionSource e1State) => - { - await WebWorkerTestHelper.InitializeAsync(); - - executor1.AssertAwaitCapturedContext(); - - var jsState = await WebWorkerTestHelper.PromiseState(); - - // share the state with the E2 continuation - e1State.SetResult(jsState); - - await e2done; - - // cleanup - await WebWorkerTestHelper.DisposeAsync(); - }; - - var e2Job = async (JSObject e1State) => - { - bool valid = await WebWorkerTestHelper.PromiseValidateState(e1State); - Assert.True(valid); - }; - - await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); - } - - #endregion - - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestBase.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestBase.cs deleted file mode 100644 index c9b8304978a4fa..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestBase.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.IO; -using System.Threading.Tasks; -using System.Threading; -using Xunit; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; - -namespace System.Runtime.InteropServices.JavaScript.Tests -{ - public class WebWorkerTestBase : IAsyncLifetime - { - const int TimeoutMilliseconds = 5000; - - public static bool _isWarmupDone; - - public async Task InitializeAsync() - { - if (_isWarmupDone) - { - return; - } - await Task.Delay(500); - _isWarmupDone = true; - } - - public Task DisposeAsync() => Task.CompletedTask; - - protected CancellationTokenSource CreateTestCaseTimeoutSource([CallerMemberName] string memberName = "") - { - var start = DateTime.Now; - var cts = new CancellationTokenSource(TimeoutMilliseconds); - cts.Token.Register(() => - { - var end = DateTime.Now; - WebWorkerTestHelper.Log($"Unexpected test case {memberName} timeout after {end - start} ManagedThreadId:{Environment.CurrentManagedThreadId}"); - }); - return cts; - } - - public static IEnumerable GetTargetThreads() - { - return Enum.GetValues().Select(type => new object[] { new Executor(type) }); - } - - public static IEnumerable GetBlockingFriendlyTargetThreads() - { - yield return new object[] { new Executor(ExecutorType.Main) }; - yield return new object[] { new Executor(ExecutorType.NewThread) }; - yield return new object[] { new Executor(ExecutorType.ThreadPool) }; - // JSWebWorker is missing here because JS can't resolve promises while blocked - } - - public static IEnumerable GetSpecificTargetThreads2x() - { - yield return new object[] { new Executor(ExecutorType.Main), new Executor(ExecutorType.Main) }; - yield break; - } - - public static IEnumerable GetTargetThreads2x() - { - return Enum.GetValues().SelectMany( - type1 => Enum.GetValues().Select( - type2 => new object[] { new Executor(type1), new Executor(type2) })); - } - - protected async Task ActionsInDifferentThreads(Executor executor1, Executor executor2, Func, Task> e1Job, Func e2Job, CancellationTokenSource cts) - { - TaskCompletionSource job1ReadyTCS = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - TaskCompletionSource job2DoneTCS = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var e1Done = false; - var e2Done = false; - var e1Failed = false; - Task e1; - Task e2; - T r1; - - async Task ActionsInDifferentThreads1() - { - try - { - await e1Job(job2DoneTCS.Task, job1ReadyTCS); - if (!job1ReadyTCS.Task.IsCompleted) - { - job1ReadyTCS.SetResult(default); - } - await job2DoneTCS.Task; - } - catch (Exception ex) - { - WebWorkerTestHelper.Log("ActionsInDifferentThreads1 failed\n" + ex); - job1ReadyTCS.SetResult(default); - e1Failed = true; - throw; - } - finally - { - e1Done = true; - } - } - - async Task ActionsInDifferentThreads2() - { - try - { - await e2Job(r1); - } - finally - { - e2Done = true; - } - } - - - e1 = executor1.Execute(ActionsInDifferentThreads1, cts.Token); - r1 = await job1ReadyTCS.Task.ConfigureAwait(true); - if (e1Failed || e1.IsFaulted) - { - await e1; - } - e2 = executor2.Execute(ActionsInDifferentThreads2, cts.Token); - - try - { - await e2; - job2DoneTCS.SetResult(); - await e1; - } - catch (Exception ex) - { - job2DoneTCS.TrySetException(ex); - if (ex is OperationCanceledException oce && cts.Token.IsCancellationRequested) - { - throw; - } - if (!e1Done || !e2Done) - { - WebWorkerTestHelper.Log("ActionsInDifferentThreads canceling because of unexpected fail: \n" + ex); - cts.Cancel(); - } - else - { - WebWorkerTestHelper.Log("ActionsInDifferentThreads failed with: \n" + ex); - } - throw; - } - } - - static void LocalCtsIgnoringCall(Action action) - { - var cts = new CancellationTokenSource(8); - try - { - action(cts.Token); - } - catch (OperationCanceledException exception) - { - if (exception.CancellationToken != cts.Token) - { - throw; - } - /* ignore the local one */ - } - } - - public static IEnumerable BlockingCalls = new List - { - // things that should NOT throw PNSE - new NamedCall { IsBlocking = false, Name = "Console.WriteLine", Call = delegate (CancellationToken ct) { Console.WriteLine("Blocking"); }}, - new NamedCall { IsBlocking = false, Name = "Directory.GetCurrentDirectory", Call = delegate (CancellationToken ct) { Directory.GetCurrentDirectory(); }}, - new NamedCall { IsBlocking = false, Name = "CancellationTokenSource.ctor", Call = delegate (CancellationToken ct) { - using var cts = new CancellationTokenSource(8); - }}, - new NamedCall { IsBlocking = false, Name = "Task.Delay", Call = delegate (CancellationToken ct) { - Task.Delay(30, ct); - }}, - new NamedCall { IsBlocking = false, Name = "new Timer", Call = delegate (CancellationToken ct) { - new Timer((_) => { }, null, 1, -1); - }}, - new NamedCall { IsBlocking = false, Name = "JSType.DiscardNoWait", Call = delegate (CancellationToken ct) { - WebWorkerTestHelper.Log("DiscardNoWait"); - }}, - - // things which should throw PNSE on sync JSExport and JSWebWorker - new NamedCall { IsBlocking = true, Name = "Task.Wait", Call = delegate (CancellationToken ct) { Task.Delay(30, ct).Wait(ct); }}, - new NamedCall { IsBlocking = true, Name = "Task.WaitAll", Call = delegate (CancellationToken ct) { Task.WaitAll(Task.Delay(30, ct)); }}, - new NamedCall { IsBlocking = true, Name = "Task.WaitAny", Call = delegate (CancellationToken ct) { Task.WaitAny(Task.Delay(30, ct)); }}, - new NamedCall { IsBlocking = true, Name = "ManualResetEventSlim.Wait", Call = delegate (CancellationToken ct) { - using var mr = new ManualResetEventSlim(false); - LocalCtsIgnoringCall(mr.Wait); - }}, - new NamedCall { IsBlocking = true, Name = "SemaphoreSlim.Wait", Call = delegate (CancellationToken ct) { - using var sem = new SemaphoreSlim(2); - LocalCtsIgnoringCall(sem.Wait); - }}, - new NamedCall { IsBlocking = true, Name = "Mutex.WaitOne", Call = delegate (CancellationToken ct) { - using var mr = new ManualResetEventSlim(false); - var mutex = new Mutex(); - var thread = new Thread(() => { - mutex.WaitOne(); - mr.Set(); - Thread.Sleep(50); - mutex.ReleaseMutex(); - }); - thread.Start(); - Thread.ForceBlockingWait(static (b) => ((ManualResetEventSlim)b).Wait(), mr); - mutex.WaitOne(); - }}, - }; - - public static IEnumerable GetTargetThreadsAndBlockingCalls() - { - foreach (var type in Enum.GetValues()) - { - foreach (var call in BlockingCalls) - { - yield return new object[] { new Executor(type), call }; - } - } - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs deleted file mode 100644 index 52f3b3a8c387ca..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs +++ /dev/null @@ -1,403 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Threading; -using Xunit; -using System.Diagnostics.CodeAnalysis; -using System.Reflection; - -namespace System.Runtime.InteropServices.JavaScript.Tests -{ - public partial class WebWorkerTestHelper - { - public static readonly string LocalHttpEcho = "http://" + Environment.GetEnvironmentVariable("DOTNET_TEST_HTTPHOST") + "/Echo.ashx"; - public static readonly string LocalWsEcho = "ws://" + Environment.GetEnvironmentVariable("DOTNET_TEST_WEBSOCKETHOST") + "/WebSocket/EchoWebSocket.ashx"; - - [JSImport("globalThis.console.log")] - [return: JSMarshalAs] - public static partial void Log(string message); - - [JSImport("delay", "InlineTestHelper")] - public static partial Task JSDelay(int ms); - - [JSImport("getTid", "WebWorkerTestHelper")] - public static partial int GetTid(); - - [JSImport("getState", "WebWorkerTestHelper")] - public static partial JSObject GetState(); - - [JSImport("promiseState", "WebWorkerTestHelper")] - public static partial Task PromiseState(); - - [JSImport("validateState", "WebWorkerTestHelper")] - public static partial bool ValidateState(JSObject state); - - [JSImport("promiseValidateState", "WebWorkerTestHelper")] - public static partial Task PromiseValidateState(JSObject state); - - [JSImport("callMeBackSync", "WebWorkerTestHelper")] - public static partial Task CallMeBackSync([JSMarshalAs] Action syncCallback); - - [JSImport("callExportBackSync", "WebWorkerTestHelper")] - public static partial Task CallExportBackSync(string syncExportName); - - public static NamedCall CurrentCallback; - public static CancellationToken CurrentCancellationToken = CancellationToken.None; - public static Exception? LastException = null; - - [JSExport] - public static void CallCurrentCallback() - { - LastException = null; - try - { - CurrentCallback.Call(CurrentCancellationToken); - } - catch (Exception ex) - { - LastException = ex; - } - } - - public static string GetOriginUrl() - { - using var globalThis = JSHost.GlobalThis; - using var document = globalThis.GetPropertyAsJSObject("document"); - using var location = globalThis.GetPropertyAsJSObject("location"); - return location.GetPropertyAsString("origin"); - } - - public static Task ImportModuleFromString(string jsModule) - { - var es6DataUrl = $"data:text/javascript,{jsModule.Replace('\r', ' ').Replace('\n', ' ')}"; - return JSHost.ImportAsync("InlineTestHelper", es6DataUrl); - } - - #region Setup - - [ThreadStatic] - public static JSObject WebWorkerTestHelperModule; - [ThreadStatic] - public static JSObject InlineTestHelperModule; - - [JSImport("setup", "WebWorkerTestHelper")] - internal static partial Task Setup(); - - [JSImport("INTERNAL.forceDisposeProxies")] - internal static partial void ForceDisposeProxies(bool disposeMethods, bool verbose); - - public static async Task CreateDelay() - { - if (InlineTestHelperModule == null) - { - InlineTestHelperModule = await ImportModuleFromString(@" - export function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)) - } - ").ConfigureAwait(false); - } - else - { - await JSDelay(1).ConfigureAwait(false); - } - } - - public static async Task InitializeAsync() - { - if (WebWorkerTestHelperModule != null) - { - await DisposeAsync(); - } - - WebWorkerTestHelperModule = await JSHost.ImportAsync("WebWorkerTestHelper", "../WebWorkerTestHelper.mjs?" + Guid.NewGuid()); - await CreateDelay(); - await Setup(); - } - - public static Task DisposeAsync() - { - WebWorkerTestHelperModule?.Dispose(); - WebWorkerTestHelperModule = null; - return Task.CompletedTask; - } - - [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "thread_id")] - private static extern ref long GetThreadNativeThreadId(Thread @this); - - public static IntPtr NativeThreadId => (int)GetThreadNativeThreadId(Thread.CurrentThread); - - #endregion - } - - #region Executor - - public enum ExecutorType - { - Main, - ThreadPool, - NewThread, - JSWebWorker, - } - - public class Executor - { - public int ExecutorTID; - private static SynchronizationContext _mainSynchronizationContext; - public static SynchronizationContext MainSynchronizationContext - { - - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern")] - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2075:UnrecognizedReflectionPattern")] - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:UnrecognizedReflectionPattern")] - get - { - if (_mainSynchronizationContext != null) - { - return _mainSynchronizationContext; - } - var jsProxyContext = typeof(JSObject).Assembly.GetType("System.Runtime.InteropServices.JavaScript.JSProxyContext"); - var mainThreadContext = jsProxyContext.GetField("_MainThreadContext", BindingFlags.NonPublic | BindingFlags.Static); - var synchronizationContext = jsProxyContext.GetField("SynchronizationContext", BindingFlags.Public | BindingFlags.Instance); - var mainCtx = mainThreadContext.GetValue(null); - _mainSynchronizationContext = (SynchronizationContext)synchronizationContext.GetValue(mainCtx); - return _mainSynchronizationContext; - } - } - - public ExecutorType Type; - - public Executor(ExecutorType type) - { - Type = type; - } - - public Task Execute(Func job, CancellationToken cancellationToken) - { - Task wrapExecute() - { - ExecutorTID = Environment.CurrentManagedThreadId; - AssertTargetThread(); - return job(); - } - - switch (Type) - { - case ExecutorType.Main: - return RunOnTargetAsync(MainSynchronizationContext, wrapExecute, cancellationToken); - case ExecutorType.ThreadPool: - return RunOnThreadPool(wrapExecute, cancellationToken); - case ExecutorType.NewThread: - return RunOnNewThread(wrapExecute, cancellationToken); - case ExecutorType.JSWebWorker: - return JSWebWorker.RunAsync(wrapExecute, cancellationToken); - default: - throw new InvalidOperationException(); - } - } - - public void AssertTargetThread() - { - if (Type == ExecutorType.Main) - { - Assert.Equal(1, Environment.CurrentManagedThreadId); - } - else - { - Assert.NotEqual(1, Environment.CurrentManagedThreadId); - } - if (Type == ExecutorType.ThreadPool) - { - Assert.True(Thread.CurrentThread.IsThreadPoolThread, "IsThreadPoolThread:" + Thread.CurrentThread.IsThreadPoolThread + " Type " + Type); - } - else - { - Assert.False(Thread.CurrentThread.IsThreadPoolThread, "IsThreadPoolThread:" + Thread.CurrentThread.IsThreadPoolThread + " Type " + Type); - } - if (Type == ExecutorType.Main || Type == ExecutorType.JSWebWorker) - { - Assert.NotNull(SynchronizationContext.Current); - Assert.Equal("System.Runtime.InteropServices.JavaScript.JSSynchronizationContext", SynchronizationContext.Current.GetType().FullName); - } - else - { - Assert.Null(SynchronizationContext.Current); - } - } - - public void AssertAwaitCapturedContext() - { - switch (Type) - { - case ExecutorType.Main: - Assert.Equal(1, Environment.CurrentManagedThreadId); - Assert.Equal(ExecutorTID, Environment.CurrentManagedThreadId); - Assert.False(Thread.CurrentThread.IsThreadPoolThread); - break; - case ExecutorType.JSWebWorker: - Assert.NotEqual(1, Environment.CurrentManagedThreadId); - Assert.Equal(ExecutorTID, Environment.CurrentManagedThreadId); - Assert.False(Thread.CurrentThread.IsThreadPoolThread); - break; - case ExecutorType.NewThread: - Assert.NotEqual(1, Environment.CurrentManagedThreadId); - // sometimes this is TP and some times newThread, why ? - if (Thread.CurrentThread.IsThreadPoolThread) - { - Assert.NotEqual(ExecutorTID, Environment.CurrentManagedThreadId); - } - else - { - Assert.Equal(ExecutorTID, Environment.CurrentManagedThreadId); - } - break; - case ExecutorType.ThreadPool: - // it could migrate to any TP thread - Assert.NotEqual(1, Environment.CurrentManagedThreadId); - Assert.True(Thread.CurrentThread.IsThreadPoolThread); - break; - } - } - - public override string ToString() => Type.ToString(); - - // make sure we stay on the executor - public async Task StickyAwait(Task task, CancellationToken cancellationToken) - { - if (Type == ExecutorType.NewThread) - { - task.Wait(cancellationToken); - } - else - { - await task.ConfigureAwait(true); - } - AssertTargetThread(); - } - - public static Task RunOnThreadPool(Func job, CancellationToken cancellationToken) - { - TaskCompletionSource done = new TaskCompletionSource(); - var reg = cancellationToken.Register(() => - { - done.TrySetException(new OperationCanceledException(cancellationToken)); - }); - Task.Run(job, cancellationToken).ContinueWith(result => - { - if (result.IsFaulted) - { - if (result.Exception is AggregateException ag && ag.InnerException != null) - { - done.TrySetException(ag.InnerException); - } - else - { - done.TrySetException(result.Exception); - } - } - else if (result.IsCanceled) - { - done.TrySetCanceled(cancellationToken); - } - else - { - done.TrySetResult(); - } - }, TaskContinuationOptions.ExecuteSynchronously); - return done.Task; - } - - public static Task RunOnNewThread(Func job, CancellationToken cancellationToken) - { - TaskCompletionSource tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var thread = new Thread(() => - { - CancellationTokenRegistration? reg = null; - try - { - if (cancellationToken.IsCancellationRequested) - { - tcs.TrySetException(new OperationCanceledException(cancellationToken)); - return; - } - reg = cancellationToken.Register(() => - { - tcs.TrySetException(new OperationCanceledException(cancellationToken)); - }); - var task = job(); - task.Wait(cancellationToken); - tcs.TrySetResult(); - } - catch (Exception ex) - { - if (ex is AggregateException agg) - { - tcs.TrySetException(agg.InnerException); - } - else - { - tcs.TrySetException(ex); - } - } - finally - { - reg?.Dispose(); - } - }); - thread.Start(); - tcs.Task.ContinueWith((t) => { thread.Join(); }, cancellationToken, TaskContinuationOptions.RunContinuationsAsynchronously, TaskScheduler.Default); - return tcs.Task; - } - - public static Task RunOnTargetAsync(SynchronizationContext ctx, Func job, CancellationToken cancellationToken) - { - TaskCompletionSource tcs = new TaskCompletionSource(); - ctx.Post(async _ => - { - CancellationTokenRegistration? reg = null; - try - { - reg = cancellationToken.Register(() => - { - tcs.TrySetException(new OperationCanceledException(cancellationToken)); - }); - await job().ConfigureAwait(true); - tcs.TrySetResult(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - finally - { - reg?.Dispose(); - } - }, null); - return tcs.Task; - } - } - - #endregion - - public class NamedCall - { - public string Name { get; set; } - public bool IsBlocking { get; set; } - public delegate void Method(CancellationToken ct); - public Method Call { get; set; } - - override public string ToString() => Name; - } - - public class FinalizerTest - { - public static bool FinalizerHit; - ~FinalizerTest() - { - FinalizerHit = true; - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.mjs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.mjs deleted file mode 100644 index e2a8cfadfaea7e..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.mjs +++ /dev/null @@ -1,85 +0,0 @@ -let dllExports; - -let jsState = {}; - -let runtime; - -export async function setup() { - try { - if (!getDotnetRuntime) { - throw new Error("getDotnetRuntime is null or undefined"); - } - if (!runtime) { - runtime = getDotnetRuntime(0); - } - if (!runtime) { - console.error(getDotnetRuntime); - throw new Error("runtime is null or undefined"); - } - dllExports = await runtime.getAssemblyExports("System.Runtime.InteropServices.JavaScript.Tests.dll"); - if (!dllExports) { - throw new Error("dllExports is null or undefined"); - } - jsState.id = getRndInteger(0, 1000); - jsState.tid = getTid(); - } - catch (e) { - console.error("MONO_WASM: WebWorkerTestHelper.setup failed: " + JSON.stringify(globalThis.monoThreadInfo, null, 2)); - console.error("MONO_WASM: WebWorkerTestHelper.setup failed: " + e.toString()); - throw e; - } -} - -export function getState() { - return jsState; -} - -export function validateState(state) { - try { - if (!state) { - throw new Error("state is null or undefined"); - } - const isvalid = state.tid === jsState.tid && state.id === jsState.id; - if (!isvalid) { - console.log("Expected: ", JSON.stringify(jsState)); - console.log("Actual: ", JSON.stringify(state)); - } - return isvalid; - } - catch (e) { - console.error("MONO_WASM: WebWorkerTestHelper.validateState failed: " + e.toString()); - throw e; - } -} - -export async function promiseState() { - await delay(10); - return getState(); -} - -export async function promiseValidateState(state) { - await delay(10); - return validateState(state); -} - -export function getTid() { - return runtime.Module["_pthread_self"](); -} - -export function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)) -} - -export function getRndInteger(min, max) { - return Math.floor(Math.random() * (max - min)) + min; -} - -export async function callMeBackSync(syncCallback) { - syncCallback(); -} - -export async function callExportBackSync(syncExportName) { - const WebWorkerTestHelper = dllExports.System.Runtime.InteropServices.JavaScript.Tests.WebWorkerTestHelper; - const method = WebWorkerTestHelper[syncExportName] - method(); -} \ No newline at end of file diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/test.json b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/test.json deleted file mode 100644 index 9c3916c2a43ae9..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello":"world" -} \ No newline at end of file From 48f3a2c4fd2277ed8d7730072236e879862dd37d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 18 Jun 2026 20:06:03 +0200 Subject: [PATCH 085/101] fix --- .../tests/FunctionalTests/TestConfiguration.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs index c59da067c869b1..d6a89d8ced0668 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; From 9d13e7fd556f33f24eb3f0c8fabf3b55332b4d5b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 19 Jun 2026 08:57:39 +0200 Subject: [PATCH 086/101] disable TestEntryPoint --- .../JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs index 732db9f22bcfd8..13108ab948bbe1 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs @@ -116,6 +116,7 @@ public class Program [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoFULLAOT))] public static void TestEntryPoint() { try From 8ed104d7c0d3b5da38582a3919517ce807adf521 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Fri, 19 Jun 2026 10:26:30 +0200 Subject: [PATCH 087/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/loader/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index a79dfe24af4cee..633f1f15ad298e 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -479,5 +479,5 @@ async function createEmscriptenWorker (): Promise { } if (ENVIRONMENT_IS_WORKER) { - createEmscriptenWorker(); + void createEmscriptenWorker().catch((err) => mono_exit(1, err)); } From fdd3d68b03d5c6665a74aaf83e359dfbbd38d958 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Fri, 19 Jun 2026 10:26:52 +0200 Subject: [PATCH 088/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../Sdk/WorkloadTesting.Core.targets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 5075764fa09fe0..6a35675fe292fe 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -92,8 +92,7 @@ - + Command="sed -i.bak 's|ci\.dot\.net/public|ci.dot.net/dev|g' "$(_DotNetInstallScriptPath)" && rm -f "$(_DotNetInstallScriptPath).bak"" /> From 5f81ab2c579eb90bddda75a9e7c0ff8cde84cebc Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Fri, 19 Jun 2026 10:27:28 +0200 Subject: [PATCH 089/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/pthreads/ui-thread.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 7eb236bc6ee569..9eb4888490fa24 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -302,7 +302,7 @@ function allocateUnusedWorker (): PThreadWorker { if (!WasmEnableThreads) return null as any; const uri = loaderHelpers.scriptUrl; - mono_assert(uri !== undefined, "could not resolve the uri for the js-module-dotnet asset"); + mono_assert(uri !== undefined, "loaderHelpers.scriptUrl must be defined"); const workerNumber = loaderHelpers.workerNextNumber++; const worker = new Worker(uri, { name: "dotnet-worker-" + workerNumber.toString().padStart(3, "0"), From 492409c5a59fa847fcfb0c33830088e996b1acb5 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 19 Jun 2026 13:02:42 +0200 Subject: [PATCH 090/101] [mono] LLVM backend correctness, NaN-safe FP narrow, and test annotations (precursor to emsdk/LLVM bump) Toolchain-independent changes split out of the Emscripten 5.0.6 / LLVM 23 upgrade so they can merge ahead: - Mono LLVM backend: thread LLVMContextRef instead of the global context, mask negative int constants in const_int8/const_int32 and the 32-bit OP_STORE_*_IMM path, use LLVMConstAllOnes where an all-ones value is intended, sign-extend the signed OP_ICOMPARE_IMM immediate, and add NaN-preserving FP narrowing (emit_fpnarrow/quiet_nan_for_fptype). The LLVM 23-only paths are guarded by LLVM_API_VERSION and compile out / are equivalent on the current LLVM 19. - WorkloadTesting.Core.targets: rewrite ci.dot.net/public -> ci.dot.net/dev via native sed/PowerShell instead of round-tripping the script through MSBuild. - Test annotations only (ActiveIssue): Half iOS (#129507), Mono interop (#129581), Mono JIT/Loader (#129508), Wasm.Build.Tests EventPipe (#129584). Excludes the general-testing NuGet feed and all emscripten/LLVM version, EH/codegen flag, worker-module removal, and browser file-system timestamp changes. --- .../System/HalfTests.GenericMath.cs | 12 ++ .../System.Runtime.Tests/System/HalfTests.cs | 12 ++ src/mono/mono/mini/mini-llvm-cpp.cpp | 34 +++-- src/mono/mono/mini/mini-llvm-cpp.h | 4 +- src/mono/mono/mini/mini-llvm.c | 140 ++++++++++++++++-- .../Sdk/WorkloadTesting.Core.targets | 13 ++ .../Blazor/EventPipeDiagnosticsTests.cs | 2 + .../SafeArray/SafeArrayTest.cs | 4 + .../PInvoke/Variant/VariantTest.BuiltInCom.cs | 1 + .../Variant/VariantTest.ComWrappers.cs | 1 + .../DelegatePInvoke/DelegatePInvokeTest.cs | 1 + .../ReversePInvokeTest.cs | 1 + .../Desktop/boxunboxvaluetype.cs | 1 + .../nullabletypes/castclassvaluetype.cs | 1 + .../V1.1-M1-Beta1/b143840/b143840.il | 5 + .../JitBlue/Runtime_105619/Runtime_105619.cs | 1 + .../JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs | 1 + .../JIT/jit64/localloc/call/call05_large.il | 5 + .../JIT/jit64/localloc/call/call05_small.il | 5 + .../UnitTest_GVM_TypeLoadException.il | 4 + 20 files changed, 220 insertions(+), 28 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs index af8cc2c1e1bb81..0bd10ea462393b 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs @@ -48,6 +48,7 @@ private static void AssertBitwiseEqual(Half expected, Half actual) // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_AdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_Addition(Half.NegativeInfinity, One)); @@ -68,6 +69,7 @@ public static void op_AdditionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedAdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_CheckedAddition(Half.NegativeInfinity, One)); @@ -237,6 +239,7 @@ public static void op_LessThanOrEqualTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_Decrement(Half.NegativeInfinity)); @@ -257,6 +260,7 @@ public static void op_DecrementTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_CheckedDecrement(Half.NegativeInfinity)); @@ -281,6 +285,7 @@ public static void op_CheckedDecrementTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_Division(Half.NegativeInfinity, Two)); @@ -301,6 +306,7 @@ public static void op_DivisionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_CheckedDivision(Half.NegativeInfinity, Two)); @@ -737,6 +743,7 @@ public static void TryWriteSignificandLittleEndianTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_IncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_Increment(Half.NegativeInfinity)); @@ -757,6 +764,7 @@ public static void op_IncrementTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedIncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_CheckedIncrement(Half.NegativeInfinity)); @@ -837,6 +845,7 @@ public static void MultiplicativeIdentityTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_MultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_Multiply(Half.NegativeInfinity, Two)); @@ -857,6 +866,7 @@ public static void op_MultiplyTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedMultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_CheckedMultiply(Half.NegativeInfinity, Two)); @@ -2341,6 +2351,7 @@ public static void NegativeOneTest() // [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_SubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_Subtraction(Half.NegativeInfinity, One)); @@ -2361,6 +2372,7 @@ public static void op_SubtractionTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedSubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_CheckedSubtraction(Half.NegativeInfinity, One)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs index 9afb3ce6cfab37..7736ce89e80200 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs @@ -556,6 +556,7 @@ public static IEnumerable ExplicitConversion_FromSingle_TestData() [MemberData(nameof(ExplicitConversion_FromSingle_TestData))] [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromSingle(float f, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)f; @@ -654,6 +655,7 @@ public static IEnumerable ExplicitConversion_FromDouble_TestData() [MemberData(nameof(ExplicitConversion_FromDouble_TestData))] [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromDouble(double d, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)d; @@ -1491,6 +1493,7 @@ public static IEnumerable ExpM1_TestData() [Theory] [MemberData(nameof(ExpM1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExpM1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.ExpM1(value), allowedVariance); @@ -1579,6 +1582,7 @@ public static IEnumerable Exp2M1_TestData() [Theory] [MemberData(nameof(Exp2M1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp2M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp2M1(value), allowedVariance); @@ -1667,6 +1671,7 @@ public static IEnumerable Exp10M1_TestData() [Theory] [MemberData(nameof(Exp10M1_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp10M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp10M1(value), allowedVariance); @@ -2009,6 +2014,7 @@ public static IEnumerable AcosPi_TestData() [Theory] [MemberData(nameof(AcosPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AcosPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.AcosPi(value), allowedVariance); @@ -2036,6 +2042,7 @@ public static IEnumerable AsinPi_TestData() [Theory] [MemberData(nameof(AsinPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AsinPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AsinPi(-value), allowedVariance); @@ -2074,6 +2081,7 @@ public static IEnumerable Atan2Pi_TestData() [Theory] [MemberData(nameof(Atan2Pi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Atan2PiTest(Half y, Half x, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.Atan2Pi(-y, +x), allowedVariance); @@ -2102,6 +2110,7 @@ public static IEnumerable AtanPi_TestData() [Theory] [MemberData(nameof(AtanPi_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AtanPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AtanPi(-value), allowedVariance); @@ -2338,6 +2347,7 @@ public static IEnumerable Lerp_TestData() [Theory] [MemberData(nameof(Lerp_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void LerpTest(Half value1, Half value2, Half amount, Half expectedResult) { AssertExtensions.Equal(+expectedResult, Half.Lerp(+value1, +value2, amount), Half.Zero); @@ -2373,6 +2383,7 @@ public static IEnumerable DegreesToRadians_TestData() [Theory] [MemberData(nameof(DegreesToRadians_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void DegreesToRadiansTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.DegreesToRadians(-value), allowedVariance); @@ -2408,6 +2419,7 @@ public static IEnumerable RadiansToDegrees_TestData() [Theory] [MemberData(nameof(RadiansToDegrees_TestData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void RadiansToDegreesTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.RadiansToDegrees(-value), allowedVariance); diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 80d99c341c6802..a01db4d29a29fe 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -308,12 +308,12 @@ mono_llvm_replace_uses_of (LLVMValueRef var, LLVMValueRef v) } LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len) +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len) { #if LLVM_API_VERSION >= 1600 - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), ArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), ArrayRef(data, len))); #else - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), makeArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), makeArrayRef(data, len))); #endif } @@ -514,7 +514,7 @@ mono_llvm_add_param_attr_with_type (LLVMValueRef param, AttrKind kind, LLVMTypeR switch (kind) { case LLVM_ATTR_STRUCT_RET: - func->addParamAttr (n, Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithStructRetType (func->getContext (), unwrap (type))); break; default: g_assert_not_reached (); @@ -526,7 +526,7 @@ mono_llvm_add_param_byval_attr (LLVMValueRef param, LLVMTypeRef type) { Function *func = unwrap (param)->getParent (); int n = unwrap (param)->getArgNo (); - func->addParamAttr (n, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithByValType (func->getContext (), unwrap (type))); } void @@ -542,7 +542,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, switch (kind) { case LLVM_ATTR_STRUCT_RET: - attr = Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)); + attr = Attribute::getWithStructRetType (unwrap (val)->getContext (), unwrap (type)); unwrap (val)->addParamAttr (index - 1, attr); break; default: @@ -553,7 +553,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, void mono_llvm_add_instr_byval_attr (LLVMValueRef val, int index, LLVMTypeRef type) { - unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (unwrap (val)->getContext (), unwrap (type))); } void* @@ -603,7 +603,7 @@ mono_llvm_di_create_file (void *di_builder, const char *dir, const char *file) void* mono_llvm_di_create_location (void *di_builder, void *scope, int row, int column) { - return DILocation::get (*unwrap(LLVMGetGlobalContext ()), row, column, (Metadata*)scope); + return DILocation::get (cast((Metadata*)scope)->getContext (), row, column, (Metadata*)scope); } void @@ -631,7 +631,7 @@ mono_llvm_di_builder_finalize (void *di_builder) LLVMValueRef mono_llvm_get_or_insert_gc_safepoint_poll (LLVMModuleRef module) { - llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(unwrap(LLVMVoidType()), false)); + llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(Type::getVoidTy(unwrap(module)->getContext()), false)); return wrap (dyn_cast (callee.getCallee ())); } @@ -720,12 +720,16 @@ mono_llvm_register_intrinsic (LLVMModuleRef module, IntrinsicId id, LLVMTypeRef auto intrins_id = get_intrins_id (id); if (intrins_id != not_intrinsic) { +#if LLVM_API_VERSION >= 2100 + Function *f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id); +#else Function *f = Intrinsic::getDeclaration (unwrap (module), intrins_id); +#endif if (!f) { outs () << id << "\n"; g_assert_not_reached (); } - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id); + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id); *out_type = wrap (type); return wrap (f); } else { @@ -748,8 +752,12 @@ mono_llvm_register_overloaded_intrinsic (LLVMModuleRef module, IntrinsicId id, L Type *arr [max_types]; for (int i = 0; i < ntypes; ++i) arr [i] = unwrap (types [i]); +#if LLVM_API_VERSION >= 2100 + auto f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); +#else auto f = Intrinsic::getDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id, { arr, (size_t)ntypes }); +#endif + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id, { arr, (size_t)ntypes }); *out_type = wrap (type); return wrap (f); } @@ -784,8 +792,8 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, } LLVMTypeRef -mono_llvm_get_ptr_type (void) +mono_llvm_get_ptr_type (LLVMContextRef ctx) { - PointerType *t = PointerType::get (*unwrap (LLVMGetGlobalContext ()), 0); + PointerType *t = PointerType::get (*unwrap (ctx), 0); return wrap (t); } diff --git a/src/mono/mono/mini/mini-llvm-cpp.h b/src/mono/mono/mini/mini-llvm-cpp.h index 9f40accf3043ac..7882ee1ce8ce52 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.h +++ b/src/mono/mono/mini/mini-llvm-cpp.h @@ -111,7 +111,7 @@ void mono_llvm_set_must_tailcall (LLVMValueRef call_ins); LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len); +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len); void mono_llvm_set_is_constant (LLVMValueRef global_var); @@ -234,7 +234,7 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, const char *name); LLVMTypeRef -mono_llvm_get_ptr_type (void); +mono_llvm_get_ptr_type (LLVMContextRef ctx); G_END_DECLS diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index f310f7364f5d88..868d3f215fbc99 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -30,6 +30,16 @@ #define __STDC_CONSTANT_MACROS #endif +// Mono's LLVM backend uses the global-context LLVM-C type accessors (LLVMInt32Type, etc.) +// pervasively. These are deprecated in newer LLVM versions in favor of the *InContext variants. +// Suppress the deprecation warnings rather than threading an LLVMContextRef through every call site. +#if defined(__clang__) || defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + #include "llvm-c/Core.h" #include "llvm-c/BitWriter.h" #include "llvm-c/Analysis.h" @@ -558,13 +568,19 @@ const_int1 (int v) static LLVMValueRef const_int8 (int v) { - return LLVMConstInt (LLVMInt8Type (), v, FALSE); + /* Mask to 8 bits so a negative int is not implicitly sign-extended via + * the (unsigned long long) parameter conversion. Starting with LLVM 23, + * LLVMConstInt retains the upper bits when SignExtend is FALSE, which + * caused constant folding of subsequent ZExt to produce wrong results + * (e.g. zext i8 -1 to i64 yielding -1 instead of 255). */ + return LLVMConstInt (LLVMInt8Type (), (guint8)v, FALSE); } static LLVMValueRef const_int32 (int v) { - return LLVMConstInt (LLVMInt32Type (), v, FALSE); + /* See const_int8 for why we mask. */ + return LLVMConstInt (LLVMInt32Type (), (guint32)v, FALSE); } static LLVMValueRef @@ -1358,6 +1374,8 @@ resolve_patch (MonoCompile *cfg, MonoJumpInfoType type, gconstpointer target) return res; } +static LLVMValueRef emit_fpnarrow (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype); + /* * convert_full: * @@ -1395,6 +1413,23 @@ convert_full (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype, gboolean is_u if (stype == LLVMDoubleType () && dtype == LLVMFloatType ()) return LLVMBuildFPTrunc (ctx->builder, v, dtype, ""); + /* + * Narrowing a float/double to half (IEEE binary16) must preserve NaN. Route it + * through emit_fpnarrow, which detects a NaN input explicitly and selects a + * canonical quiet NaN, so a target that drops the NaN mantissa during the + * fptrunc (yielding +/-Infinity) cannot turn a NaN into an infinity. Handles + * both scalar and vector half destinations. Mono itself does not emit half + * typed IR today, but keep the central converter correct and NaN-safe instead + * of hitting g_assert_not_reached () below. + */ + if (dtype == LLVMHalfType () && (stype == LLVMFloatType () || stype == LLVMDoubleType ())) + return emit_fpnarrow (ctx, v, dtype); + if (LLVMGetTypeKind (stype) == LLVMVectorTypeKind && LLVMGetTypeKind (dtype) == LLVMVectorTypeKind && + LLVMGetVectorSize (stype) == LLVMGetVectorSize (dtype) && + LLVMGetElementType (dtype) == LLVMHalfType () && + (LLVMGetElementType (stype) == LLVMFloatType () || LLVMGetElementType (stype) == LLVMDoubleType ())) + return emit_fpnarrow (ctx, v, dtype); + #ifdef USE_OPAQUE_POINTERS if (LLVMGetTypeKind (stype) == LLVMPointerTypeKind && LLVMGetTypeKind (dtype) == LLVMPointerTypeKind) return v; @@ -1435,6 +1470,75 @@ convert (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype) return convert_full (ctx, v, dtype, FALSE); } +/* + * quiet_nan_for_fptype: + * + * Return a constant quiet NaN matching the floating point type T. T can be a + * scalar (half/float/double) or a vector of those. + */ +#if LLVM_API_VERSION >= 2300 +static LLVMValueRef +quiet_nan_for_fptype (LLVMTypeRef t) +{ + LLVMTypeRef elem_t = LLVMGetTypeKind (t) == LLVMVectorTypeKind ? LLVMGetElementType (t) : t; + guint64 bits; + LLVMTypeRef int_t; + + switch (LLVMGetTypeKind (elem_t)) { + case LLVMHalfTypeKind: + bits = 0x7e00; /* IEEE binary16 quiet NaN */ + int_t = LLVMInt16Type (); + break; + case LLVMFloatTypeKind: + bits = 0x7fc00000; /* IEEE binary32 quiet NaN */ + int_t = LLVMInt32Type (); + break; + default: + bits = 0x7ff8000000000000ULL; /* IEEE binary64 quiet NaN */ + int_t = LLVMInt64Type (); + break; + } + + LLVMValueRef nan = LLVMConstBitCast (LLVMConstInt (int_t, bits, FALSE), elem_t); + if (LLVMGetTypeKind (t) == LLVMVectorTypeKind) { + unsigned int n = LLVMGetVectorSize (t); + LLVMValueRef elems [MAX_VECTOR_ELEMS]; + g_assert (n <= MAX_VECTOR_ELEMS); + for (unsigned int i = 0; i < n; ++i) + elems [i] = nan; + nan = LLVMConstVector (elems, n); + } + return nan; +} +#endif + +/* + * emit_fpnarrow: + * + * Emit a floating point narrowing conversion (fptrunc) of V to DTYPE which is + * guaranteed to preserve NaN. + * + * Background: the branchless software float->Half (IEEE binary16) conversion used + * by System.Half is, starting with LLVM 23, recognized by the optimizer and may be + * lowered to a hardware narrowing 'fptrunc to '. On some targets + * (e.g. arm64) that narrowing drops the NaN mantissa, leaving an all-ones exponent + * with a zero mantissa, i.e. +/-Infinity. The result is that operations which must + * produce or propagate NaN end up yielding +/-inf. To stay robust against the + * toolchain mis-handling NaN during FP narrowing, detect NaN inputs explicitly and + * select a canonical quiet NaN of the destination type. + */ +static LLVMValueRef +emit_fpnarrow (EmitContext *ctx, LLVMValueRef v, LLVMTypeRef dtype) +{ + LLVMValueRef trunc = LLVMBuildFPTrunc (ctx->builder, v, dtype, ""); +#if LLVM_API_VERSION >= 2300 + /* 'uno' (unordered) is true iff V is NaN, since a NaN is unordered with itself. */ + LLVMValueRef is_nan = LLVMBuildFCmp (ctx->builder, LLVMRealUNO, v, v, ""); + trunc = LLVMBuildSelect (ctx->builder, is_nan, quiet_nan_for_fptype (dtype), trunc, ""); +#endif + return trunc; +} + static void emit_memset (EmitContext *ctx, LLVMValueRef dest, LLVMValueRef val, LLVMValueRef size, int alignment) { @@ -3810,7 +3914,7 @@ emit_div_check (EmitContext *ctx, LLVMBuilderRef builder, MonoBasicBlock *bb, Mo /* b == -1 && a == 0x80000000 */ if (is_signed) { LLVMValueRef c = (LLVMTypeOf (lhs) == LLVMInt32Type ()) ? LLVMConstInt (LLVMTypeOf (lhs), 0x80000000, FALSE) : LLVMConstInt (LLVMTypeOf (lhs), 0x8000000000000000LL, FALSE); - LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstInt (LLVMTypeOf (rhs), -1, FALSE), ""); + LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstAllOnes (LLVMTypeOf (rhs)), ""); LLVMValueRef cond2 = LLVMBuildICmp (builder, LLVMIntEQ, lhs, c, ""); cmp = LLVMBuildICmp (builder, LLVMIntEQ, LLVMBuildAnd (builder, cond1, cond2, ""), LLVMConstInt (LLVMInt1Type (), 1, FALSE), ""); @@ -4353,7 +4457,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder) index [0] = const_int32 (0); index [1] = const_int32 (1); addr = LLVMBuildGEP2 (builder, il_state_type, ctx->il_state, index, 2, ""); - LLVMBuildStore (ctx->builder, LLVMConstInt (types [1], -1, FALSE), addr); + LLVMBuildStore (ctx->builder, LLVMConstAllOnes (types [1]), addr); /* * Set il_state->data [i] to either the address of the arg/local, or NULL. @@ -6390,7 +6494,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) cmp = LLVMBuildICmp (builder, llvm_pred, lhs, LLVMConstNull (LLVMTypeOf (lhs)), ""); } else { - cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), ""); + cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, TRUE), ""); } } else if (ins->opcode == OP_LCOMPARE_IMM) { cmp = LLVMBuildICmp (builder, cond_to_llvm_cond [rel], lhs, rhs, ""); @@ -7016,7 +7120,7 @@ MONO_RESTORE_WARNING values [ins->dreg] = LLVMBuildSIToFP (builder, lhs, LLVMFloatType (), ""); break; case OP_FCONV_TO_R4: - values [ins->dreg] = LLVMBuildFPTrunc (builder, lhs, LLVMFloatType (), ""); + values [ins->dreg] = emit_fpnarrow (ctx, lhs, LLVMFloatType ()); break; case OP_RCONV_TO_R8: values [ins->dreg] = LLVMBuildFPExt (builder, lhs, LLVMDoubleType (), dname); @@ -7204,7 +7308,17 @@ MONO_RESTORE_WARNING index = const_int32 (GTMREG_TO_INT (ins->inst_offset / size)); addr = LLVMBuildGEP2 (builder, t, convert (ctx, base, pointer_type (t)), &index, 1, ""); } - LLVMValueRef srcval = convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t); +#if TARGET_SIZEOF_VOID_P == 4 + /* On 32-bit targets IntPtrType () is i32. ins->inst_imm is a host-width value + * that may be negative (i.e. have its upper bits set). Passing it unmasked makes + * LLVMConstInt receive a value outside i32's unsigned width; starting with LLVM 23 + * that produces a malformed ConstantInt with SignExtend FALSE. Mask to 32 bits, + * matching the existing truncation behavior on older LLVM. See const_int32. */ + LLVMValueRef imm_const = LLVMConstInt (IntPtrType (), (guint32)ins->inst_imm, FALSE); +#else + LLVMValueRef imm_const = LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE); +#endif + LLVMValueRef srcval = convert (ctx, imm_const, t); LLVMValueRef ptrdst = convert (ctx, addr, pointer_type (t)); if (is_unaligned) mono_llvm_build_aligned_store (builder, srcval, ptrdst, is_volatile, 1); @@ -8075,7 +8189,7 @@ MONO_RESTORE_WARNING LLVMValueRef info_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), 8), "@OBJC_IMAGE_INFO"); int32_t objc_imageinfo [] = { 0, 0 }; - LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array ((uint8_t *) &objc_imageinfo, 8)); + LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array (ctx->module->context, (uint8_t *) &objc_imageinfo, 8)); LLVMSetLinkage (info_var, LLVMPrivateLinkage); LLVMSetExternallyInitialized (info_var, TRUE); LLVMSetSection (info_var, "__DATA, __objc_imageinfo,regular,no_dead_strip"); @@ -8091,7 +8205,7 @@ MONO_RESTORE_WARNING LLVMTypeRef name_var_type = LLVMArrayType (LLVMInt8Type (), (unsigned int)(strlen (name) + 1)); LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, name_var_type, "@OBJC_METH_VAR_NAME_"); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, (int)(strlen (name) + 1))); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (const uint8_t*)name, (int)(strlen (name) + 1))); LLVMSetLinkage (name_var, LLVMPrivateLinkage); LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals"); mark_as_used (ctx->module, name_var); @@ -13619,7 +13733,7 @@ emit_method_inner (EmitContext *ctx) LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, type, "missing_method_name"); LLVMSetVisibility (name_var, LLVMHiddenVisibility); LLVMSetLinkage (name_var, LLVMInternalLinkage); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((guint8*)name, len + 1)); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (guint8*)name, len + 1)); mono_llvm_set_is_constant (name_var); g_free (name); @@ -14058,7 +14172,7 @@ add_types (MonoLLVMModule *module) void mono_llvm_init (gboolean enable_jit) { - ptr_t = mono_llvm_get_ptr_type (); + ptr_t = mono_llvm_get_ptr_type (LLVMGetGlobalContext ()); intrin_types [0][0] = i1_t = LLVMInt8Type (); intrin_types [0][1] = i2_t = LLVMInt16Type (); @@ -14469,7 +14583,7 @@ mono_llvm_emit_aot_data_aligned (const char *symbol, guint8 *data, int data_len, d = LLVMAddGlobal (module->lmodule, type, symbol); LLVMSetVisibility (d, LLVMHiddenVisibility); LLVMSetLinkage (d, LLVMInternalLinkage); - LLVMSetInitializer (d, mono_llvm_create_constant_data_array (data, data_len)); + LLVMSetInitializer (d, mono_llvm_create_constant_data_array (module->context, data, data_len)); if (align != 1) LLVMSetAlignment (d, align); mono_llvm_set_is_constant (d); @@ -14911,7 +15025,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name) LLVMDeleteGlobal (cfg->llvm_dummy_info_var); } else { // FIXME: How can this happen ? - LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (NULL, 0)); + LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (module->context, NULL, 0)); } } } diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index c8a742387b7183..6a35675fe292fe 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,6 +84,19 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> + + + + + + diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs index 00045911bda7a2..b3b91ab00abc38 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs @@ -30,11 +30,13 @@ public EventPipeDiagnosticsTests(ITestOutputHelper output, SharedBuildPerTestCla [Fact] [TestCategory("native-mono")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129584", typeof(BuildTestBase), nameof(BuildTestBase.IsMonoRuntime))] public Task BlazorEventPipeTestWithCpuSamplesAOT() => BlazorEventPipeTestWithCpuSamples(Configuration.Release, aot: true); [Theory] [InlineData(Configuration.Debug, false)] [InlineData(Configuration.Release, false)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129584", typeof(BuildTestBase), nameof(BuildTestBase.IsMonoRuntime))] public async Task BlazorEventPipeTestWithCpuSamples(Configuration config, bool aot) { string extraProperties = @" diff --git a/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs b/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs index eb912c06e6cdc2..fb54aa00247817 100644 --- a/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs +++ b/src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs @@ -89,6 +89,7 @@ public static int TestEntryPoint() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalIntArray() { const int rows = 3; @@ -120,6 +121,7 @@ public static void MultidimensionalIntArrayRoundTrip() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalBoolArray() { const int rows = 2; @@ -151,6 +153,7 @@ public static void MultidimensionalBoolArrayRoundTrip() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalStringArray() { const int rows = 2; @@ -171,6 +174,7 @@ public static void MultidimensionalStringArray() } [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBuiltInComEnabled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static void MultidimensionalStringArrayRoundTrip() { const int rows = 2; diff --git a/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs b/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs index 0d3a9ef1e79381..ad46489addb557 100644 --- a/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs +++ b/src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs @@ -12,6 +12,7 @@ public partial class Test_VariantTest [Fact] [PlatformSpecific(TestPlatforms.Windows)] [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] [Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)] public static int TestEntryPoint() { diff --git a/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs b/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs index f83f5a4f263102..85c7b2106f3309 100644 --- a/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs +++ b/src/tests/Interop/PInvoke/Variant/VariantTest.ComWrappers.cs @@ -15,6 +15,7 @@ public partial class Test_VariantTest [Fact] [PlatformSpecific(TestPlatforms.Windows)] [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] [Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)] public static int TestEntryPoint() { diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs index 3cf6f2d883077d..7c5f2043b5b445 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs @@ -690,6 +690,7 @@ private static void TestMethod_DelegatePInvoke_MarshalByVal_Stdcall(StructID str [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static int TestEntryPoint() { try diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs index dda5d7a27e8a1c..b213ddd76b2c71 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs @@ -745,6 +745,7 @@ public static bool TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Expl [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129581", TestRuntimes.Mono)] public static int TestEntryPoint() { try{ diff --git a/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs b/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs index 8d7d0ccb64ef94..89fceaef8a6a2e 100644 --- a/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs +++ b/src/tests/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs @@ -4696,6 +4696,7 @@ public static void Run() public class Test_boxunboxvaluetype { + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs b/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs index 1d7bbed45bdd2e..d5b23f43397160 100644 --- a/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs +++ b/src/tests/JIT/Directed/nullabletypes/castclassvaluetype.cs @@ -4695,6 +4695,7 @@ public static void Run() public class Test_castclassvaluetype { + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il b/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il index ca53f66aa7f2b5..2565bcc03b270e 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1.1-M1-Beta1/b143840/b143840.il @@ -9,6 +9,7 @@ .assembly 'b143840' {} .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .class private auto ansi beforefieldinit ExternalClass extends [mscorlib]System.Object { @@ -44,6 +45,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 3 .locals init (class [System.Threading.Thread]System.Threading.Thread V_0, diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs index 732db9f22bcfd8..13108ab948bbe1 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs @@ -116,6 +116,7 @@ public class Program [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoFULLAOT))] public static void TestEntryPoint() { try diff --git a/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs b/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs index d958abe234da5e..51106edc3fb893 100644 --- a/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs +++ b/src/tests/JIT/Regression/JitBlue/WPF_3226/CSharpRepro/WPF_3226.cs @@ -38,6 +38,7 @@ static void WmGetMinMaxInfo(IntPtr lParam) Marshal.StructureToPtr(mmi, lParam, true); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/129508", TestRuntimes.Mono)] [Fact] public unsafe static int TestEntryPoint() { diff --git a/src/tests/JIT/jit64/localloc/call/call05_large.il b/src/tests/JIT/jit64/localloc/call/call05_large.il index 4414f6a91377bc..c4b74924e68fa6 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_large.il +++ b/src/tests/JIT/jit64/localloc/call/call05_large.il @@ -7,6 +7,7 @@ .ver 4:0:0:0 } .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .assembly extern mscorlib{} .assembly extern localloc_common{} .assembly 'call05_large'{} @@ -20,6 +21,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 11 .locals (int32* intArray1, diff --git a/src/tests/JIT/jit64/localloc/call/call05_small.il b/src/tests/JIT/jit64/localloc/call/call05_small.il index b973a565fd1563..d78aaeb6e2882c 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_small.il +++ b/src/tests/JIT/jit64/localloc/call/call05_small.il @@ -7,6 +7,7 @@ .ver 4:0:0:0 } .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .assembly extern mscorlib{} .assembly extern localloc_common{} .assembly 'call05_small'{} @@ -20,6 +21,10 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 11 .locals (int32* intArray1, diff --git a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il index cb631bf64f517f..65df84dbdafa64 100644 --- a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il +++ b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/UnitTest_GVM_TypeLoadException.il @@ -478,6 +478,10 @@ 01 00 00 00 ) .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = {string('Tests that expect TypeLoadException') type([TestLibrary]TestLibrary.Utilities) string[1] ('IsNativeAot') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = { + string('https://github.com/dotnet/runtime/issues/129508') + int32(0x2) // Mono + } .entrypoint .maxstack 2 .locals init ( bool result ) From 408d21215308d2b9155538878c57181d47bec201 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 19 Jun 2026 17:39:14 +0200 Subject: [PATCH 091/101] after https://github.com/dotnet/runtime/pull/129593 --- .../System/HalfTests.GenericMath.cs | 12 ------------ .../tests/System.Runtime.Tests/System/HalfTests.cs | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs index 0bd10ea462393b..af8cc2c1e1bb81 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.GenericMath.cs @@ -48,7 +48,6 @@ private static void AssertBitwiseEqual(Half expected, Half actual) // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_AdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_Addition(Half.NegativeInfinity, One)); @@ -69,7 +68,6 @@ public static void op_AdditionTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedAdditionTest() { AssertBitwiseEqual(Half.NegativeInfinity, AdditionOperatorsHelper.op_CheckedAddition(Half.NegativeInfinity, One)); @@ -239,7 +237,6 @@ public static void op_LessThanOrEqualTest() // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_Decrement(Half.NegativeInfinity)); @@ -260,7 +257,6 @@ public static void op_DecrementTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDecrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, DecrementOperatorsHelper.op_CheckedDecrement(Half.NegativeInfinity)); @@ -285,7 +281,6 @@ public static void op_CheckedDecrementTest() // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_DivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_Division(Half.NegativeInfinity, Two)); @@ -306,7 +301,6 @@ public static void op_DivisionTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedDivisionTest() { AssertBitwiseEqual(Half.NegativeInfinity, DivisionOperatorsHelper.op_CheckedDivision(Half.NegativeInfinity, Two)); @@ -743,7 +737,6 @@ public static void TryWriteSignificandLittleEndianTest() // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_IncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_Increment(Half.NegativeInfinity)); @@ -764,7 +757,6 @@ public static void op_IncrementTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedIncrementTest() { AssertBitwiseEqual(Half.NegativeInfinity, IncrementOperatorsHelper.op_CheckedIncrement(Half.NegativeInfinity)); @@ -845,7 +837,6 @@ public static void MultiplicativeIdentityTest() // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_MultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_Multiply(Half.NegativeInfinity, Two)); @@ -866,7 +857,6 @@ public static void op_MultiplyTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedMultiplyTest() { AssertBitwiseEqual(Half.NegativeInfinity, MultiplyOperatorsHelper.op_CheckedMultiply(Half.NegativeInfinity, Two)); @@ -2351,7 +2341,6 @@ public static void NegativeOneTest() // [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_SubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_Subtraction(Half.NegativeInfinity, One)); @@ -2372,7 +2361,6 @@ public static void op_SubtractionTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void op_CheckedSubtractionTest() { AssertBitwiseEqual(Half.NegativeInfinity, SubtractionOperatorsHelper.op_CheckedSubtraction(Half.NegativeInfinity, One)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs index 7736ce89e80200..9afb3ce6cfab37 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs @@ -556,7 +556,6 @@ public static IEnumerable ExplicitConversion_FromSingle_TestData() [MemberData(nameof(ExplicitConversion_FromSingle_TestData))] [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromSingle(float f, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)f; @@ -655,7 +654,6 @@ public static IEnumerable ExplicitConversion_FromDouble_TestData() [MemberData(nameof(ExplicitConversion_FromDouble_TestData))] [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExplicitConversion_FromDouble(double d, Half expected) // Check the underlying bits for verifying NaNs { Half h = (Half)d; @@ -1493,7 +1491,6 @@ public static IEnumerable ExpM1_TestData() [Theory] [MemberData(nameof(ExpM1_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void ExpM1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.ExpM1(value), allowedVariance); @@ -1582,7 +1579,6 @@ public static IEnumerable Exp2M1_TestData() [Theory] [MemberData(nameof(Exp2M1_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp2M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp2M1(value), allowedVariance); @@ -1671,7 +1667,6 @@ public static IEnumerable Exp10M1_TestData() [Theory] [MemberData(nameof(Exp10M1_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Exp10M1Test(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.Exp10M1(value), allowedVariance); @@ -2014,7 +2009,6 @@ public static IEnumerable AcosPi_TestData() [Theory] [MemberData(nameof(AcosPi_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AcosPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(expectedResult, Half.AcosPi(value), allowedVariance); @@ -2042,7 +2036,6 @@ public static IEnumerable AsinPi_TestData() [Theory] [MemberData(nameof(AsinPi_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AsinPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AsinPi(-value), allowedVariance); @@ -2081,7 +2074,6 @@ public static IEnumerable Atan2Pi_TestData() [Theory] [MemberData(nameof(Atan2Pi_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void Atan2PiTest(Half y, Half x, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.Atan2Pi(-y, +x), allowedVariance); @@ -2110,7 +2102,6 @@ public static IEnumerable AtanPi_TestData() [Theory] [MemberData(nameof(AtanPi_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void AtanPiTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.AtanPi(-value), allowedVariance); @@ -2347,7 +2338,6 @@ public static IEnumerable Lerp_TestData() [Theory] [MemberData(nameof(Lerp_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void LerpTest(Half value1, Half value2, Half amount, Half expectedResult) { AssertExtensions.Equal(+expectedResult, Half.Lerp(+value1, +value2, amount), Half.Zero); @@ -2383,7 +2373,6 @@ public static IEnumerable DegreesToRadians_TestData() [Theory] [MemberData(nameof(DegreesToRadians_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void DegreesToRadiansTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.DegreesToRadians(-value), allowedVariance); @@ -2419,7 +2408,6 @@ public static IEnumerable RadiansToDegrees_TestData() [Theory] [MemberData(nameof(RadiansToDegrees_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/129507", TestPlatforms.iOS)] public static void RadiansToDegreesTest(Half value, Half expectedResult, Half allowedVariance) { AssertExtensions.Equal(-expectedResult, Half.RadiansToDegrees(-value), allowedVariance); From d062e90a6f301c47179be8538c7c57123bdc4afe Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 20 Jun 2026 20:21:18 +0200 Subject: [PATCH 092/101] use normal install on this branch --- .../Sdk/WorkloadTesting.Core.targets | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 6a35675fe292fe..c8a742387b7183 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,19 +84,6 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> - - - - - - From 0e31ed370b532852de235e3d7f3e8e54f65f975a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 20 Jun 2026 20:27:59 +0200 Subject: [PATCH 093/101] back --- .../Sdk/WorkloadTesting.Core.targets | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index c8a742387b7183..6a35675fe292fe 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,6 +84,19 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> + + + + + + From df9019836864ef28d4f3f3f1f6a7220c7242376c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 20 Jun 2026 20:32:12 +0200 Subject: [PATCH 094/101] pin general-testing version of emscripten --- eng/Versions.props | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index c3817ef6345fda..34badbbc3baf12 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -166,8 +166,10 @@ 2.5.7 - - $(MicrosoftDotNetApiCompatTaskPackageVersion) + + 11.0.0-preview.6.26314.102 $(MicrosoftNETCoreAppRefPackageVersion) $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) From ba458ce6f3ea747bc773b642407a5e861c1fd69b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 20 Jun 2026 20:55:27 +0200 Subject: [PATCH 095/101] pin EmsdkPackageVersion --- eng/Versions.props | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 34badbbc3baf12..cbdeadab49f8bd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -166,12 +166,14 @@ 2.5.7 - + 11.0.0-preview.6.26314.102 - $(MicrosoftNETCoreAppRefPackageVersion) + + 11.0.0-preview.6.26314.102 $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) 5.0.6 From 95683031d82019ba0cea6c262c5514d8ce7ee00b Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Sun, 21 Jun 2026 11:13:59 +0200 Subject: [PATCH 096/101] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/loader/globals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index f0fa34da47596a..503e926834cae6 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -19,7 +19,7 @@ import { mono_log_error, set_thread_prefix, setup_proxy_console } from "./loggin import { invokeLibraryInitializers } from "./libraryInitializers"; import { deep_merge_config, isDebuggingSupported } from "./config"; -// if we are ST build or the first script loaded in the web worker, we are expected to become the sidecar +// If we are a single-threaded build running in a web worker, we are expected to become the sidecar if (typeof importScripts === "function" && (!WasmEnableThreads)) { (globalThis as any).dotnetSidecar = true; } From 4db429c1d60563715229f7caaed26d93bb600f67 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jun 2026 12:27:06 +0200 Subject: [PATCH 097/101] pin more --- eng/Versions.props | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index cbdeadab49f8bd..80b0167beea1e0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -27,7 +27,12 @@ <_GlobalJsonContent>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)../global.json')) <_GlobalJsonSdkVersion Condition="'$(_GlobalJsonContent)' != ''">$([System.Text.RegularExpressions.Regex]::Match($(_GlobalJsonContent), '"sdk"\s*:\s*\{[^\}]*"version"\s*:\s*"([^"]+)"', System.Text.RegularExpressions.RegexOptions.Singleline).Groups[1].Value) - <_DotnetSdkVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest110100TransportVersion) + + <_DotnetSdkVersion>11.0.100-preview.6.26314.102 $(_DotnetSdkVersion) $(_GlobalJsonSdkVersion) $([System.String]::Copy('$(SdkVersionForWorkloadTesting)').Split('.')[0]) From 6b22fedd1950c094cfed06db629c99ae0949f25a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jun 2026 14:42:35 +0200 Subject: [PATCH 098/101] fix pin --- eng/Versions.props | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 80b0167beea1e0..3596f889d8ecd7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -171,9 +171,13 @@ 2.5.7 - - 11.0.0-preview.6.26314.102 + 11.0.100-preview.6.26314.102