I seem to be getting a random InvalidOperationException in RenderDeviceDirectX.cs on line 11000 foreach (DrawDataDirectX dd in listDD) with the message "Collection was modified; enumeration operation may not execute"
I am also getting a random ArgumentException in the same method only a few lines down in the Array.Copy method.
I'm thinking it's a threading issue. I have 3 graphs that I'm updated simultaneously. I was originally calling BeginUpdate on all 3, making changes to all 3 and then calling EndUpdate on all three. I then saw in the examples where you would update multiple graphs sequentially instead. So I did that and the issue is still occurring. Is this something that you have seen before?
InvalidOperationException
Moderator: Queue Moderators
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: InvalidOperationException
"Collection was modified" is a very typical error when using background threads and you forget to use Dispatcher.Invoke when updating the chart from the thread. The thread's code changes a series list or other collection while chart is rendering itself. Please make sure you are using Dispatcher.Invoke correctly.
LightningChart Support Team, PT
-
- Posts: 28
- Joined: Tue Sep 30, 2014 8:06 pm
Re: InvalidOperationException
I reviewed my code and found that I'm using Dispatcher.Invoke the same way it is used in the example ExampleThreadMultiChannel.xaml.cs. I'm thinking I might be doing too much inside the refreshCharts method.