Skip to content
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

Fix Equals overload logic for some methods of an array created using MLC #60894

Merged
merged 2 commits into from
Oct 28, 2021

Conversation

buyaa-n
Copy link
Member

@buyaa-n buyaa-n commented Oct 26, 2021

Fixes #57728
Update Equals overload for RoMethods created by MetadataLoadContext to check ReturnType instead of DeclaringType

@ghost
Copy link

ghost commented Oct 26, 2021

Tagging subscribers to this area: @buyaa-n
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #57728
Update Equals overload for RoMethods created by MetadataLoadContext to check ReturnType instead of DeclaringType

Author: buyaa-n
Assignees: -
Labels:

area-System.Reflection.Metadata

Milestone: -

@@ -75,6 +75,9 @@ public sealed override bool Equals([NotNullWhen(true)] object? obj)
if (DeclaringType != other.DeclaringType)
Copy link
Member

Choose a reason for hiding this comment

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

For the current code, is DeclaringType always the same for every RoSyntheticMethod? It should be RoArrayType. In any case, comparing Declaring type as-is makes sense if RoSyntheticMethod is ever used outside of arrays.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes DeclaringType is always same for every RoSyntheticMethod, need to check it as-is for different array types like int[] vs long[]

@buyaa-n buyaa-n merged commit 5613572 into dotnet:main Oct 28, 2021
@buyaa-n buyaa-n deleted the fix-equals branch November 3, 2021 19:11
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Some MethodInfo(s) of array types loaded by MetadataLoadContext are incorrectly evaluated as equal.
2 participants