Skip to content

Fix Crash Due to Incorrect Optimization of EqualityComparer<T>.Default on Generic Record Type #2127

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 Apr 23, 2025

This is a backport of mono@ef848cf, which is it self a backport of dotnet/runtime#59861

This addresses fixes dotnet/runtime#72181.

The root issue is that the devitalization of EqualityComparer<T>.Default may generate an instance with open generic types still it in. This causes a virtual method resolution lookup in method-to-ir.c to fail and trigger an assert. The upstream fix will disable the devitalization and do a normal virtual call in this case.

  • 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-99151 @scott-ferguson-unity
Mono: Fixed crash on incorrectly optimized calls to EqualityComparer.Default in Generic Record Type Equals implementations

@unity-cla-assistant
Copy link
Collaborator

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Crash in GetHashCode with generic record
5 participants