Skip to content

Use prebuilt framework R2R in browser CoreCLR Debug builds - #136462

Merged
radekdoulik merged 9 commits into
dotnet:mainfrom
radekdoulik:radekdoulik-debug-bcl-r2r-default
Oct 26, 2026
Merged

radekdoulik merged 9 commits into
dotnet:mainfrom
radekdoulik:radekdoulik-debug-bcl-r2r-default

Conversation

@radekdoulik

Copy link
Copy Markdown
Member

Summary

Use the runtime pack's prebuilt ReadyToRun framework images by default for
ordinary CoreCLR browser-wasm Debug builds, including builds used by dotnet run
and dotnet watch. The application and dependencies without prebuilt images
remain IL/interpreted, with normal managed Debug compilation and symbols.

This is the Debug-only first step. Enabling ReadyToRun by default for Release
builds and publishing will be handled later in separate changes, alongside the
remaining codegen-quality and crossgen2-resolution work tracked in
dotnet/runtime#132466.
Release builds and publishing remain opt-in with PublishReadyToRun=true for now.

Reuse the existing build-directory selector and WebCIL staging pipeline rather
than defaulting PublishReadyToRun=true, which would also enable application
crossgen during publishing. Keep the existing PublishReadyToRun=false assignment
for Release; leave the property unset for the Debug build-only selection.
Explicit true/false overrides still win. Performance instrumentation and
WebCIL-disabled builds retain their IL-only default.
Use PublishReadyToRun=false when debugging framework IL or collecting
interpreter PGO for the entire framework.

CLI, direct MSBuild and nested publishing remain opt-in. Mono, WASI, desktop
CoreCLR, debugger settings and Hot Reload settings are unchanged. No new public
property, build flavor or application compilation step is introduced. No
dotnet/sdk companion is needed: the SDK imports these runtime-owned pack targets.

Coverage and validation

Validation on macOS/arm64 used stock SDK 12.0.100-alpha.1.26519.106 with the
source SDK-pack targets and locally built tasks:

  • SDK tasks and Wasm.Build.Tests build: passed, zero warnings/errors.
  • Latest focused run: 4 passed, 0 failed, 0 skipped. Debug/default and
    Release/explicit-true browser builds compare prebuilt images byte-for-byte,
    check non-pack assemblies have no R2R table, and exercise Home/Counter/Weather.
    The other two cases verify explicit false in Debug and Release.
  • Direct MSBuild evaluations: Release defaults false; Debug stays unset;
    explicit true/false overrides are preserved.
  • Retained incremental restaging and explicit R2R publish tests passed in an
    earlier focused run. They were not rerun after the Release-only assignment.

Earlier independent vanilla-template checks, without benchmark presets/imports,
verified emitted binary headers and exact prebuilt images:

Operation Prebuilt framework R2R IL-only assemblies
Debug build and actual watch output 101 82, including the app
Explicit opt-out 0 183
Release build 0 182
Mono Debug 0 183
Debug CLI publish 0 10
Standalone restore, then publish without restore 0 10
Direct MSBuild Publish, trimmed / untrimmed 0 10 / 183
Publish without build after a default Debug build 0 10

The recorded watch output renders and its managed JS exports execute through the
matching stock Blazor DevServer. Stock .106 WasmAppHost has an unrelated missing
ASP.NET Core dependency; that failed host launch is retained separately, not
claimed as a successful watch-host run.

The latest four-case results are from October 22 on this exact source revision.
The broader consumer checks used the same Debug selector before the Release-only
false assignment was restored. No fresh full-runtime/SDK build, successful
managed Hot Reload delta, or performance campaign is claimed.
Native-relink builds using this new default were not newly runtime-tested.

Performance context

Prior five-trial prototype comparisons using the same stock SDK selected the
same prebuilt images, with the application still IL:

Havit walkthrough IL-only framework Prebuilt BCL R2R Change
First comparison 10.083 s 3.778 s -62.5%
Repeat 10.014 s 3.787 s -62.2%

The Mono control was essentially unchanged. These are prior shared-host
application measurements, not new measurements of this patch or isolated CI
results. Smaller build/startup changes were noisy; no compiler/build speedup is
claimed. The larger prebuilt framework payload is an intentional trade-off.
PublishReadyToRun=false restores the IL-only build.

Related to dotnet/runtime#132466.
This enables the Debug development loop, not the issue's full Release/publish
default scope.

Note

This change and proposed description were prepared with GitHub Copilot.

radekdoulik and others added 6 commits October 22, 2026 12:59
Select the runtime pack's prebuilt framework images for ordinary Debug builds without enabling PublishReadyToRun. Keep the application interpreted and preserve explicit overrides, instrumentation, WebCIL opt-out, and CLI/direct/nested publish behavior.\n\nCover directory selection, exact prebuilt image staging, app IL, incremental restaging, browser execution, and publishing defaults in ReadyToRunTests. Document the default and opt-out.

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

Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Remove the workflow-guide change and retain the default-off publishing note with its separate codegen-quality and crossgen2-resolution workstream.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Test the implicit Debug framework R2R default and preserve the existing explicit Release opt-in. Remove the nullable argument and redundant explicit Debug opt-in browser case.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Keep the focused Debug build, explicit override, and incremental staging coverage while removing the two review-requested theories.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Use Configuration alone for the Debug and Release cases, with PublishReadyToRun=false hardcoded. Remove the extra properties argument and unrelated Release default case.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Keep PublishReadyToRun=false under the publishing guidance for Release only. Leave Debug's build-only prebuilt-framework selection and explicit overrides unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
@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.

radekdoulik and others added 2 commits October 26, 2026 12:52
Add WasmUsePrebuiltReadyToRun as the build-only control, preserving explicit legacy overrides and defaulting publishing to false in every configuration. Keep Debug's prebuilt BCL default and make Release build opt-in independent from app crossgen.

Use the CoreCLR test category for ReadyToRunTests and exercise the dedicated setting in build and incremental restaging coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Compute _WasmUsePrebuiltReadyToRun from the existing public PublishReadyToRun override and Debug default without exposing a separate build setting. Keep performance instrumentation excluded at staging, retain the existing publish validation, and use the supported public override in tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07d1d75a-500b-4299-9749-82a8460d30b1
Co-authored-by: Jan Kotas <jkotas@microsoft.com>

@maraf maraf 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.

Reviewed the current changes; no blocking issues found. All 18 isolated MSBuild selector checks passed. Full browser tests were not run locally because the required SDK and build artifacts are unavailable.

Note

This comment was generated with the assistance of GitHub Copilot.

@radekdoulik
radekdoulik enabled auto-merge (squash) October 26, 2026 18:20
@radekdoulik
radekdoulik merged commit e750854 into dotnet:main Oct 26, 2026
48 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 27, 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.

3 participants