Skip to content

Fix value type unboxing bug - #69815

Merged
buyaa-n merged 3 commits into
dotnet:mainfrom
buyaa-n:struct_unboxing
May 26, 2022
Merged

Fix value type unboxing bug#69815
buyaa-n merged 3 commits into
dotnet:mainfrom
buyaa-n:struct_unboxing

Conversation

@buyaa-n

@buyaa-n buyaa-n commented May 25, 2022

Copy link
Copy Markdown
Contributor

Fixes: #67989

As @jkotas mentioned:

The MethodDesc* should be always normalized using MethodDesc::FindOrCreateAssociatedMethodDescForReflection before MethodInfos are created for them. This normalization seems to be missing in Delegate.Method

Plus unboxing logic in MethodDesc::FindOrCreateAssociatedMethodDescForReflection() has a bug which causing issue for value types

@ghost

ghost commented May 25, 2022

Copy link
Copy Markdown

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

Comment thread src/coreclr/vm/genmeth.cpp
Comment thread src/coreclr/vm/genmeth.cpp
@ghost

ghost commented May 25, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes: #67989

As @jkotas mentioned: "The MethodDesc* should be always normalized using MethodDesc::FindOrCreateAssociatedMethodDescForReflection before MethodInfos are created for them. This normalization seems to be missing in Delegate.Method implementation" plus unboxing logic in MethodDesc::FindOrCreateAssociatedMethodDescForReflection() has a bug which causing issue for value types

Author: buyaa-n
Assignees: buyaa-n
Labels:

area-System.Reflection

Milestone: -

Comment thread src/libraries/System.Runtime/tests/System/DelegateTests.cs Outdated
@buyaa-n
buyaa-n force-pushed the struct_unboxing branch from 0b709bc to 5578c94 Compare May 26, 2022 15:40

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thank you!

@buyaa-n

buyaa-n commented May 26, 2022

Copy link
Copy Markdown
Contributor Author

Thank for the review and suggestions, the 2 failures looks unrelated and reported: #64944 #69806, so merging

@buyaa-n
buyaa-n merged commit 5734a23 into dotnet:main May 26, 2022
@buyaa-n
buyaa-n deleted the struct_unboxing branch May 26, 2022 21:15
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodInfo objects for same method are not equal

3 participants