Skip to content

[release/11.0] Fix NativeAOT GVM dispatch cell lookup in shared code - #137949

Merged
jkotas merged 1 commit into
release/11.0from
backport/pr-137885-to-release/11.0
Nov 20, 2026
Merged

jkotas merged 1 commit into
release/11.0from
backport/pr-137885-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #137885 to release/11.0

/cc @MichalStrehovsky

Customer Impact

  • Customer reported
  • Found internally

#137774 - ML.NET fails to compile

Regression

  • Yes
  • No

Compiler crash after #129609. Copilot says the bug is older but we would only see asserts before that PR (that part I didn't validate).

Testing

Hitting this requires a generic virtual method that is not called through its slot definition where there is a difference in genericness of the owning type of the called method vs the method that owns the slot. Targeted test was added.

Risk

The risk is low, the fix is rather obvious and targeted. No surprises showed up when running complete product test pass.

When calling a generic virtual method from shared code, the target is
normalized to the slot-defining method. The normalized target may not be
runtime-determined even if the original callee context was shared (e.g.
`Mid<__Canon>.M<int>` normalizes to `Base.M<int>`). Both the scanner and
the JIT interface decided whether to do a runtime lookup of the dispatch
cell based on `exactContextNeedsRuntimeLookup`, which describes the
original context, leading to an assert/NotImplementedException. Decide
based on the normalized target instead.

Fixes #137774

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 73a57fb9-9b59-4942-b2bd-304253b3aeb0
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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

Labels

area-NativeAOT-coreclr Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants