WPFOxyPlot crash on DataPointSeries addPoint

Oystein Bjorke 5 years ago 0
This discussion was imported from CodePlex

prclot wrote at 2011-10-25 18:52:

When using a thread to update the pointseries and a dispatcher to redraw the plot the System systematically crashes after few iterations.

 

in the  thread worker

public void Worker()

{

wile(true)

 {

  double x = counter * 0.1;                           

pointList.Add(new DataPoint(x, Math.Cos(100 * x * Math.PI / 180)));                           

counter++;

  object retVal = Dispatcher.BeginInvoke(new ThreadStart(() => Update()), DispatcherPriority.Normal, null);

Thread.Sleep(10);

}

}

 

private void Update()

{

  oxyPlot.RefreshPlot(true);

 

 

Any Suggestion?

 

Thanks to anybody


objo wrote at 2011-10-25 20:57:

did you try a lock on your plot model when you modify the points and when you refresh the plot?


prclot wrote at 2011-10-25 21:47:

Yes,

i have already did that. 

A lock in the update method and a lock in the worker

Same error in :

DataPointSeries.cs 

Line 319 

   foreach (var o in itemsSource)               

InvalidOperationException : the enumerator has been reset

 

Thx

CodePlex