[Mono-bugs] [Bug 27337][Nor] New - Array.CopyTo() doesn't throw exception for different types

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
2 Jul 2002 15:17:25 -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 ndrochak@gol.com.

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

--- shadow/27337	Tue Jul  2 11:17:25 2002
+++ shadow/27337.tmp.24524	Tue Jul  2 11:17:25 2002
@@ -0,0 +1,45 @@
+Bug#: 27337
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ndrochak@gol.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Array.CopyTo() doesn't throw exception for different types
+
+Array.CopyTo() doesn't throw an exception when the arrays have different 
+element types.  Well, it does if the source array is populated with some 
+values, but it should need that.  See below code...
+
+----------------------------------------------------------------
+
+using System;
+
+class Class1
+{
+	static int Main(string[] args)
+	{
+			try {
+				String[] c1 = new String[2];
+				Char[] c2 = new Char[2];
+				// FIXME: Our implementation doesn't 
+throw an exception if
+				//        this is uninitialized.
+				//c1[0] = "Hello";
+				//c1[1] = "World";
+				c1.CopyTo(c2, 0);
+			} catch (ArrayTypeMismatchException) {
+				return 0;
+			}
+			return 1;
+	}
+}