Skip to content

[browser][coreclr] Add trimmed managed dev-loop/prod flavors - #137440

Draft
pavelsavara wants to merge 5 commits into
pavelsavara-browser-coreclr-native-flavorsfrom
pavelsavara-browser-coreclr-trimmed-native-flavors
Draft

pavelsavara wants to merge 5 commits into
pavelsavara-browser-coreclr-native-flavorsfrom
pavelsavara-browser-coreclr-trimmed-native-flavors

Conversation

@pavelsavara

@pavelsavara pavelsavara commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

This draft is stacked on #137014, which supplies the production and diagnostics native prelinks. Review and merge #137014 first.

  • Build and package separate production and diagnostics trimmed shared-framework closures for CoreCLR Browser WebAssembly.
  • Generate and check in P/Invoke/QCall, reverse P/Invoke, and interpreter-to-managed helpers for each closure. Browserhost links the matching helper archive without regenerating the helpers during runtime builds.
  • Select matching managed and native assets without requiring wasm-tools. Build defaults to diagnostics and uses the compatible runtime-pack ReadyToRun images; a production build uses trimmed IL. Publish defaults to production and retains app-specific trimming and optional ReadyToRun compilation.
  • Treat explicit EnableDiagnostics and EventSourceSupport settings as flavor aliases without making either property independently trigger a native relink. Keep the diagnostics prelink available to Browser library tests that enable either tracing property.
  • Let the outer publish generate the boot config for lazy-loaded assemblies; skip boot-config generation in native-only nested publishes.
  • Verify that managed EventListener still receives manifest and dynamic events with the production native prelink and native EventPipe disabled.

Release size comparison

Measurements are from the pre-rebase Release runtime-pack nupkg. Compressed values are the sum of the corresponding ZIP entry sizes.

Assets Production raw Diagnostics raw Delta Production compressed Diagnostics compressed Delta
Managed closure (181 assemblies) 21,603,840 21,640,704 +36,864 8,219,365 8,228,928 +9,563
Native trio 5,066,114 5,224,143 +158,029 1,861,287 1,917,551 +56,264
dotnet.native.wasm 4,326,597 4,470,706 +144,109 1,694,392 1,746,777 +52,385

System.Private.CoreLib.dll is 5,603,840 bytes in production and 5,619,200 bytes in diagnostics, a 15,360-byte difference.

The two additional checked-in helper archives add 881,242 raw bytes and 301,930 nupkg-compressed bytes. The existing full helper archive remains for corerun compatibility.

Reviewer notes

  • The public migration from EnableDiagnostics to EventSourceSupport is deferred; both settings remain supported.
  • Both managed closures use ILLink all roots to preserve the complete runtime implementation while applying EventSource feature substitutions. Production and diagnostics expose the same helper surface; their managed method bodies differ.
  • Per-app helper generation remains in the workload relink path, where the application closure is not known ahead of time.

Note

This pull request description was generated with GitHub Copilot.

@azure-pipelines

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

@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Nov 12, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@pavelsavara pavelsavara added this to the 12.0.0 milestone Nov 13, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Nov 20, 2026
pavelsavara and others added 5 commits November 25, 2026 12:52
Build production and diagnostics shared-framework closures, generate
flavor-specific interop helpers, and select matching managed and native
assets without wasm-tools.

Keep app publish trimming and workload relinking behavior unchanged.

Co-authored-by: Copilot <[email protected]>
Generate and commit production and diagnostics call-helper tables, build
separate native archives, and select them when prelinking browserhost.

Keep the full framework helper archive for corerun and reserve dynamic
generation for application relinking.

Co-authored-by: Copilot <[email protected]>
Preserve the complete framework implementation while applying EventSource
substitutions, distinguish workload defaults from explicit settings, and
defer flavor asset validation until runtime-pack selection.

Co-authored-by: Copilot <[email protected]>
Adapt the Browser EventPipe component boundary to static provider event
tables, stage diagnostics assets for EventSource-enabled library tests,
and skip publish boot config work in native-only nested publishes.

Regenerate the checked-in flavor helpers for the current CoreLib ABI.

Co-authored-by: Copilot <[email protected]>
Enable the managed EventSource switch directly in the untrimmed test app so the diagnostics alias cannot swap in an enabled EventPipe runtime. Compare the published WASM with the production asset before checking listener delivery.

Co-authored-by: Copilot <[email protected]>
@pavelsavara pavelsavara changed the title [browser][coreclr] Add trimmed managed native flavors [browser][coreclr] Add trimmed managed dev-loop/prod flavors Nov 25, 2026
@pavelsavara
pavelsavara force-pushed the pavelsavara-browser-coreclr-trimmed-native-flavors branch from 4b36a56 to 0059919 Compare November 25, 2026 12:52

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Build-mono linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant