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.
    JesseNinjaTrader Customer Service

    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 cmtjoancolmenero, Yesterday, 03:58 PM
        10 responses
        36 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        24 views
        0 likes
        Last Post DayTradingDEMON  
        Started by geddyisodin, Yesterday, 05:20 AM
        9 responses
        50 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by George21, Today, 10:07 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Stanfillirenfro, Today, 07:23 AM
        9 responses
        24 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X