[Mono-bugs] [Bug 33307][Nor] New - Error using System.Array.Copy
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
5 Nov 2002 16:47:51 -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 carlosga@telefonica.net.
http://bugzilla.ximian.com/show_bug.cgi?id=33307
--- shadow/33307 Tue Nov 5 11:47:51 2002
+++ shadow/33307.tmp.3812 Tue Nov 5 11:47:51 2002
@@ -0,0 +1,58 @@
+Bug#: 33307
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: carlosga@telefonica.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Error using System.Array.Copy
+
+Hello:
+
+I´m having problems with results of System.Array.Copy ( tested with mono
+0.16 under Windows 2000 )
+
+Test case:
+
+string user = "SYSDBA";
+string host = System.Net.Dns.GetHostName();
+
+int n = 0;
+byte[] user_id = new byte[200];
+user_id[n++] = 1; // CNCT_user
+user_id[n++] = (byte) user.Length;
+
+System.Array.Copy(Encoding.Default.GetBytes(user), 0, user_id, n, user.Length);
+n += user.Length;
+
+// This shows correct results compiled with csc but not with mcs
+// With csc: SYSDBA is showed complete.
+// With mcs: Only show the 3 first characters of SYSDBA
+Console.WriteLine(Encoding.Default.GetString(user_id));
+
+user_id[n++] = 4; // CNCT_host
+user_id[n++] = (byte) host.Length;
+System.Array.Copy(Encoding.Default.GetBytes(host), 0, user_id, n, host.Length);
+n += host.Length;
+
+// This shows correct results compiled with csc but not with mcs
+// With csc: SYSDBA is showed complete.
+// With mcs: SYSDBA is showed as SYS
+// With csc: Host is showed complete.
+// With mcs: Only show the 3 first characters of the host
+Console.WriteLine(Encoding.Default.GetString(user_id));
+
+Console.ReadLine();
+
+Best regards
+Carlos Guzmán Álvarez
+Vigo-Spain