Skip to content

[wasm][CoreCLR][R2R] Composite WebCIL images request an unsupported loaded PE layout #131767

Description

@radekdoulik

Description

Composite ReadyToRun WebCIL images generated successfully by Crossgen2 cannot be loaded by a Checked CoreCLR browser-WASM runtime.

NativeImage::Open requests PEImageLayout::LAYOUT_LOADED for the composite image even though WebAssembly defines PEIMAGE_FLAT_LAYOUT_ONLY. The loaded layout cannot be created, and the fallback reaches PEImage::GetOrCreateLayoutInternal without LAYOUT_FLAT being permitted.

Reproduction Steps

  1. Build a Checked CoreCLR browser-WASM runtime and generate Core_Root.

  2. Build and run the existing composite ReadyToRun test:

    src/tests/baseservices/TieredCompilation/BasicTest_DefaultMode_R2r.csproj
    
  3. Crossgen2 emits and validates composite-r2r.wasm and its component images.

  4. CoreCLR fails when loading the composite image.

This was reproduced on current main at 3241014d5a2d09d044d112af0b5bed2d2ad94e96.

Expected behavior

A valid composite WebCIL ReadyToRun image should load and execute on CoreCLR browser-WASM.

Actual behavior

The runtime fails with:

ASSERT FAILED
Expression: bIsFlatLayoutSuitable
Location: src/coreclr/vm/peimage.cpp
Function: GetOrCreateLayoutInternal

Crossgen2 generation and component validation complete successfully; the failure occurs when CoreCLR loads the emitted composite image.

Regression?

No known regression. The defect was exposed as composite ReadyToRun runtime-test coverage was enabled for CoreCLR browser-WASM.

Known Workarounds

Disable composite ReadyToRun execution for affected CoreCLR browser-WASM tests until the runtime requests LAYOUT_FLAT on flat-layout-only targets.

Configuration

  • CoreCLR browser-WASM
  • Checked runtime
  • Composite WebCIL ReadyToRun images
  • Node-hosted runtime tests

Other information

Open PR #131354 addresses this exact flat-layout failure. Issue #130524 tracks the broader CoreCLR browser-WASM ReadyToRun effort.

The eager-fixup lock-order failure previously observed after bypassing this assertion has already been fixed on main by PR #131355 and is not part of this issue.

Note

This issue was drafted with GitHub Copilot assistance.

Activity

  1. dotnet-policy-service commented on Aug 3, 2026

    @dotnet-policy-service
    Contributor

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

  2. dotnet-policy-service commented on Aug 3, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke
    See info in area-owners.md if you want to be subscribed.

  3. JulieLeeMSFT commented on Aug 5, 2026

    @JulieLeeMSFT
    Member

    Failed in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1540634.

    coreclr browser wasm Checked @ (Ubuntu.2604.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-26.04-helix-webassembly-amd64@sha256:0be8725e08b6d0f58ec0290f3f3b70c449123e78b2b33853e9049df84b912fa8
    - readytorun/tests/genericsload/callgenericctor/callgenericctor.cmd
    - readytorun/tests/genericsload/usegenericfield/usegenericfield.cmd
    - Regressions/coreclr/GitHub_49826/test49826/test49826.cmd
    
  4. added
    blocking-outerloopBlocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs
    on Aug 5, 2026
  5. self-assigned this
    on Aug 6, 2026
  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 6, 2026
  7. added this to the Future milestone on Aug 6, 2026
  8. jkotas commented on Aug 6, 2026

    @jkotas
    Member

    Likely fixed by #131354

  9. modified the milestones: Future, 12.0.0 on Aug 6, 2026
  10. lewing commented on Aug 24, 2026

    @lewing
    Member

    Verified fixed by #131354.

    The Aug 5 failure report above predates the fix. Build 1540634 queued at 09:00 UTC on c8f97975ab0d8ff84aebf176829e17f7c7052f03; #131354 merged at 09:25 UTC as c8e00c97835aa8278551ec51afed831a1987d462. That commit is not an ancestor of the build's source version, so the run did not contain the fix.

    Current state on main — outerloop build 1565369 (113dfc84608caa4b9a87a302c952bf7f35617240), coreclr browser wasm Checked: both Helix jobs green at 85/85 work items, zero failures. No bIsFlatLayoutSuitable assert anywhere in the logs.

    The three tests reported above now pass, each genuinely going through the previously-broken path (crossgen2 ... --composite -f wasm emitting composite-r2r.wasm, then executed under node against a Checked runtime):

    Test Result
    readytorun/tests/genericsload/callgenericctor/callgenericctor.cmd Passed 19:21:42.679
    readytorun/tests/genericsload/usegenericfield/usegenericfield.cmd Passed 19:21:42.725
    Regressions/coreclr/GitHub_49826/test49826/test49826.cmd Passed 19:23:49.806

    The original repro from the issue description also passes — baseservices/TieredCompilation/BasicTest_DefaultMode_R2r emits composite-r2r.wasm and reports Expected: 100 / Actual: 100 — END EXECUTION - PASSED.

    No exclusion referencing this issue exists in the test tree, so none of the above is masked by a disabled test.

    For the record, one unrelated browser-wasm failure appeared in build 1564131: work item Regression_PdbOnly_r_2 hit the 900-second timeout in global::A.B.TestEntryPoint(). That is a hang with no layout assert, it is not this issue, and it did not reproduce in the latest run.

    Closing.

    Note

    This analysis was performed with GitHub Copilot assistance.

  11. locked and limited conversation to collaborators on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmWebAssembly architecturearea-ReadyToRunblocking-outerloopBlocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runsos-browserBrowser variant of arch-wasm

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions