[Mono-bugs] [Bug 74932][Wis] Changed - Cast fails under MacOS 10.4 when it should succeed.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 13 16:44:21 EDT 2005


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 michi at zeroc.com.

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

--- shadow/74932	2005-05-13 04:54:17.000000000 -0400
+++ shadow/74932.tmp.18227	2005-05-13 16:44:21.000000000 -0400
@@ -65,6 +65,35 @@
 Every time.
 
 Additional Information:
 
 ------- Additional Comments From duncan at ximian.com  2005-05-13 04:54 -------
 Let's change the summary to make it make more sense ;-)
+
+------- Additional Comments From michi at zeroc.com  2005-05-13 16:44 -------
+Here is some more background.
+
+The type system looks like this:
+
+class B { /* ... */ }
+
+class D3 : B { /* ... */ }
+
+B b2 = new B(); // Via some chain of function calls
+try
+{
+    Console.Out.WriteLine(b2.GetType().Name);
+    D3 p3 = (D3) b2;
+    Console.Out.WriteLine(p3.GetType().Name);
+}
+
+Because b2 is of type B, the cast in the assignment to p3 is expected 
+to fail. It does under .NET, and with Mono on every platfom we've 
+tried, except that, on Mac OS X, the assignment succeeds without 
+throwing an InvalidCastException. In other words, the above code 
+snippet prints
+
+B
+B
+
+This should be impossible because the second WriteLine should never 
+be reached.


More information about the mono-bugs mailing list