In .:
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 4 Jul 2008 15:43:40 +0000 (15:43 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 4 Jul 2008 15:43:40 +0000 (15:43 -0000)
2008-07-04  Rodrigo Kumpera  <rkumpera@n ovell.com>

* MethodBase.cs (GetMethodFromHandle): Extract an internal version
of this function that doesn't perform the generic class check.
This method is required to fix the Delegate regression that fixing
#377324 caused.

svn path=/trunk/mcs/; revision=107258

mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/MethodBase.cs

index 8825a35be4c1c22f9f3abb8498974ceb0182f0c5..c9dbf1305ad6e7ea183ae2e29b8b7d7fdc5e85db 100644 (file)
@@ -1,3 +1,10 @@
+2008-07-04  Rodrigo Kumpera  <rkumpera@n ovell.com>
+
+       * MethodBase.cs (GetMethodFromHandle): Extract an internal version
+       of this function that doesn't perform the generic class check.
+       This method is required to fix the Delegate regression that fixing
+       #377324 caused.
+
 2008-06-25  Rodrigo Kumpera  <rkumpera@n ovell.com>
 
        * MethodBase.cs (GetMethodFromHandle): Check if the icall returns null
index aeda4114a007e646ab901c50e0dac235f582716a..a23bb8dc9f9f2108b0f9d6ccfb920455dcad3dce 100644 (file)
@@ -46,14 +46,20 @@ namespace System.Reflection {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern static MethodBase GetCurrentMethod ();
 
-               public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) {
+               internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle) {
                        if (handle.Value == IntPtr.Zero)
                                throw new ArgumentException ("The handle is invalid.");
                        MethodBase res = GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
                        if (res == null)
                                throw new ArgumentException ("The handle is invalid.");                 
+                       return res;
+               }
+
+               public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) {
+                       MethodBase res = GetMethodFromHandleNoGenericCheck (handle);
+                       Type t = res.DeclaringType;
 #if NET_2_0
-                       if (res.DeclaringType.IsGenericType || res.DeclaringType.IsGenericTypeDefinition)
+                       if (t.IsGenericType || t.IsGenericTypeDefinition)
                                throw new ArgumentException ("Cannot resolve method because it's declared in a generic class.");
 #endif
                        return res;