Strange error

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

Gala wrote at 2014-06-06 16:17:

Hi! Thank you for oxyPlot, it's really amazing))
Im working with real time data and sometimes get strange error:
System.NullReferenceException: in OxyPlot.Annotations.Annotation.Transform(DataPoint p) в c:\TeamCity\buildAgent\work\3b9fcf1ba397d0ed\Source\OxyPlot\Annotations\Annotation.cs: 115
I'm using arrow anotations and check everything before adding it to the plot view.

objo wrote at 2014-06-06 20:51:

This looks like a problem with the x-axis.
Are you adding the arrow annotation to a plot without axes/series? What platform are you on? Can you add some code that reproduces the error?

Gala wrote at 2014-06-06 21:21:

I'm using wpf. There are dateTime and value axeses in my model (dateTimeAxis as x-axis), and there are couple line series too) Here is the code the annotation adding:
   var arrow = new ArrowAnnotation();
   arrow .Text = info;
   arrow .StartPoint =  new DataPoint(DateTimeAxis.ToDouble(currentTime), value- value/ 100000);
   arrow .EndPoint =  new DataPoint(DateTimeAxis.ToDouble(currentTime),value);

objo wrote at 2014-06-06 21:51:

Can this be a race condition? Can you try locking the PlotModel.SyncRoot when changing the model?

Gala wrote at 2014-06-09 17:28:

Thank you! It solve my problem.