[Mono-bugs] [Bug 665788] Get method body on delegate created with DynamicMethod.CreateDelegate

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 20 06:00:48 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=665788

https://bugzilla.novell.com/show_bug.cgi?id=665788#c2


Jb Evain <jbevain at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jbevain at novell.com

--- Comment #2 from Jb Evain <jbevain at novell.com> 2011-01-20 11:00:47 UTC ---
net always throws an InvalidOperationException when trying to get the
MethodBody of a dynamic method.

Proposed patch:

<<<<<<<<<<<<<<
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 29a05d3..0cbcd19 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -6861,6 +6861,9 @@ mono_method_body_get_object (MonoDomain *domain,
MonoMethod *method)
     unsigned char format, flags;
     int i;

+    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)

<<<<<<<<<<<<<<

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list