[Mono-bugs] [Bug 71015][Maj] New - Support for Marshal.PtrToStructure in mono

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 5 Jan 2005 06:26:27 -0500 (EST)


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 anis.sk@gmail.com.

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

--- shadow/71015	2005-01-05 06:26:27.000000000 -0500
+++ shadow/71015.tmp.3975	2005-01-05 06:26:27.000000000 -0500
@@ -0,0 +1,50 @@
+Bug#: 71015
+Product: Mono: Runtime
+Version: 1.0
+OS: SUSE 9.1
+OS Details: 2.6.5-7 Kernel
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: anis.sk@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Support for  Marshal.PtrToStructure in mono
+
+Description of Problem:
+Mono supports Marshal.PtrToStructure() when the C# classes/structures  has
+a char[] with Charset = Unicode, but does not support a String type.
+ 
+The following works perfectly fine in  mono without throwing any errors. 
+
+[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+public class Id
+{
+    public int id;
+    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
+    public char[] name;
+};
+
+But incase the data type of "name" is String we get the following error
+
+WARNING **: marshaling
+conversion 12 not implemented
+
+** ERROR **: file marshal.c: line 787
+(emit_ptr_to_str_conv): should not be reached
+aborting...
+Abort
+
+
+I tried to run the same sample with Mono Ver 1.3, it does not work. It
+gives the same error. (The line number is 987).
+
+Is there any specific reason/ major difference for mono supporting char[]
+with Marshal.PtrToStructure and not adding supporting String type? 
+
+Regards
+Anis