Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dispatcher.Invoke call now fails in 8.0.0.9

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

    Dispatcher.Invoke call now fails in 8.0.0.9

    I have code that has been working for months in NT 8. It is in OnStateChange==Historical.
    It calls 'Dispatcher.Invoke' to load a custom menu onto the Chart Window.
    Now, when Dispatcher.Invoke is called, the chart appears to be forever loading, Ninja locks up and has to be killed. No matter how long I wait.

    This issue is repeatable using the attached test indicator.
    The indicator has a boolean parameter to turn the offending code on.
    I also attached a recent trace file that verifies the ninja version.

    I have been using 8.0.0.9 for a week or 2 but this problem only recently showed up.
    I know the forced update was for a new certificate which seems far fetched to cause an issue, but something sure is different and broken.

    If any coding rules have changed regarding when Dispatcher.Invoke can be called or from where, please advise.

    Thanks,
    Gary
    Attached Files

    #2
    Hello,

    Thank you for the question.

    Due to changes with the last beta you are likely hitting a deadlock scenario using Invoke rather than BeginInvoke.



    If you change the Invoke to BeginInvoke it should resume working as it was before.

    I look forward to being of further assistance.

    Comment


      #3
      Thanks, problem solved

      Comment


        #4
        Use Dispatcher.InvokeAsync() instead.
        It's very quick to add "Async" to the name, and the problem is solved

        As a best practice, you should always make sure to use Dispatcher.InvokeAsync() to ensure your action is done asynchronously to any internal NinjaTrader actions. Calling the synchronous Dispatcher.Invoke() method can potentially result in a deadlock scenarios as your script is loaded.
        Ref: http://ninjatrader.com/support/helpG...-threading.htm
        ninZa
        NinjaTrader Ecosystem Vendor - ninZa.co

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        672 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X