[Mono-bugs] [Bug 48066][Wis] New - marshaling of MarshalAs( UnmanagedType.AsAny ) parameter segfaults in marshal.c

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 31 Aug 2003 20:12:35 -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 pigolkine@gmx.de.

http://bugzilla.ximian.com/show_bug.cgi?id=48066

--- shadow/48066	2003-08-31 20:12:34.000000000 -0400
+++ shadow/48066.tmp.20653	2003-08-31 20:12:34.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 48066
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pigolkine@gmx.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: marshaling of MarshalAs( UnmanagedType.AsAny ) parameter segfaults in marshal.c
+
+Description of Problem:
+
+Marshaling of MarshalAs( UnmanagedType.AsAny ) parameter segfaults in marshal.c
+
+Steps to reproduce the problem:
+1. compile the program:
+using System;
+using System.Runtime.InteropServices;
+
+namespace M {
+public class C {
+		
+	[DllImport ("mono",
+	 CallingConvention = CallingConvention.StdCall, 
+	 CharSet = CharSet.Ansi)]
+internal static extern void mono_main ( [ MarshalAs( UnmanagedType.AsAny )]
+object lpParam);
+		
+	public static void Main() 
+	{
+	mono_main (new object());
+	}
+}
+}
+
+2. run in gdb 
+
+Actual Results:
+Execution stops with output:
+(gdb) run obj_marshal.exe
+Starting program: /usr/bin/mono obj_marshal.exe
+[New Thread 1076147360 (LWP 20743)]
+[New Thread 1086000432 (LWP 20745)]
+[New Thread 1088101680 (LWP 20746)]
+
+Program received signal SIGSEGV, Segmentation fault.
+[Switching to Thread 1088101680 (LWP 20746)]
+0x400bab68 in mono_marshal_get_native_wrapper (method=0x80e7ed8) at
+marshal.c:2837
+2837				if (klass->delegate) {
+(gdb) where
+#0  0x400bab68 in mono_marshal_get_native_wrapper (method=0x80e7ed8) at
+marshal.c:2837
+#1  0x40093ce9 in mono_arch_create_jit_trampoline (method=0x80e7ed8) at
+tramp-x86.c:337
+#2  0x400a3070 in mono_class_vtable (domain=0x805ef80, class=0x80e7688) at
+object.c:515
+#3  0x40057d78 in mono_jit_compile_method (method=0x80e7cc0) at mini.c:7068
+#4  0x40057dc3 in mono_jit_runtime_invoke (method=0x80e7350, obj=0x0,
+params=0x40db17e4, exc=0x0) at mini.c:7092
+#5  0x400a36e8 in mono_runtime_invoke (method=0x80e7350, obj=0x0,
+params=0x40db17e4, exc=0x0) at object.c:711
+#6  0x400a4268 in mono_runtime_exec_main (method=0x80e7350, args=0x8063f60,
+exc=0x0) at object.c:1069
+#7  0x400a3e85 in mono_runtime_run_main (method=0x80e7350, argc=0,
+argv=0xbffff4fc, exc=0x0) at object.c:937
+#8  0x4007960b in mono_jit_exec (domain=0x805ef80, assembly=0x80b2638,
+argc=1, argv=0xbffff4f8) at driver.c:432
+#9  0x400796cd in main_thread_handler (user_data=0xbffff460) at driver.c:459
+#10 0x400bee59 in start_wrapper (data=0x80e6ff0) at threads.c:203
+#11 0x400faad4 in timed_thread_start_routine (args=0x80e7048) at
+timed-thread.c:115
+#12 0x4015daeb in GC_start_routine (arg=0x805bce0) at linux_threads.c:1663
+#13 0x4022e332 in start_thread () from /lib/tls/libpthread.so.0
+(gdb) 
+
+Expected Results:
+
+Some managed exception thrown.
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+Will help to run WebMatrix.
+
+Actually, this marshaling type is used in CreateWindowEx to pass parameter
+to created window. So, looks like most of the times the parameter 
+will have 2 types of values : null and CLIENTCREATESTRUCT.