Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ensuring proper usage of InvokeAsync

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

    ensuring proper usage of InvokeAsync

    Is there a proper way of unloading/killing a thread that was called on by using dispatcher -> InvokeAsync?
    Is this something that needs to be done manually or is it already built into .Net?
    Even if it could be done manually, is it considered bad practice to do so?

    I've been getting a lot of "file is already in use by another process" type of errors for the past few releases, so I want to clean up my code to make sure its not the culprit.

    #2
    Hello gubbar924,

    When you invoke into a thread, you would not want to kill the thread you have invoked into.

    For example if you invoke into the main menu and then kill the thread of the main menu that would kill the NinjaTrader UI.

    But to answer this, no, when the method is finished it will return and the invoke will be completed.

    Are you able to reproduce this behavior without using any indicators in your workspace (and with no other workspaces open)?

    Are you able to reproduce this using any of the example indicators on the forums that use Dispatcher.InvokeAsync?

    I'm posting links to a few below.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Chelsea, I just wanted to make sure I wasn't missing anything when it came to invoking. Outside of this question, I have already been working with Patrick on the issue pertaining to the "file already in use by another process" error, I'll follow up with him so just to keep it clean.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by usazencort, Today, 01:16 AM
      0 responses
      1 view
      0 likes
      Last Post usazencort  
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      603 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by xiinteractive, 04-09-2024, 08:08 AM
      6 responses
      22 views
      0 likes
      Last Post xiinteractive  
      Started by Pattontje, Yesterday, 02:10 PM
      2 responses
      21 views
      0 likes
      Last Post Pattontje  
      Started by flybuzz, 04-21-2024, 04:07 PM
      17 responses
      230 views
      0 likes
      Last Post TradingLoss  
      Working...
      X