[Mono-bugs] [Bug 561970] Exception "collection was modified" in a ReadOnlyCollection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 19 15:31:09 EDT 2010



Rodrigo Kumpera <rkumpera at novell.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |NEEDINFO
       InfoProvider|                            |knocte at gmail.com

--- Comment #5 from Rodrigo Kumpera <rkumpera at novell.com> 2010-04-19 19:31:09 UTC ---
Then the collection is not read-only, only it's wrapper is.

Take the following example:

var l = new List<int> ();
l.Add (1); l.Add (2);
var ro = l.AsReadOnly ();
foreach (var r in ro)
  l.Add (r);

It is iterating over a read-only collection but it will raise IOE.
This is the expected behavior.

The stack trace suggests this is the case.

Configure bugmail: http://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