Author: raja
Date: 2008-02-20 04:58:13 -0500 (Wed, 20 Feb 2008)
New Revision: 96229

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/reflection.c
Log:
* reflection.c (mono_custom_attrs_from_method): Don't silently
return an empty list for generic method instances.
(mono_custom_attrs_from_param): Likewise.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2008-02-20 09:23:12 UTC (rev 96228)
+++ trunk/mono/mono/metadata/ChangeLog  2008-02-20 09:58:13 UTC (rev 96229)
@@ -1,3 +1,9 @@
+2008-02-20  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * reflection.c (mono_custom_attrs_from_method): Don't silently
+       return an empty list for generic method instances.
+       (mono_custom_attrs_from_param): Likewise.
+
 2008-02-20  Rodrigo Kumpera  <[EMAIL PROTECTED]>
            Raja R Harinath  <[EMAIL PROTECTED]>
 

Modified: trunk/mono/mono/metadata/reflection.c
===================================================================
--- trunk/mono/mono/metadata/reflection.c       2008-02-20 09:23:12 UTC (rev 
96228)
+++ trunk/mono/mono/metadata/reflection.c       2008-02-20 09:58:13 UTC (rev 
96229)
@@ -7399,6 +7399,15 @@
 {
        MonoCustomAttrInfo *cinfo;
        guint32 idx;
+
+       /*
+        * An instantiated method has the same cattrs as the generic method 
definition.
+        *
+        * LAMESPEC: The .NET SRE throws an exception for instantiations of 
generic method builders
+        *           Note that this stanza is not necessary for non-SRE types, 
but it's a micro-optimization
+        */
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
        
        if (dynamic_custom_attrs && (cinfo = lookup_custom_attr (method)))
                return cinfo;
@@ -7504,6 +7513,15 @@
        MonoImage *image;
        MonoReflectionMethodAux *aux;
 
+       /*
+        * An instantiated method has the same cattrs as the generic method 
definition.
+        *
+        * LAMESPEC: The .NET SRE throws an exception for instantiations of 
generic method builders
+        *           Note that this stanza is not necessary for non-SRE types, 
but it's a micro-optimization
+        */
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
+
        if (method->klass->image->dynamic) {
                MonoCustomAttrInfo *res, *ainfo;
                int size;

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to