I recently upgraded my project to use 12.2 dll for my XamDataCharts and now I am getting crashes. Here is the stack trace:
Message :Collection was modified; enumeration operation may not execute.Source :mscorlibStack Trace : at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at Infragistics.FastItemColumn.get_Maximum() at Infragistics.Controls.Charts.LineSeries.RenderFrame(CategoryFrame frame, CategorySeriesView view) at Infragistics.Controls.Charts.CategorySeries.RenderSeriesOverride(Boolean animate) at Infragistics.Controls.Charts.Series.DoRenderSeries(Boolean animate) at Infragistics.Controls.Charts.ContentInfo.DoRefresh() at Infragistics.Controls.Charts.ChartContentManager.DoRefresh()TargetSite :Void ThrowInvalidOperationException(System.ExceptionResource)
If I revert back to 12.1 I do not see this behavior. I am having difficulties digging into this much further. It could be the way I am updating the collections that the newer version is not allowing anymore. Can you help me figure out if this is a bug in the dll or a bug in the way I am using your dll?
HI,
Are you using a foreach statement, if so try usng a for loop instead.
Sincerely, Matt
Developer Support Engineer
A foreach statement during what operation exactly? Every second I get a list of values and each one needs to be added to a different series collection. I use a foreach to loop through the list of incoming values. Inside that foreach I find the observablecollection I need to add the value to and then I use a dispatcher to add the value to the collection on the UI thread. I am not using a foreach to touch the underlying observablecollection that is bound to the series though.
Here a link that may help you resolve your issue.
http://stackoverflow.com/questions/5497476/collection-was-modified-enumeration-operation-may-not-execute-collection-elem
Please let me know if you need further assistance regarding this issue.
Sincerely,
Matt Developer Support Engineer
Can you provide a small isolated sample that replicates this issue?
Matt
Yes, I understand what causes the "Collection was modified; enumeration operation may not execute" error but what I am saying is that I never use a foreach on the databound collection itself. However, to prove a point I replaced the foreach loop I do use with a for loop and with 12.2 I still get a crash with the same exception and with 12.1 I do not.