[Mono-bugs] [Bug 350432] New: AE when making an ArrayList from a ReadOnlyCollection<>

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 21 15:14:49 EST 2007


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


           Summary: AE when making an ArrayList from a ReadOnlyCollection<>
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: jpobst at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


The following code runs on MS, but throws an ArgumentException on Mono.

using System;
using System.Collections.Generic;
using System.Collections;

public class MainForm
{
        static void Main ()
        {
                List<String> myarray = new List<string> ();
                ArrayList a = new ArrayList (myarray.AsReadOnly ());
        }
}

Stacktrace:

Unhandled Exception: System.ArgumentException: array
  at
System.Collections.ObjectModel.ReadOnlyCollection`1[System.String].System.Collections.ICollection.CopyTo
(System.Array , Int32 ) [0x00025] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System.Collections.ObjectModel\ReadOnlyCollection.cs:133 
  at System.Collections.ArrayList.InsertRange (Int32 index, ICollection c)
[0x000d1] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System.Collections\ArrayList.cs:2982 
  at System.Collections.ArrayList.AddRange (ICollection c) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System.Collections\ArrayList.cs:3081 
  at System.Collections.ArrayList..ctor (ICollection c) [0x00047] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System.Collections\ArrayList.cs:2560 
  at MainForm.Main () [0x00000] 

This seems to be a common pattern used by some of the ApplicationServices
classes for VB.Net apps.


-- 
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.


More information about the mono-bugs mailing list