Skip to content

[release/11.0] [mono][aot] Fix recursive struct wrapper normalization - #135334

Draft
github-actions[bot] wants to merge 2 commits into
release/11.0from
backport/pr-135029-to-release/11.0
Draft

github-actions[bot] wants to merge 2 commits into
release/11.0from
backport/pr-135029-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #135438 to release/11.0.

/cc @pavelsavara

Customer Impact

  • Customer reported
  • Found internally

Blazor WebAssembly AOT publishing deterministically crashes
mono-aot-cross with a native stack overflow when a value type contains a
generic value-type field instantiated over the containing type. The customer
reproduction is tracked by #132071 and reproduces on .NET 10 and .NET 11.

Regression

  • Yes
  • No

This is an existing Mono AOT compiler limitation rather than a regression.

Testing

The corrected backport removes the invalid mutually recursive generic test
types from #135029 that caused #135348. It retains only the valid
self-recursive shape and makes the helper types private.

  • .\build.cmd -bl -os browser -subset mono+libs -c Release /p:RuntimeFlavor=Mono
    • Passed with 0 warnings and 0 errors.
  • Mono browser AOT on Chrome,
    System.Tests.ValueTypeTests
    • AOT-compiled 80 assemblies.
    • 23/23 tests passed.
    • XHarness exit code 0.
  • Original source-only Blazor reproduction from Blazor WASM AOT Compilation Failure #132071, using the
    release/11.0 mono-aot-cross
    • App assembly compiled successfully.
    • Dedup aot-instances.dll compiled successfully (14,712/14,747 methods).
  • The corrected test shape was also verified on main before [mono][aot] Fix recursive struct wrapper normalization #135438:
    • The compiler without the fix exits with 0xC00000FD.
    • The compiler with the fix successfully compiles the same test assembly.

Risk

Low. The native change is limited to recursive gsharedvt wrapper-signature
normalization. It uses the existing non-shared fallback when a value type is
encountered again or the bounded recursion depth is reached. Acyclic value
types retain their prior normalization behavior. The corrected test avoids the
invalid cross-runtime metadata that caused the original CI regression.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • For .NET 8 and .NET 9: The PR target branch is release/X.0-staging, not release/X.0.
  • For .NET 10+: The PR target branch is release/X.0 (no -staging suffix).

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

Note

This PR description was updated with GitHub Copilot.

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.

@pavelsavara pavelsavara self-assigned this Oct 7, 2026
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Oct 7, 2026
@pavelsavara pavelsavara added this to the 11.0.0 milestone Oct 7, 2026
@pavelsavara
pavelsavara requested review from BrzVlad and lewing October 7, 2026 09:50
@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.

@jkotas

jkotas commented Oct 7, 2026

Copy link
Copy Markdown
Member

The tests introduced by this PR are failing - #135348 . The fix for these failures should be included in this PR.

@pavelsavara
pavelsavara marked this pull request as draft October 8, 2026 08:44
Remove the mutually recursive generic value types added by the original test.
CoreCLR rejects that metadata while loading System.Runtime.Tests, before test
discovery, which caused #135348 across unrelated CI legs.

Keep the valid self-recursive shape that reproduces the Mono AOT compiler stack
overflow and make its helper types private. This matches the corrected test in
#135438.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pavelsavara pavelsavara changed the title [release/11.0] [mono][aot] Fix stack overflow normalizing self-referencing struct wrappers [release/11.0] [mono][aot] Fix recursive struct wrapper normalization Oct 8, 2026

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-System.Numerics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants