Skip to content

Set CoreCLR runtime flavor for WASM Webcil conversion - #5327

Merged
LoopedBard3 merged 1 commit into
dotnet:mainfrom
LoopedBard3:loopedbard3-coreclr-wasm-webcil-fix
Oct 1, 2026
Merged

LoopedBard3 merged 1 commit into
dotnet:mainfrom
LoopedBard3:loopedbard3-coreclr-wasm-webcil-fix

Conversation

@LoopedBard3

@LoopedBard3 LoopedBard3 commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

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.
  • Internal WASM-only sanity run 3090983 completed against this PR's exact commit 87daace271a6b571add2744f6e834b74838f6088, with onlySanityCheck=true, reusing post-Webcil-v2 runtime bundles from build 3090494. Actual benchmark work items, not just submission/controller tasks, completed with exit code 0:
    • CoreCLR R2R: 34 benchmarks executed. Command includes --wasm-runtime-flavor CoreCLR --wasm-ready-to-run; console contains no unsupported Webcil or No Workload Results errors.
    • CoreCLR interpreter: 34 benchmarks executed.
    • Mono interpreter: 34 benchmarks executed.
  • The overall pipeline is failed, not green: Mono WASM AOT failed before benchmark submission because existing runtime-perf-job.yml download conditions also request LinuxMonoAOTx64 from the current build. That native artifact is absent from this artifact-reuse/WASM-only validation run. The Webcil property change does not modify those conditions. Mono AOT remains unvalidated; no CI was rerun.

This was the requested sanity subset (System.Tests.Perf_*, partition 0), not the full microbenchmark suite. No benchmark execution or full WASM publish was performed locally.


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

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>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The targeted configuration change is correct, documented, and covered across CoreCLR, Mono, and ReadyToRun combinations.

Review effort: Balanced
Findings: None

What changed in this PR

Ensures CoreCLR WASM builds select Webcil wrapper version 2 regardless of ReadyToRun.

Changes:

  • Sets RuntimeFlavor=CoreCLR when Mono is disabled.
  • Adds MSBuild regression coverage.
  • Documents the configuration behavior.
File Description
src/​benchmarks/​micro/​MicroBenchmarks.Wasm.targets Sets the CoreCLR runtime flavor.
scripts/​tests/​test_wasm_coreclr_r2r.py Tests flavor evaluation and import order.
docs/​benchmarking-workflow-dotnet-runtime.md Documents CoreCLR Webcil selection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@LoopedBard3
LoopedBard3 marked this pull request as ready for review September 29, 2026 20:19
@LoopedBard3 LoopedBard3 self-assigned this Sep 29, 2026
@LoopedBard3

Copy link
Copy Markdown
Member Author

This specific failure is being seen as part of wasm_coreclr wasm coreclr_r2r_v8 runs, such as in https://dev.azure.com/dnceng/internal/_build/results?buildId=3090494&view=results.

@DrewScoggins DrewScoggins left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LoopedBard3
LoopedBard3 merged commit cc50fe6 into dotnet:main Oct 1, 2026
79 checks passed
@LoopedBard3
LoopedBard3 deleted the loopedbard3-coreclr-wasm-webcil-fix branch October 1, 2026 16:56
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.

3 participants