Skip to content

Narrow Mono AOT typeload error cleanup - #129695

Closed
vitek-karas wants to merge 2 commits into
dotnet:release/10.0from
vitek-karas:copilot/issue-129613-release10-product
Closed

Narrow Mono AOT typeload error cleanup#129695
vitek-karas wants to merge 2 commits into
dotnet:release/10.0from
vitek-karas:copilot/issue-129613-release10-product

Conversation

@vitek-karas

@vitek-karas vitek-karas commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

  • consume the expected recoverable MissingField / BadImage metadata errors after lowering Mono AOT field-resolution failures into runtime throw IR
  • add a direct Mono mini regression in src/mono/mono/mini/iltests.il that covers a generic missing-field access followed by a later accepted inline in the same compiled method

Testing

  • ./build.sh mono -os iossimulator -arch arm64 -c Release -rf mono
  • validated manually against the issue sample / reduced repro by replaying the exact failing AOT compiler command and confirming the fixed compiler succeeds where the regressed compiler asserts in inline_method()
  • local Mono-style regression validation for src/mono/mono/mini/iltests.il:
    • mono iltests.exe --run-only missing_field_then_inline
    • mono --aot=full,static iltests.exe

This doesn't add a CI runnable test as that would require lot of infra which feels a bit too much for servicing change. (I did try, and hitting this is not simple especially with end-to-end test)

Fixes #129613.

Only clear the expected recoverable field-resolution metadata errors after lowering the failure into runtime throw IR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR narrows Mono AOT typeload-error cleanup in the field-resolution recovery path by consuming additional expected/recoverable metadata errors after the failure is lowered into runtime-throw IR, preventing later inlining assertions from seeing a live cfg->error.

Changes:

  • Expand the “recoverable metadata error” cleanup to also clear MONO_ERROR_MISSING_FIELD (in addition to MONO_ERROR_BAD_IMAGE) after HANDLE_TYPELOAD_ERROR in the AOT-only field-resolution failure path.
  • Add an explanatory comment describing why cfg->error must be consumed to avoid inline_method()’s mono_error_assert_ok (cfg->error) assertion later in compilation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vitek-karas
vitek-karas requested a review from BrzVlad June 22, 2026 16:04
@vitek-karas

Copy link
Copy Markdown
Member Author

@BrzVlad could you please take a look before I bring it up for servicing?

@BrzVlad BrzVlad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants