DataGrid: Collection was modified; enumeration operation may not execute.

If we bind blazor DataGrid to an ObservableCollection<>, and then in code delete (or add) multiple items we get the error 'Collection was modified; enumeration operation may not execute.'

Note that we have copied the items to delete (or add), so are not enumerating the ObservableCollection when we perform the operation in code.


Please advise if this is an issue at your end, and if so if there is a workaround.

Many thanks, John



1 Reply

SP Sarveswaran Palani Syncfusion Team June 17, 2022 12:56 PM UTC

Hi John,


Thanks for contacting Syncfusion support


We had checked this scenario by creating a sample using ObservableCollection as DataSource .But we are not able to reproduce the reported error at our end. We are attaching the sample in this ticket.


Kindly download and refer the sample in this ticket. If you are still facing the reported issue, then the following details would be helpful for us to proceed further.


  1. Share us the entire Grid code snippet
  2. Share the screenshot of the issue you are facing.
  3. If possible, reproduce the reported issue in the provided sample
  4. Or share issue reproducible sample


Above request details will be very helpful for us to further validate the reported query at our end and provide solution as easy as possible.


Regards,

Sarveswaran PK


Attachment: ObservableBinding_3e0a64b8.zip

Loader.
Up arrow icon