[Mono-bugs] [Bug 43207][Wis] New - ArrayTypeMismatchException not thrown for ref or out parameters

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 17 May 2003 11:17:08 -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=43207

--- shadow/43207	Sat May 17 11:17:08 2003
+++ shadow/43207.tmp.27287	Sat May 17 11:17:08 2003
@@ -0,0 +1,51 @@
+Bug#: 43207
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: staerk@inf.ethz.ch               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ArrayTypeMismatchException not thrown for ref or out parameters
+
+The following program shoud throw an ArrayTypeMismatchException
+at run-time. It does not in Mono-024.
+
+See 14.4.1 "Argument lists" in the Ecma C# standard.
+
+
+using System;
+
+class Test {
+  static void F(out object o) {
+    o = new object();
+  }
+
+  public static void Main() {
+    string[] a = { "hello", "world" };
+    object[] b = a;
+    // At run-time: ArrayTypeMismatchException
+    F(out b[1]); 
+    Console.WriteLine(a[1].Length);
+  }
+}
+
+/* Output (Microsoft CLR):
+> Test.exe
+Unhandled Exception: System.ArrayTypeMismatchException: 
+ Attempted to store an el ement of the incorrect type into the array.
+   at Test.Main()
+*/
+
+/* Output (Mono 0.24, Windows XP):
+> mono Test.exe
+0
+*/