Skip to content

Commit 326e64c

Browse files
committed
Bug Fix: Ensure ClearItems() isn't modifying the enumerated collection
The `ClearItems()` method was throwing an exception because it was attempting to modify the `Items` collection while iterating over it (abfe213). Easily fixed with a `ToList()`.
1 parent fa113c3 commit 326e64c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic/Collections/Specialized/TrackedRecordCollection{TItem,TValue,TAttribute}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ protected override void RemoveItem(int index) {
632632
/// attributes to be handled individually.
633633
/// </remarks>
634634
protected override void ClearItems() {
635-
foreach (var item in Items) {
635+
foreach (var item in Items.ToList()) {
636636
Remove(item);
637637
}
638638
base.ClearItems();

0 commit comments

Comments
 (0)