From: Zoltan Varga Date: Wed, 2 Aug 2017 06:58:41 +0000 (-0400) Subject: [bcl] Fix Delegate.GetHashCode () so it takes into account the target too. Fixes... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=a48bc439850869e565833d7fe6330c289beffe40 [bcl] Fix Delegate.GetHashCode () so it takes into account the target too. Fixes #58399. (#5296) --- diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs index 4064ed9c901..120991b2f79 100644 --- a/mcs/class/corlib/System/Delegate.cs +++ b/mcs/class/corlib/System/Delegate.cs @@ -495,8 +495,11 @@ namespace System public override int GetHashCode () { - /* same implementation as CoreCLR */ - return GetType ().GetHashCode (); + MethodInfo m; + + m = Method; + + return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0); } protected virtual MethodInfo GetMethodImpl ()