a strategy has been upgraded with additional features, which has changed the public Properties for the user to adjust. So far so good.
But when a strategy templates saved from the old version is attempted to be loaded, a null object exception occurs. Example (from the trace file):
2024-01-26 08:31:54:485 *************** unhandled exception trapped ***************
2024-01-26 08:31:54:485 Object reference not set to an instance of an object.
2024-01-26 08:31:54:498 System.NullReferenceException: Object reference not set to an instance of an object.
at NinjaTrader.NinjaScript.Parameter.CopyTo(Parameter parameter)
at NinjaTrader.NinjaScript.Parameter.Clone()
at NinjaTrader.NinjaScript.StrategyBase.CopyTo(NinjaS cript ninjaScript)
at NinjaTrader.Gui.NinjaScript.StrategyRenderBase.Cop yTo(NinjaScript ninjaScript)
at NinjaTrader.Gui.Tools.StrategyTemplateSlideout.OnT emplateLoad(Object sender, RoutedEventArgs e)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
at NinjaTrader.Gui.Tools.PresetSlideout.<OnRestoreCli ck>b__38_0()
at System.Windows.Threading.DispatcherOperation.Invok eDelegateCore()
at System.Windows.Threading.DispatcherOperation.Invok eImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatch Info.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.Handle NonSuccessAndDebuggerNotification(Task task)
at System.Windows.Threading.DispatcherOperation.Wait( TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(Dis patcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority)
at NinjaTrader.Gui.Tools.PresetSlideout.OnRestoreClic k(Object sender, RoutedEventArgs e)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
at System.Windows.Controls.Primitives.ButtonBase.OnCl ick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMo useLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(Dependency Object sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedE ventArgs args)
at System.Windows.Input.InputManager.ProcessStagingAr ea()
at System.Windows.Input.InputManager.ProcessInput(Inp utEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput (InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.Repo rtInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.Filt erMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessa ge(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.Internal RealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatch When(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Do you have any ideas why this would be happening?
Thanks,
saltminer
Comment