Make code behaving like .Net.
authorNN <nn1436401@gmail.com>
Sun, 11 Mar 2012 07:07:40 +0000 (09:07 +0200)
committerNN <nn1436401@gmail.com>
Sun, 11 Mar 2012 07:07:40 +0000 (09:07 +0200)
The original discussion is here:
https://bugzilla.novell.com/show_bug.cgi?id=689533
And this is the proposed patch:
https://bugzillafiles.novell.org/attachment.cgi?id=426501

mono/metadata/reflection.c

index 74e74bead7bcc550195e280204c2f3c63e85fbc6..664d6f90b55ed11c6900823e2ecd97f467f1802c 100644 (file)
@@ -4326,7 +4326,7 @@ fixup_cattrs (MonoDynamicImage *assembly)
                        ctor = mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
                        g_assert (ctor);
 
-                       if (!strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
+                       if (!strcmp (ctor->vtable->klass->name, "MonoCMethod")|| !strcmp (ctor->vtable->klass->name, "ConstructorBuilder")) {
                                MonoMethod *m = ((MonoReflectionMethod*)ctor)->method;
                                idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
                                values [MONO_CUSTOM_ATTR_TYPE] = (idx << MONO_CUSTOM_ATTR_TYPE_BITS) | MONO_CUSTOM_ATTR_TYPE_METHODDEF;