This is a migrated thread and some comments may be shown as answers.

LoadLayout throws error Collection was modified; enumeration operation may not execute

1 Answer 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
IT Department
Top achievements
Rank 1
IT Department asked on 16 May 2011, 08:03 PM
The LoadLayout method of the RadGridView will sometimes throw an error "Collection was modified; enumeration operation may not execute." We have found that this happens after the following sequence of events:

1. Define one or more filters in the grid.
2. Use SaveLayout to save the layout definition, which includes the filters.
3. Use LoadLayout to load the layout that includes filters.
2. Use LoadLayout to load a different layout that includes no filters.

Apparently some internal code is iterating through the filter descriptors and attempting to delete them within the iteration. The workaround that we found is to first execute a .Columns.Clear() to remove all of the existing columns. Since they are all going to be replaced by the new layout this produces the same end result, minus the error.

We believe that this problem was introduced sometime between 2010Q1 and 2011Q1. Upgrading from 2010Q1 to 2011Q1 has been one of the most frustrating and time consuming version changes that I have ever experienced. There are a lot of new features and a lot of fixes, but it seems that little thought was given to backward compatibility.

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 19 May 2011, 11:54 AM
Hello Grant Fish,

Thank you for contacting us.

I tested the described scenario and was not able to observe an issue. Please, could you send me your application. This will allow me to investigate the issue further and to find a proper solution. Thank you in advance.

I am looking forward to your reply.
 
Best wishes,
Jack
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
IT Department
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or