Include missing reflected type in hashcode calculation#120449
Include missing reflected type in hashcode calculation#120449jkotas merged 15 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-reflection |
src/coreclr/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs
Outdated
Show resolved
Hide resolved
|
Can we add some tests to validate that the hashcodes are different for different reflected types? (The test should try multiple types to be resilient against hash collisions.) |
src/libraries/System.Runtime/tests/System.Reflection.Tests/EventInfoTests.cs
Outdated
Show resolved
Hide resolved
Looks like NativeAOT needs the same fix. NativeAOT has a separate implementation of reflection that lives under src\coreclr\nativeaot. |
jairbubbles
left a comment
There was a problem hiding this comment.
Added a few comment regarding consistency between Equals and GetHashCode on the different classes.
In some cases it might be an issue on the Equals itself and is probably out of the scope of this PR.
Fix incorrect runtime member info (
RuntimePropertyInfo,RuntimeMethodInfo,RuntimeEventInfo,RuntimeFieldInfo,RuntimeConstructorInfo) hashcode calculation. Previously it did not include the reflected type, resulting in different sub classes having the same hashcode for properties declared in the base class.Fixes #114280