Repository navigation
[mono] Preserve arguments across AOT exception filters - #136852
Merged
pavelsavara merged 1 commit intoNov 3, 2026
Merged
Conversation
Keep the filter result in a separate interpreter stack value instead of overwriting the first argument before copying arguments back to AOT state. Leave catch and finally return storage unchanged. Adopt the eight reported scenarios into the existing exception suite and cover argument mutations in both accepted and rejected filters. Fixes dotnet#136780 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pavelsavara
requested review from
BrzVlad,
kotlarmilos,
steveisok and
vitek-karas
as code owners
November 2, 2026 17:27
|
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. |
Contributor
|
Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival |
pavelsavara
temporarily deployed
to
copilot-pat-pool
November 2, 2026 17:56 — with
GitHub Actions
Inactive
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
pavelsavara
temporarily deployed
to
copilot-pat-pool
November 2, 2026 17:57 — with
GitHub Actions
Inactive
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
BrzVlad
approved these changes
Nov 2, 2026
This was referenced Nov 2, 2026
Open
kotlarmilos
approved these changes
Nov 3, 2026
Member
Author
|
/ba-g unrelated CI failures |
Member
Author
|
/backport to release/11.0 |
Contributor
|
Started backporting to |
Contributor
|
@pavelsavara backporting to git am output$ git cherry-pick 76e0443e3d4e50f09b831b95c8d32046176c1990
Auto-merging src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs
CONFLICT (content): Merge conflict in src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs
error: could not apply 76e0443e3d4... [mono] Preserve arguments across AOT exception filters (#136852)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: [mono] Preserve arguments across AOT exception filters
Using index info to reconstruct a base tree...
M src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs
CONFLICT (content): Merge conflict in src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 [mono] Preserve arguments across AOT exception filters
Error: The process '/usr/bin/git' failed with exit code 128 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix argument corruption after exception filters in Mono AOT code.
interp_run_clause_with_il_stateused the first argument slot as the filter-result buffer.MINT_ENDFILTERwrote the filter result there, and argument writeback copied it into the suspended AOT frame before the catch ran. This made an integer argument become1and corrupted string references.Give filter evaluation a separate result slot, following the normal interpreter filter path. Catch/finally return storage and legitimate argument/local writeback remain unchanged.
Add the eight reported scenarios to the existing
System.Runtime.Testsexception suite, plus two cases ensuring argument mutations survive both accepted and rejected filters.Testing
Mono/browser-wasm Debug runtime and libraries; Release test app; Chrome with a matching ChromeDriver.
$rootis the checkout path. The local runs used the cached Emscripten SDK viaEMSDK_PATHand cached Chrome viaCHROME_PATH_FOR_TESTS.Runtime/libraries/packs build: passed, 0 warnings and 0 errors.
Chrome AOT exception suite: passed, 18/18 tests. Before the fix, the same suite ran 18 tests with 7 failures: the five original failing scenarios and both argument-mutation cases.
Chrome interpreter exception suite: passed, 20/20 tests. Cleaned this test project's browser-wasm bin/obj directories before switching AOT off to avoid reusing IL-stripped staging. Two existing target-site tests have Mono-AOT exclusions and therefore run only in the interpreter configuration.
The original eight-case probe also passes all cases under both AOT and the interpreter. Other target platforms were not tested locally.
Resolves #136780
Note
This change and PR description were prepared with GitHub Copilot.