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 Mindset, Today, 06:46 AM
        0 responses
        12 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, Yesterday, 05:21 PM
        0 responses
        18 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        16 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        82 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        50 views
        0 likes
        Last Post PaulMohn  
        Working...
        X