[Mono-bugs] [Bug 79425][Nor] New - GetDelegateForFunctionPointer failing on assemblies compiled by Visual Studio

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Sep 17 10:52:41 EDT 2006


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 james at nerdc0re.com.

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

--- shadow/79425	2006-09-17 10:52:41.000000000 -0400
+++ shadow/79425.tmp.28627	2006-09-17 10:52:41.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 79425
+Product: Mono: Runtime
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Ubuntu Dapper
+Status: NEW   
+Resolution: 
+Severity: 001 One hour
+Priority: Normal
+Component: interop
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: james at nerdc0re.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: GetDelegateForFunctionPointer failing on assemblies compiled by Visual Studio
+
+While using Marshal.GetDelegateForFunctionPointer I am receiving an error
+when executing an assembly compiled by Visual Studio. When executing the
+same code compiled by gmcs it executes correctly.
+
+The code in question is;
+
+StreamHandleWriteFunction writeFunction =
+(StreamHandleWriteFunction)Marshal.GetDelegateForFunctionPointer(streamHandleMarshal.write_function,
+typeof(StreamHandleWriteFunction));
+
+and the error received is;
+
+** ERROR **: file marshal.c: line 4321 (emit_marshal_custom): assertion
+failed: (mtype != NULL)
+
+which leads to;
+
+mtype = mono_reflection_type_from_name (spec->data.custom_data.custom_name,
+mb->method->klass->image);
+
+When I run the gmcs version under gdb I find that custom_name =
+
+custom_name = 0x817dca0 "FreeSwitch.Marshaling.StreamHandleMarshaler,
+FreeSwitch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
+
+And when I run the VS version under gdb I get custom_name =
+
+custom_name = 0x8194800 "FreeSwitch.Marshaling.StreamHandleMarshaler"
+
+Now mono_reflection_type_from_name() fails because when it executes
+mono_reflection_parse_type() on line 6416 of reflection.c it is producing;
+
+(gdb) print info
+$4 = {name_space = 0x8175408 "FreeSwitch.Marshaling", name = 0x817541e
+"StreamHandleMarshaler", assembly = {name = 0x0, culture = 0x0,
+    hash_value = 0x0, public_key = 0x0, public_key_token = '\0' <repeats 16
+times>, hash_alg = 0, hash_len = 0, flags = 0, major = 0, minor = 0,
+    build = 0, revision = 0}, modifiers = 0x0, type_arguments = 0x0, nested
+= 0x0}
+
+When the expected result is;
+
+(gdb) print info
+$3 = {name_space = 0x817ad88 "FreeSwitch.Marshaling", name = 0x817ad9e
+"StreamHandleMarshaler", assembly = {name = 0x817adb5 "FreeSwitch",
+    culture = 0xb67fd801 "", hash_value = 0x0, public_key = 0x0,
+public_key_token = '\0' <repeats 16 times>, hash_alg = 0, hash_len = 0,
+flags = 0,
+    major = 0, minor = 0, build = 0, revision = 0}, modifiers = 0x0,
+type_arguments = 0x0, nested = 0x0}
+
+As you can see it is not setting the correct assembly, and a fix will need
+to be applied to mono_reflection_parse_type().


More information about the mono-bugs mailing list