Skip to content

Fix Crash from Missing MRGCTX on Default Interface Method #2152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: unity-main
Choose a base branch
from

Conversation

scott-ferguson-unity
Copy link
Collaborator

@scott-ferguson-unity scott-ferguson-unity commented Jun 17, 2025

Mono assumes that all generic default interface methods should pass there generic context in the method generic context register. However it does not correct mark this at the call site when the method isn't sharable.

This leads to a crash in the trampoline where it looks for the generic context on any default interface method.

This crash does not occur in upstream - it was fixed by dotnet/runtime#64129 which replaced the code that this PR patches. It looks like the cleanup in that PR fixed this issues, even if it wasn't explicitly called out.

  • Should this pull request have release notes?
    • Yes
    • No
  • Do these changes need to be back ported?
    • Yes
    • No
  • Do these changes need to be upstreamed to mono/mono or dotnet/runtime repositories?
    • Yes
    • No

Reviewers: please consider these questions as well! ❤️

Release notes

Fixed UUM-109706 @scott-ferguson-unity
Mono: Fix Crash when invoking a default interface method that is generic with value type generic argument

Backports
This does affect all supported versions - but we will want to make sure we understand the risk of this change before backporting.

List the versions of Unity where this change should be back ported here.
-->

Mono assumes that all generic default interface methods should pass
there generic context in the method generic context register.  However
it does not correct mark this at the call site when the method isn't
sharable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants