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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 13 May 2005 04:33:14 -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 matthew@zeroc.com.

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

--- shadow/74932	2005-05-13 04:33:14.000000000 -0400
+++ shadow/74932.tmp.13788	2005-05-13 04:33:14.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 74932
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: Mac OS 10.4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: JIT
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: matthew@zeroc.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Cast succeeds under MacOS 10.4 when it should succeed.
+
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+
+Ice C# test fails (test/Ice/slicing/objects).
+
+The test attempts to verify that the object is of the correct type after an RPC call. The object 
+should be of type B (ie: sliced), not of type D3. The test fails under Mac OS 10.4, but succeeds 
+under Windows and Linux with Mono (and the MS .NET runtime).
+
+The code in question is as follows:
+
+                try
+                {
+                    Console.Out.WriteLine(b2.GetType().Name);
+                    D3 p3 = (D3) b2;
+                    Console.Out.WriteLine(p3.GetType().Name);
+                    D3 tmp = p3; p3 = tmp; // Suppress compiler warning.
+                }
+                catch(InvalidCastException)
+                {
+                    gotException = true;
+                }
+                test(gotException);
+
+The object b2 is of type B, as verified by the GetType() invocation. The cast should therefore fail 
+since D3 is more-derived. However, the cast succeeds. Then a print of P3 type also gives "B". 
+This is clearly wrong.
+
+I verified that in general the InvalidCastException does work under Mac OS 10.4 and it does. I 
+also tried to reproduce this problem in a smaller example, but in this case it worked.
+
+Steps to reproduce the problem:
+1. Download Ice C# source distribution under mac os, and compile.
+2. cd test/Ice/slicing/objects.
+3. ./run.py
+
+Actual Results:
+
+failure!
+
+Expected Results:
+
+success!
+
+How often does this happen? 
+
+Every time.
+
+Additional Information: