Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Oct 3, 2025

Backport of #120313 to release/10.0

/cc @AndyAyersMS

Customer Impact

  • Customer reported
  • Found internally

Reported in #120270

Regression

  • Yes
  • No

When we enabled devirtualization of array interface methods, the interface got instantiated with the array element type, not the interface parameter type. This devirtualization is new in .NET 10.

This can cause runtime failures as these two can diverge, eg enum[] can be cast to IEnumerable<int>.

Testing

Fixed the repro case and several similar test cases (added). This corrects behavior for the value class case and disables the optimization for some ref class cases.

Risk

Low. We are now creating the proper type (for value classes) or disabling the optimization (for ref classes cast to shared interface types).

@AndyAyersMS
Copy link
Member

@davidwrighton PTAL
cc @dotnet/jit-contrib @JulieLeeMSFT @jeffschwMSFT

Copy link
Member

@JulieLeeMSFT JulieLeeMSFT left a comment

Choose a reason for hiding this comment

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

LGTM.

@JulieLeeMSFT JulieLeeMSFT added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI Servicing-consider Issue for next servicing release review labels Oct 3, 2025
@JulieLeeMSFT JulieLeeMSFT added this to the 10.0.0 milestone Oct 3, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@JulieLeeMSFT
Copy link
Member

@davidwrighton, please review the code to backport. CC @dotnet/jit-contrib.

@JulieLeeMSFT JulieLeeMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 13, 2025
@JulieLeeMSFT JulieLeeMSFT merged commit c527b09 into release/10.0 Oct 13, 2025
110 of 113 checks passed
@JulieLeeMSFT JulieLeeMSFT deleted the backport/pr-120313-to-release/10.0 branch October 13, 2025 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants