From 6b2a3ed5103ca11bb928ccf94b6b50bfdbb3d115 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 23 Aug 2017 05:56:01 +0900 Subject: [PATCH 14/23] Fix inconsistency between GetHasCode and Equals (#13513) --- src/mscorlib/src/System/MulticastDelegate.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mscorlib/src/System/MulticastDelegate.cs b/src/mscorlib/src/System/MulticastDelegate.cs index 988bf2b..1d701f0 100644 --- a/src/mscorlib/src/System/MulticastDelegate.cs +++ b/src/mscorlib/src/System/MulticastDelegate.cs @@ -452,6 +452,17 @@ namespace System if (IsUnmanagedFunctionPtr()) return ValueType.GetHashCodeOfPtr(_methodPtr) ^ ValueType.GetHashCodeOfPtr(_methodPtrAux); + if (_invocationCount != (IntPtr)0) + { + var t = _invocationList as Delegate; + + if (t != null) + { + // this is a secure/wrapper delegate so we need to unwrap and check the inner one + return t.GetHashCode(); + } + } + Object[] invocationList = _invocationList as Object[]; if (invocationList == null) { -- 1.9.1