Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

8.0.10 crashing using DispatcherTImer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    8.0.10 crashing using DispatcherTImer

    Hi,
    the attached script is crashing NT8 from an unhandled exception, despite the script doing almost nothing and it setting up the timer the same wayas the BarTimer indicator does it.

    Various information appears in the trace file, it can be different things each time really, but this one is pretty consistent. It can appear after a few successful timer ticks have occurred.

    2017-12-04 10:32:57:089 *************** unhandled exception trapped ***************
    2017-12-04 10:32:57:089 Object reference not set to an instance of an object.
    2017-12-04 10:32:57:093 System.NullReferenceException: Object reference not set to an instance of an object.
    at MS.Internal.TextFormatting.TextMetrics.FullTextLin e.DrawTextLine(DrawingContext drawingContext, Point origin, MatrixTransform antiInversion)
    at MS.Internal.TextFormatting.TextMetrics.FullTextLin e.Draw(DrawingContext drawingContext, Point origin, InvertAxes inversion)
    at ActiproSoftware.Windows.Controls.SyntaxEditor.Text Formatting.TextViewLineLayout.#p3b.#2hc(ITextView #N5b, Rect #adc)
    at ActiproSoftware.Windows.Controls.SyntaxEditor.Text Formatting.TextViewLineLayout.#2hc(ITextView #N5b, Rect #adc)
    at ActiproSoftware.Windows.Controls.SyntaxEditor.Prim itives.EditorView.RenderLines()
    at ActiproSoftware.Windows.Controls.SyntaxEditor.Prim itives.EditorView.PerformViewLineLayout()
    at ActiproSoftware.Windows.Controls.SyntaxEditor.Prim itives.EditorView.ArrangeOverride(Size finalSize)
    at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
    at System.Windows.UIElement.Arrange(Rect finalRect)
    at System.Windows.ContextLayoutManager.UpdateLayout()
    at System.Windows.ContextLayoutManager.UpdateLayoutCa llback(Object arg)
    at System.Windows.Media.MediaContext.FireInvokeOnRend erCallbacks()
    at System.Windows.Media.MediaContext.RenderMessageHan dlerCore(Object resizedCompositionTarget)
    at System.Windows.Media.MediaContext.RenderMessageHan dler(Object resizedCompositionTarget)
    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)

    You can see in the code that no actions are being attempted on time tick; I've removed all that trying to get the damn thing running.

    What's going on?

    Thanks,
    saltminer
    Attached Files

    #2
    Hello saltminer,

    I've tested the script but I was not able to reproduce an error.

    Below is a link to a video of the test.


    May I confirm I have tested correctly?

    Are you trying to add a new timer everytime the connection status changes?

    (It appears that the handle is attempted to be added to the timer object multiple times as there is no check to see if the timer variable references a null object the way the BarTimer script included with NinjaTrader does)

    The timer in your script is enabled before the Interval is set. The BarTimer indicator sets the Interval as the DispatcherTimer is constructed and then is enabled after this is set.

    The code in the BarTimer indicator does not use timer.Start();, however, this is in your code.
    Instead, the timer is started in the BarTimer example with timer.IsEnabled = true;

    Your script also has other code in it.
    What line is the specific line causing the error? (As, when commented, this one line no longer causes an error, and when uncommented causes an error)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,
      thank you very much for examining this issue, and your notes are excellent.

      I got a similar crashing problem immediately afterwards with an unrelated strategy, so I began to smell a rat. I did a clean removal and reinstall of NT8 application and data folder, and the problem has gone away.

      Thanks again,
      saltminer

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by FrancisMorro, Today, 03:24 AM
      0 responses
      1 view
      0 likes
      Last Post FrancisMorro  
      Started by Segwin, 05-07-2018, 02:15 PM
      10 responses
      1,769 views
      0 likes
      Last Post Leafcutter  
      Started by Rapine Heihei, 04-23-2024, 07:51 PM
      2 responses
      30 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by Shansen, 08-30-2019, 10:18 PM
      24 responses
      943 views
      0 likes
      Last Post spwizard  
      Started by Max238, Today, 01:28 AM
      0 responses
      10 views
      0 likes
      Last Post Max238
      by Max238
       
      Working...
      X