Use RuntimeHelpers.GetHashCode instead of obj.GetHashCode #2128
Labels
area-System.Text.Json
bug
good first issue
Issue should be easy to implement, good for first-time contributors
Milestone
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReferenceEqualsEqualityComparer.cs
Line 24 in 996e668
Replace above line with the following to avoid misbehavior when comparing objects that use a bad implementation of
GetHashCode
Having a bad
GetHashCode
causes the Dictionary to always add an entry, even for objects that are identical.Also update related tests.
The text was updated successfully, but these errors were encountered: