StairStepSeries NullReferenceException

Oct 8, 2013 at 12:02 PM
If I use StairStepSeries without points and I click to the Plot, then I get a NullReferenceException.
If I use LineSeries, everything is OK. I think this code should be repaired:
            // snap to the nearest point
            var result = this.GetNearestPointInternal(this.Points, point);
            if (!interpolate && result.Position.DistanceToSquared(point) < minimumDistanceSquared)
            {
                return result;
            }
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at OxyPlot.Series.StairStepSeries.GetNearestPoint(ScreenPoint point, Boolean interpolate) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\StairStepSeries.cs:line 122
   at OxyPlot.Series.Series.HitTest(ScreenPoint point, Double tolerance) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\Series.cs:line 122
   at OxyPlot.PlotModel.HandleMouseDown(Object sender, OxyMouseEventArgs e) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\PlotModel\PlotModel.MouseEvents.cs:line 82
   at OxyPlot.Wpf.Plot.OnMouseDown(MouseButtonEventArgs e) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 924
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at XamlGeneratedNamespace.GeneratedApplication.Main() in c:\xxxx\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Coordinator
Oct 8, 2013 at 1:22 PM
thanks, fixed!