[Mono-bugs] [Bug 69268][Wis] New - generic types cannot be casted to normal objects.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 9 Nov 2004 05:03:29 -0500 (EST)
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 tsureshkumar@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=69268
--- shadow/69268 2004-11-09 05:03:29.000000000 -0500
+++ shadow/69268.tmp.26783 2004-11-09 05:03:29.000000000 -0500
@@ -0,0 +1,100 @@
+Bug#: 69268
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: tsureshkumar@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: generic types cannot be casted to normal objects.
+
+Description of Problem:
+casting from generic to non generic types accross assembly boundaries does
+not seem to be working.
+
+
+Steps to reproduce the problem:
+1. compile the tt1.cs program
+ gmcs -t:library -debug tt1.cs
+
+2. compile the tt2.cs program
+ gmcs -r:tt1.dll -debug tt2.cs
+3. run the program
+
+ mono --debug tt2.exe
+
+Actual Results:
+
+Unhandled Exception: System.InvalidCastException: Cannot cast from source
+type to destination type.
+in [0x00000] (at /data/cvs/monohead/mcs/class/System.Data/Test/tt1.cs:18)
+foo.test:TestMe (object)
+in [0x00014] (at /data/cvs/monohead/mcs/class/System.Data/Test/tt2.cs:15)
+foo.MainClass:Main (string[])
+
+
+Expected Results:
+shoud run without any errors.
+
+How often does this happen?
+always
+
+Additional Information:
+
+test programs :
+
+// tt1.cs
+using System;
+using System.Collections.Generic;
+
+
+namespace foo {
+ public class Me<K>
+ {
+ }
+
+
+ public class test
+ {
+ public void Test (Array arr)
+ {
+ Me <int> [] bx = (Me <int> []) arr;
+ }
+
+
+ public void TestMe (object o)
+ {
+ Me <int> abcd = (Me <int>) o;
+ }
+ }
+}
+
+
+// tt2.cs
+using System;
+using System.Collections.Generic;
+
+
+using foo;
+
+
+namespace foo {
+ class MainClass
+ {
+ public static void Main (string [] args)
+ {
+ test t = new test ();
+ Me <int> [] ax = new Me <int> [10];
+ t.TestMe ((object) new Me <int> ());
+ t.Test ((Array) ax);
+ }
+ }
+}