[Mono-bugs] [Bug 46027][Wis] New - Foreach on Array should throw InvalidCastException but does not

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 9 Jul 2003 06:39:02 -0400 (EDT)


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 sestoft@dina.kvl.dk.

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

--- shadow/46027	Wed Jul  9 06:39:02 2003
+++ shadow/46027.tmp.9457	Wed Jul  9 06:39:02 2003
@@ -0,0 +1,57 @@
+Bug#: 46027
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sestoft@dina.kvl.dk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Foreach on Array should throw InvalidCastException but does not
+
+Description of Problem:
+
+Foreach on jagged Array should throw InvalidCastException but does not.
+
+Steps to reproduce the problem:
+1. Compile and run the program below
+
+using System;
+
+class TestArray {
+  public static void Main(String[] args) {
+    double[] zero1 = { 1.0 };
+    double[] zero2 = { 2.0, 3.0 };
+    double[][] t2 = { zero1, zero2 };
+    Array a = t2;
+
+    foreach (double d in a)
+      Console.Write(d + " ");
+    Console.WriteLine();
+  }
+}
+
+Actual Results:
+
+2.12199579096527e-314 4.24399158193054e-314
+
+Expected Results:
+
+InvalidCastException
+
+How often does this happen? 
+
+Always on Debian Linux mono 0.23.
+
+
+Additional Information:
+
+The mcs-generated bytecode behaves correctly under MS CLR 1.1 so the C#
+compiler is not to blame.