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 jaybedreamin, Today, 05:56 PM
      0 responses
      2 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X