Sitelet https://github.com/dotnet/runtime/pull/135051
Skip to content

[browser] Default Webcil V1 unless UseMonoRuntime is true - #135051

Merged
lewing merged 1 commit into
dotnet:mainfrom
lewing:lewing-webcil-version-usemonoruntime
Oct 2, 2026
Merged

lewing merged 1 commit into
dotnet:mainfrom
lewing:lewing-webcil-version-usemonoruntime

Conversation

@lewing

@lewing lewing commented Oct 1, 2026

Copy link
Copy Markdown
Member

Problem

_WasmWebcilVersion in Microsoft.NET.Sdk.WebAssembly.Browser.targets selects Webcil V1 only when RuntimeFlavor == 'CoreCLR' (added in #126876). RuntimeFlavor is set by the runtime repo build (WasmApp.InTree.props), but the shipped SDK and WebAssembly pack never set it. Everywhere else, these targets detect CoreCLR with UseMonoRuntime == 'false'.

As a result, a customer CoreCLR browser app that sets only UseMonoRuntime=false falls through to Webcil V0, and startup aborts:

unsupported Webcil wrapper version 0; expected 2

Evidence

Binlogs from the same app published with SDK 12.0.100-alpha.1.26480.103:

Project Evaluated diff ConvertDllsToWebcil.WebcilVersion System.Private.CoreLib Webcil header
UseMonoRuntime=false + RuntimeFlavor=CoreCLR — 1 V1
UseMonoRuntime=false only only RuntimeFlavor 0 V0

Fix

Default to V1, and select V0 only when UseMonoRuntime == 'true'. The SDK defaults Mono browser apps to UseMonoRuntime=true, and WasmApp.InTree.props maps RuntimeFlavor onto UseMonoRuntime for in-tree builds, so Mono output is unchanged.

Validation

The patched targets were overlaid on the 26480.103 pack, and the app was republished with MSBuild node reuse disabled:

  • UseMonoRuntime=false only: V1 (previously V0)
  • UseMonoRuntime=false + RuntimeFlavor=CoreCLR: V1
  • UseMonoRuntime=true: V0

Note

This pull request was generated by GitHub Copilot.

_WasmWebcilVersion selected V1 only when RuntimeFlavor=CoreCLR, a property
set by the runtime repo build but never by the shipped SDK. A customer
CoreCLR app (UseMonoRuntime=false) therefore fell through to V0, and startup
aborted with "unsupported Webcil wrapper version 0; expected 2".

Default to V1 and select V0 only for Mono (UseMonoRuntime=true), matching
how the rest of the WebAssembly SDK targets detect the runtime flavor.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lewing
lewing requested review from maraf and radekdoulik October 1, 2026 21:03
@lewing
lewing enabled auto-merge (squash) October 1, 2026 21:58
@lewing
lewing merged commit 48da5e6 into dotnet:main Oct 2, 2026
50 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants