[bug] Prevent a GetMethodBody call on a dynamic method. Fixes 665788
authorJb Evain <jbevain@gmail.com>
Thu, 20 Jan 2011 15:37:21 +0000 (16:37 +0100)
committerJb Evain <jbevain@gmail.com>
Thu, 20 Jan 2011 15:37:21 +0000 (16:37 +0100)
mono/metadata/reflection.c

index 29a05d38b961c4fa487263522b29a980cbc23684..255bf9671c775ac05357b837503a7bdeb1f5e81d 100644 (file)
@@ -6861,6 +6861,10 @@ mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
        unsigned char format, flags;
        int i;
 
+       /* for compatibility with .net */
+    if (method->dynamic)
+        mono_raise_exception (mono_get_exception_invalid_operation (NULL));
+
        if (!System_Reflection_MethodBody)
                System_Reflection_MethodBody = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "MethodBody");
        if (!System_Reflection_LocalVariableInfo)