[Mono-bugs] [Bug 52590][Nor] New - No ArrayTypeMismatchException's on multi-dimension arrays

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 4 Jan 2004 16:58:05 -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 bmaurer@users.sf.net.

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

--- shadow/52590	2004-01-04 16:58:05.000000000 -0500
+++ shadow/52590.tmp.30254	2004-01-04 16:58:05.000000000 -0500
@@ -0,0 +1,53 @@
+Bug#: 52590
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: No ArrayTypeMismatchException's on multi-dimension arrays
+
+Mono does not check for array type mismatch on multi-dimension arrays.
+
+using System;
+
+class A {
+	string password = "s3cr37 d474";
+}
+
+class B {
+	public string foo = "shhhhhhhh, dont tell";
+}
+
+class Test {
+	static void Main(string[] args)
+	{
+		try {
+			B [,] array = new B [1,1];
+			object [,] objArray = array;
+			objArray [0,0] = new A ();
+			Console.WriteLine ("Fail: the data is {0}", array [0,0].foo);
+			
+			throw new Exception ("Test failed");
+
+		} catch (ArrayTypeMismatchException) {
+			Console.WriteLine("Miss-matched, good");
+		}
+	}
+}
+
+Mono will print:
+[benm@Ben tmp]$ mono t.exe
+Fail: the data is s3cr37 d474
+
+While MS prints
+Miss-matched, good