[Mono-bugs] [Bug 35624][Nor] New - MarshalAs(UnmanagedType.LPWStr) does not work properly

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
15 Dec 2002 00:33:17 -0000

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 mathpup@mylinuxisp.com.


--- shadow/35624	Sat Dec 14 19:33:17 2002
+++ shadow/35624.tmp.22556	Sat Dec 14 19:33:17 2002
@@ -0,0 +1,55 @@
+Bug#: 35624
+Product: Mono/Class Libraries
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: MarshalAs(UnmanagedType.LPWStr) does not work properly
+Description of Problem: 
+The MarshalAs(UnmanagedType.LPWStr) attribute does not seem to work propertly for 
+passing a System.String to a C function (using P/Invoke). When marshalling as an 
+LPWStr, the string should be passed as an array of double-byte characters. However, 
+when the C function receives the parameter, this does not seem to be the case. I do not 
+know whether the problem lies in mcs or the class libraries because when I only get 
+correct results when using Rotor's csc to compile and clix to run. (If I use mcs then run 
+with clix or use csc and run with mono, I get errors.) 
+Steps to reproduce the problem: 
+1. Compile libchar.so: gcc -shared -o libchar.so char.c 
+2. Compile unicode.cs: mcs unicode.cs 
+3. Run: mono unicode.exe 
+Actual Results: 
+16961 67 11160 
+Expected Results: 
+65 66 67 
+How often does this happen?  
+Additional Information: 
+See attached test case files