Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=78954 --- shadow/78954 2006-07-26 11:01:50.000000000 -0400 +++ shadow/78954.tmp.29474 2006-07-26 11:01:50.000000000 -0400 @@ -0,0 +1,50 @@ +Bug#: 78954 +Product: Mono: Runtime +Version: 1.1 +OS: All +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: misc +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Removing from List<T> during enumeration should fail + +Below is a simple program which enumerates through a List<int> and +removes each object. This completes without exception on Mono, but +MS.Net 2.0 throws an exception: + +Unhandled Exception: System.InvalidOperationException: Collection was +modified; +enumeration operation may not execute. + at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource +resour +ce) + at System.Collections.Generic.List`1.Enumerator.MoveNext() + at T.Main() + +I think Mono's behavior should be consistent with this. Here is the +sample program: + +using System.Collections.Generic; + +public class T +{ + public static void Main () + { + List<int> list = new List<int> (); + + list.Add (0); + list.Add (1); + list.Add (2); + + foreach ( int ii in list ) + list.Remove (ii); + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
