https://bugzilla.novell.com/show_bug.cgi?id=440819


           Summary: Array generic interfaces are not type-safe
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: generics
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


The following code snippet exhibits unsafe behaviour in the implementation of
array generic interfaces.

----------8<---------
using System;
using System.Collections.Generic;

class A {
  static void Main ()
  {
    A [] aa = new A [1];
    IList<object> io = aa;
    io [0] = new object ();
    A a = aa [0];
    Console.WriteLine ("{0}", a.GetType ());
  }
}
----------8<---------

When compiled and run on mono, this emits the following

  $ ./mono-2.0 array-bad.exe 
  System.Object

The expected behaviour is to throw a ArrayTypeMismatchException.  (caveat: I
haven't actually tested it on .NET, the actual exception thrown may be
different)


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to