[Mono-dev] Casting bug with generic collections
michi at zeroc.com
Mon Sep 24 04:54:50 EDT 2007
I would have put this into bugzilla, but it wouldn't let me, so I'm
reporting it here...
The code below compiles and runs fine with VS 2005 and prints "a".
With Mono 1.2.4, I get a cast exception:
Unhandled Exception: System.InvalidCastException: Cannot cast from
source type to destination type.
(System.Array , Int32 ) [0x00000]
Here is the code:
System.Collections.Generic.Dictionary<string, string> d =
new System.Collections.Generic.Dictionary<string, string>();
d["a"] = "b";
System.Collections.ICollection keys = d.Keys;
object keyArray = new object[d.Count];
More information about the Mono-devel-list