• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

    http://ninjatrader.com/support/helpG...ub=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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by lunardiplomacy, Today, 08:09 AM
        0 responses
        3 views
        0 likes
        Last Post lunardiplomacy  
        Started by YevhenShynkarenko, Yesterday, 06:07 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by akuntysh, 07-23-2019, 09:41 PM
        4 responses
        31 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Goolden, Today, 05:47 AM
        2 responses
        15 views
        0 likes
        Last Post Goolden
        by Goolden
         
        Started by mestril, Today, 06:00 AM
        7 responses
        24 views
        0 likes
        Last Post mestril
        by mestril
         
        Working...
        X