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 Kaledus, Today, 01:29 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by frankthearm, Yesterday, 09:08 AM
        13 responses
        45 views
        0 likes
        Last Post frankthearm  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        16 views
        0 likes
        Last Post PaulMohn  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        2 responses
        55 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Started by yertle, Yesterday, 08:38 AM
        8 responses
        37 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Working...
        X