[Mono-bugs] [Bug 81044][Nor] New - Missing exception from invalid cast.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Mar 5 18:54:19 EST 2007


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 miguel at ximian.com.

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

--- shadow/81044	2007-03-05 18:54:19.000000000 -0500
+++ shadow/81044.tmp.2603	2007-03-05 18:54:19.000000000 -0500
@@ -0,0 +1,35 @@
+Bug#: 81044
+Product: Mono: Runtime
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: JIT
+AssignedTo: lupus at ximian.com                            
+ReportedBy: miguel at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Missing exception from invalid cast.
+
+The following code should thrown an InvalidCastException at runtime, but
+does not with Mono:
+
+using System.Collections.Generic;
+
+class CantCastGenericListToArray
+{
+	public static void Main(string[] args)
+	{
+		IList<object> list = new object[] { "foo", "bar" };
+		string[] array = (string[])list;
+		if (list.Count != array.Length)
+		{
+			throw new System.ApplicationException();
+		}
+	}
+}


More information about the mono-bugs mailing list