Skip to content

Set CoreCLR runtime flavor for WASM Webcil conversion - #8

Closed
LoopedBard3 wants to merge 2 commits into
mainfrom
loopedbard3-coreclr-wasm-webcil-fix
Closed

LoopedBard3 wants to merge 2 commits into
mainfrom
loopedbard3-coreclr-wasm-webcil-fix

Conversation

@LoopedBard3

Copy link
Copy Markdown
Owner

Summary

Set RuntimeFlavor=CoreCLR when UseMonoRuntime=false in MicroBenchmarks.Wasm.targets, independently of the ReadyToRun opt-in. BenchmarkDotNet imports .Wasm.props before its CoreCLR override and .Wasm.targets afterward, so the setting must be applied in the latter.

After dotnet/runtime#134312, CoreCLR requires Webcil wrapper version 2. The WebAssembly SDK selects Webcil payload version 1 (which produces wrapper version 2) only when RuntimeFlavor=CoreCLR; the pinned BenchmarkDotNet generator sets UseMonoRuntime=false but leaves RuntimeFlavor unset. This can produce wrapper version 0 for converted assemblies, causing errors such as Webcil asset '/Dia2Lib.dll' has unsupported Webcil wrapper version 0; expected 2.

Add MSBuild-backed regression coverage for CoreCLR with and without R2R, unchanged Mono/unset behavior, and the generated project import order. Document the configuration in the WASM workflow. No runtime changes or private Webcil-version override.

Validation

  • python -m pytest scripts\tests\test_wasm_coreclr_r2r.py -q: 47 passed, including 12 new MSBuild evaluation cases. The new tests reproduced 4 CoreCLR failures / 8 passes before the fix.
  • A local MSBuild harness importing the real runtime Microsoft.NET.Sdk.WebAssembly.Browser.targets at b965265e2454e3469580c09012e424e46608e7d7 executed _ResolveWasmConfiguration: baseline CoreCLR selected payload 0; fixed CoreCLR selected payload 1 with R2R off and on; Mono remained payload 0.
  • git diff --check passed.

No benchmark execution or full WASM publish was performed locally. The internal WASM-only sanity-check-only run is managed separately; this session did not queue CI.


AI disclosure: This change and its regression coverage were prepared with GitHub Copilot.

lewing and others added 2 commits September 28, 2026 22:42
Remove NoWasmValidator, which required every Task/ValueTask benchmark to be
tagged NoWASM. BenchmarkDotNet now awaits async workloads, so returning an
awaitable is no longer a reason to exclude a benchmark from WASM.

Enable Perf_AsyncMethods, ValueTaskPerfTest, MemoryStreamTests.CopyToAsync and
the MemoryStreamChunkedTests async benchmarks. Validated on Mono WASM (Node)
and CoreCLR WASM (V8). Other async benchmarks keep their NoWASM tags.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply RuntimeFlavor after BenchmarkDotNet's UseMonoRuntime override so Webcil conversion selects the CoreCLR format. Cover R2R and non-R2R property evaluation while preserving Mono defaults.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants