Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 8b7dcb5

Browse files
parjongjkotas
authored andcommitted
Fix inconsistency between GetHasCode and Equals (#13513)
1 parent aed0665 commit 8b7dcb5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mscorlib/src/System/MulticastDelegate.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,17 @@ public override sealed int GetHashCode()
452452
if (IsUnmanagedFunctionPtr())
453453
return ValueType.GetHashCodeOfPtr(_methodPtr) ^ ValueType.GetHashCodeOfPtr(_methodPtrAux);
454454

455+
if (_invocationCount != (IntPtr)0)
456+
{
457+
var t = _invocationList as Delegate;
458+
459+
if (t != null)
460+
{
461+
// this is a secure/wrapper delegate so we need to unwrap and check the inner one
462+
return t.GetHashCode();
463+
}
464+
}
465+
455466
Object[] invocationList = _invocationList as Object[];
456467
if (invocationList == null)
457468
{

0 commit comments

Comments
 (0)