Announcement

Collapse
No announcement yet.

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.
    https://drive.google.com/file/d/1B_P...w?usp=drivesdk

    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 aeadon, Today, 02:27 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by op1031, Today, 01:52 AM
      0 responses
      1 view
      0 likes
      Last Post op1031
      by op1031
       
      Started by Aramunno, Yesterday, 10:11 PM
      2 responses
      16 views
      0 likes
      Last Post Aramunno  
      Started by sdauteuil, Yesterday, 09:38 PM
      0 responses
      5 views
      0 likes
      Last Post sdauteuil  
      Started by fscabrera03, Yesterday, 09:23 PM
      0 responses
      11 views
      0 likes
      Last Post fscabrera03  
      Working...
      X