Bugzilla – Bug 321622
Runtime crashes when working with an array cast to ICollection<>
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by ladislav.prosek@matfyz.cz 2006-07-20 07:24:24 MST ---- Description of Problem: There seems to be a problem related to array covariance and their support of the ICollection<> interface. Steps to reproduce the problem: class A { } class B : A { } class Program { static void Main(string[] args) { B[] array = new B[0]; ICollection<A> collection = array; IEnumerator<A> enumerator = collection.GetEnumerator(); } } Actual Results: System.NullReferenceException is thrown inside GetEnumerator. Sometimes similar setups yield even this: ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= Expected Results: It should work. As it does in CLR. How often does this happen? Always. ---- Additional Comments From vargaz@gmail.com 2006-08-15 15:54:44 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO78847 *** ---- Additional Comments From martin@ximian.com 2006-09-01 13:49:07 MST ---- This is handled in gtest-284.cs Unknown operating system unknown. Setting to default OS "Other". This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"