Bug in ApplyEdit
Old forum URL: forums.lhotka.net/forums/t/6682.aspx
jureleskovec posted on Thursday, March 26, 2009
The following will produce an exception ('Edit level mismatch in AcceptChanges'):
- Create an editable business list.
- Add an item to it.
- Call 'list.BeginEdit()'.
- Remove the item from the list.
- Add it back (THE SAME ONE).
- Call the 'list.ApplyEdit()'. <-- CRASH
I traced the problem into the ApplyEdit method and found out that after the item had been added back to the collection it was still in the list of deleted items. Therefore, the ApplyEdit was called twice on the item.
-- Jure
RockfordLhotka replied on Thursday, March 26, 2009
This is not a supported scenario. BLB doesn't allow you to delete an item and then add that same item to the list. If you want to do that, you'll need to "undelete" the item. Normally you'd do this by calling CancelEdit() on the list, to undo the delete.Copyright (c) Marimer LLC