[Mono-bugs] [Bug 65571][Maj] New - [TESTCASE] ModuleBuilder.GetMethod().Invoke() on a DefinePInvokeMethod causes a assert error in reflection.c
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 8 Sep 2004 18:47:49 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by grompf@sublimeintervention.com.
http://bugzilla.ximian.com/show_bug.cgi?id=65571
--- shadow/65571 2004-09-08 18:47:49.000000000 -0400
+++ shadow/65571.tmp.4712 2004-09-08 18:47:49.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 65571
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details: OSX 10.3.4
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: grompf@sublimeintervention.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [TESTCASE] ModuleBuilder.GetMethod().Invoke() on a DefinePInvokeMethod causes a assert error in reflection.c
+
+The following test case causes:
+** ERROR **: file reflection.c: line 8060 (mono_reflection_lookup_dynamic_token): assertion
+failed: (obj)
+aborting...
+
+On CVS HEAD on OSX and 1.0.1 on x86.
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace Apple.Foundation {
+ public class Test {
+ static void Main() {
+ AssemblyName an = new AssemblyName();
+ an.Name = "Apple.ObjCMessaging";
+ AssemblyBuilder builder =
+AppDomain.CurrentDomain.DefineDynamicAssembly(an, AssemblyBuilderAccess.Run);
+ ModuleBuilder module = builder.DefineDynamicModule("MessageModule");
+ MethodBuilder method = module.DefinePInvokeMethod("printf", "libc.so",
+MethodAttributes.PinvokeImpl | MethodAttributes.Static | MethodAttributes.Public,
+CallingConventions.Standard, typeof(void), new Type[]{typeof(string)}, CallingConvention.Winapi,
+CharSet.Auto);
+ method.SetImplementationFlags (MethodImplAttributes.PreserveSig |
+method.GetMethodImplementationFlags());
+ module.CreateGlobalFunctions();
+ Console.WriteLine ("Invoking");
+ module.GetMethod("printf").Invoke(null, new object[]{"HelloWorld!"});
+ }
+ }
+}