[Mono-bugs] [Bug 74875][Nor] New - Custom marshaling differences between Mono and .NET Framework
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 8 May 2005 17:35:39 -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 kornelpal@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74875
--- shadow/74875 2005-05-08 17:35:39.000000000 -0400
+++ shadow/74875.tmp.31861 2005-05-08 17:35:39.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 74875
+Product: Mono: Runtime
+Version: 1.1
+OS:
+OS Details: Windows XP SP2; Mono 1.1.6; .NET Framework 1.1 SP1
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: interop
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: kornelpal@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Custom marshaling differences between Mono and .NET Framework
+
+I think all of these issues are operating system independent.
+
+I have found the following differences in marshaling that are breaking
+compatibility with .NET Framework:
+
+ICustomMarshaler:
+
+1. .NET Framework throws managed exceptions if the custom marshaler does
+not implement ICustomMarshaler or does not have a static method named
+GetInstance that has a single string type parameter.
+
+Mono shows message boxes as a result of assertions in marshal.c instead
+of managed exceptions and loads all the methods by name and does not care
+about ICustomMarshaler.
+
+2. .NET Framework calls the methods on the returned object using the
+ICustomMarshaler interface.
+
+Mono calls the methods of the referenced class but passes the object
+returned by GetInstance instead of using ICustomMarshaler on the returned
+object.
+
+3. .NET Framework does not call Marshal... and Cleanup... methods if the
+pointer has the value of null or IntPtr.Zero.
+
+Mono calls these methods anyway. Should not call them to maintain
+compatibility.
+
+4. .NET Framework supports custom marshaling of ref (and out) parameters
+as well.
+
+Mono does not support custom marshaling of ref (and out) parameters it
+causes assertion. It should be implemented the same way as for non-
+reference parameters and the runtime should pass the ponters returned by
+ICustomMarshaler by reference.
+
+Array marshaling (without ICustomMarshaler):
+
+5. .NET Framework supports non-reference arrays to be marshaled with
+OutAttribute() (without out) by copying the contents of the managed
+arrary to the unmanaged array.
+
+Mono does not copy back the contents of the array with OutAttribute().
+
+This is currently supported only using Marshal.Copy and IntPtr parameter
+type workaround.
+
+These differences should be corrected in order to make Mono marshaling
+compatible with .NET Framework marshaling.
+
+Sincerely,
+Kornél