Skip to content

[wasm][R2R] GC/API/GC/GetGeneration: objects stay in generation 0 after GC.Collect #134803

Description

@lewing

Description

On browser-wasm CoreCLR with ReadyToRun (RunCrossGen2=1), GC/API/GC/GetGeneration fails. After GC.Collect() the tested objects are still reported as generation 0, so ObjectTest and arrayTest fail:

Running test: GC/API/GC/GetGeneration/GetGeneration.dll
0 0
ObjectTest Failed!
0 0
arrayTest Failed!
failTest Passed!
Test for GetGeneration() FAILED!
Expected: 100
Actual:   1

That matches the reason the test already skips under the interpreter ("Interpreter reports locals as pinned, causing generation demotion that this test does not expect"). The test used to be skipped on every wasm run, because the runtime-test InterpreterActive mode was always true on wasm. #134767 changes InterpreterActive to mean "code runs in the interpreter" (no JIT and not ReadyToRun-compiled), so wasm R2R now runs it.

Configuration

  • Fails: browser-wasm CoreCLR Checked, ReadyToRun (TEST_READY_TO_RUN_MODE=1).
  • Skipped (interpreter): browser-wasm CoreCLR without R2R.
  • Passes: maccatalyst-arm64 CoreCLR Release ReadyToRun (no JIT), android-arm64 CoreCLR, and desktop CoreCLR.

The root cause isn't known. Candidates are part of the call path still running in the interpreter under wasm R2R, or conservative or pinned stack reporting for wasm R2R frames.

Note

This issue was drafted with GitHub Copilot.

Activity

  1. dotnet-policy-service commented on Sep 28, 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 Sep 28, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @anicka-net, @dotnet/gc
    See info in area-owners.md if you want to be subscribed.

  3. AndyAyersMS commented on Sep 28, 2026

    @AndyAyersMS
    Member

    Likely because all stack roots are reported as pinned.

  4. lewing commented on Sep 28, 2026

    @lewing
    MemberAuthor

    Closing as expected behavior. As @AndyAyersMS noted, WebAssembly reports stack roots as pinned, so GetGeneration's generation-promotion checks can't hold there, with or without ReadyToRun. #134767 now skips the test on Browser/Wasi permanently (SkipOnPlatform, linking here for context) instead of quarantining it. It keeps running where the test's own code is compiled, including Apple mobile ReadyToRun.

    Note

    This comment was generated with GitHub Copilot.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions