[Mono-bugs] [Bug 41775][Nor] New - ArrayTypeMismatchException not thrown

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 23 Apr 2003 05:34:44 -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 staerk@inf.ethz.ch.

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

--- shadow/41775	Wed Apr 23 05:34:44 2003
+++ shadow/41775.tmp.27117	Wed Apr 23 05:34:44 2003
@@ -0,0 +1,52 @@
+Bug#: 41775
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: staerk@inf.ethz.ch               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ArrayTypeMismatchException not thrown
+
+The following program should throw an 
+ArrayTypeMismatchException at run-time but
+it does not in Mono.
+
+class Test {
+  public static void Main() {
+    string[] a = { "hello", "world" };
+    object[] b = a;
+    b[0] = new object();
+    // at run-time: ArrayTypeMismatchException
+    System.Console.WriteLine(a[0].Length);
+  }
+}
+
+
+// Mono (Redhat 7.2)
+// > mcs Test.cs
+// Compilation succeeded
+// > mono Test.exe
+// 0
+// > mint Test.exe
+// Segmentation fault
+
+
+// > csc Test.cs
+// Microsoft (R) Visual C# .NET Compiler version 7.00.9466
+// for Microsoft (R) .NET Framework version 1.0.3705
+// Copyright (C) Microsoft Corporation 2001. All rights reserved.
+//
+// > Test.exe
+//
+// Unhandled Exception: System.ArrayTypeMismatchException: Attempted to 
+// store an element of the incorrect type into the array.
+//   at Test.Main()