04-22-2025 05:44 AM
Hi everyone!
I have been struggling with an issue with the NationalInstruments library in my C# application, specifically when I am undocking one of those channels in my app in a new window, from the main window of the app, as shown in the picture, I have two ni:IntensityGraph, with ni in xaml being: xmlns:ni="http://schemas.ni.com/controls/2009/xaml/presentation". The issue is, when clicking on any of the axis limits, the system throws an exception with the message: "Object reference is not set to an instance of an object.", with the stacktrace:
at NationalInstruments.Controls.Internal.ScaleLabeledDivisionsPresenter`1.b(EditorPosition A_0)
at NationalInstruments.Controls.Internal.ScaleLabeledDivisionsPresenter`1.a(Object A_0, MouseButtonEventArgs A_1)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
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.InputManager.ProcessInput(InputEventArgs input)
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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
So, at NationalInstruments.Controls.Internal.ScaleLabeledDivisionsPresenter`1.b(EditorPosition A_0), it seems to be crashing. I have tried everything so far, even creating a new V+VM instance, cloning the properties rather than parsing the existing ones, with no luck. Has anyone encountered this issue? If so, what was the cause and the solution?
Thanks!
05-12-2025 10:29 AM
That sounds like an issue with the text control that allows you to interactively edit the minimum/maximum on a scale. On the horizontal and vertical axes for your intensity graph, you might want to examine the EditRangeValueFormatter
on your MajorDivisions
, or set the axis to InteractionMode="None"
to disable interactive editing.