New Posts New Posts RSS Feed: Collection was modified; enumeration operation may not execute
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Collection was modified; enumeration operation may not execute

 Post Reply Post Reply
Author
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Topic: Collection was modified; enumeration operation may not execute
    Posted: 12-Jul-2007 at 12:33pm

You need to use "IterIsolate".  While you are iterating throught a collection, you may not modify it.  I ran into the same problem a year ago when I did the tutorial on Audit Trails.  I had a ColumnPropertyChanged Event Handler that fired while entities were being saved.  This event handler created new entities while the current set of inserted, deleted, or modified entities were being saved, thus modifying the list of saved entities.

Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2007 at 12:33pm

Sorry to bother you, but I have not been successful at deleting a collection of entities, I have tried variation of the following two, but all cases I get the same error. What am I doing wrong?

System.InvalidOperationException was unhandled

Message="Collection was modified; enumeration operation may not execute." 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down