• 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

Using Visual Studio

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

    Using Visual Studio

    Hello,
    I'm attempting to analyze my code through Visual Studio. I'm able to set up break points. I refreshed my chart that contains my indicator but I'm not able to step through the code. What might be the issue?

    #2
    Hello CaptainAmericaXX,

    Thanks for your post.

    Are you ensuring that you are enabling debug mode and recompiling in the NinjaScript Editor before starting your debugging session in Visual Studio and attaching to NinjaTrader?

    Visual Studio Debugging information can be found here - https://ninjatrader.com/support/help..._debugging.htm

    We look forward to being of further assistance.
    Last edited by NinjaTrader_Jim; 05-17-2019, 08:24 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello Jim,
      Yes, I followed the documentation. I can set the breakpoints, but I can't step through the code. The button for those options are grayed out and neither F10 nor F11 will work.

      Comment


        #4
        Hello CaptainAmericaXX,

        I have attached a demo video showing how I have attached the Visual Studio Debugger so you can take the same steps I have.

        Demo - https://drive.google.com/file/d/13q_...w?usp=drivesdk

        Please let me know if you are having any issues with these steps.
        JimNinjaTrader Customer Service

        Comment


          #5
          Jim,
          Thank you so much for creating this video for me! I'm sure it will be helpful to others as well.
          Your video showed a step that isn't in the NT7 documentation. The selecting NinjaTrader\bin\Custom\NinjaTrader.Custom is missing from the documentation. That said, when I followed your video the closest file I have to NinjaTrader.Custom is NinjaTrader.Custom.csproj. I selected that one as it looks closest to your example and I got an error when Visual Studio opened: The referenced project '..\NinjaTrader.Core\NinjaTrader.Core.csproj' does not exist. I also could not find my custom indicators from the Solution Explorer list. I selected ADL as you did just to be consistent. After opening I got 42 errors. I assume this is because of the first error I mentioned. After Attaching the process I set a break point and loaded the indicator to the chart, but the breakpoint is still not being hit.

          Comment


            #6
            Hello CaptainAmericaXX,

            May I confirm you are in the folder
            • Documents\NinjaTrader 7\bin\Custom
            and not
            • Program Files (x86)\NinjaTrader 7\bin\

            If the NinjaTrader.Custom.csproj file is missing from the Documents\NinjaTrader 7\bin\Custom folder, then re-install NinjaTrader 7 or run the repair.

            Also, you will need to correct the references to the NinjaTrader.Core.dll and WilsonORMapper.dll.
            http://www.screencast.com/t/eH7y5cedlzh
            https://ninjatrader.com/support/foru...udio#post18793
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello ChelseaB,
              Thank you for responding. Yes I did follow the appropriate file path Documents\NinjaTrader 7\bin\Custom and am using the NinjaTrader.Custom.csprojfile. I corrected the missing references as was suggested. Now I'm not getting all the errors I previously did when I added the indicator to Visual Studio, but I'm still not able to hit a breakpoint once I've attached the process and added the indicator to a chart. What's next?
              Last edited by CaptainAmericaXX; 05-20-2019, 12:26 PM.

              Comment


                #8
                Hello CaptainAmericaXX,

                Thanks for your message.

                Could you try these steps below ensuring they are done in the correct order?
                1. Open project from Documents\NinjaTrader 7\bin\Custom
                2. Correct NinjaTrader.Core.dll and WilsonORMapper.dll references
                3. Ensure script is included in project
                4. Enable debugging mode in NS editor
                5. Attach VS to NT process
                6. Compile NS editor (F5)
                7. Add break point
                8. Run script

                If you are still experiencing issues, I may suspect a setup issue with Visual Studio. I would first try uninstalling and reinstalling Visual Studio to troubleshoot, and to also test if you have issues attaching to NinjaTrader 8 as well.

                Could you take the steps above and provide a screenshot of the output in Visual Studio if issues persist? There may be a useful hint here stating that a PDB file cannot be found or debugging symbols cannot be loaded, etc.

                I look forward to being of further assistance.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Ok so I've finally come back to try this again. I believe that I'm following all the steps and that I'm not a retard. (Sorry to the social justice warriors that might find the word "retard" offensive, but using that word was common in the 80's and well, that's when I was a teen.) I'm still having issues.
                  This time I was able to set a break point, but when I tried to step through I got a pop up that stated, "Evaluating local variables...". Then an error window that said, "'NinjaTrader.Indicator.IndicatorBase.ToString ' timed out and needed to be aborted in an unsafe way. This may have corrupted the target process". Also NT froze. What could be wrong at this point?

                  5 Hours Later
                  After reexamining Jim's suggestions I realized I hadn't uninstalled/reinstalled Visual Studio. I did that and I can actually step into the code! Yay! I'm good now. Thanks for the help!
                  Attached Files
                  Last edited by CaptainAmericaXX; 08-22-2019, 04:53 PM. Reason: After the first post I figured out the issue

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by vpzdcv, Today, 02:31 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post vpzdcv
                  by vpzdcv
                   
                  Started by YevhenShynkarenko, Today, 01:22 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post YevhenShynkarenko  
                  Started by ttodua, Today, 12:52 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post ttodua
                  by ttodua
                   
                  Started by ttodua, Today, 12:50 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post ttodua
                  by ttodua
                   
                  Started by mulshah, Yesterday, 11:12 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post mulshah
                  by mulshah
                   
                  Working...
                  X