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, 09: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.
            Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.

            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, 01: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, 05:53 PM. Reason: After the first post I figured out the issue

                  Comment


                    #10
                    Hello,

                    Just to follow up - few questions:
                    1 - Which is the latest Visual Studio that is supported to be able to debug NT7 project? When trying opening it with Visual Studio 2015 - it suggest to make one way conversion.
                    2 - When debugging - should I open NinjaTrader x86 or x64 bit version?
                    3 - If making references in NinjaScript Editor - should I reference DLLs in bin or bin64 folder?

                    Thanks

                    Comment


                      #11
                      Hello music_p13,

                      Thank you for your note.

                      You should be able to use Visual Studio 2005 or higher. The Express versions of Visual Studio are note supported. Can you please provide a screenshot of the message you receive suggesting a conversion when opening with Visual Studio 2015?
                      • To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
                      • Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.
                      ​When debugging, you may use whichever version of NinjaTrader 7 as long as it is open and you follow the steps to enable debug mode, then compile to create the Debug DLL, then attach Visual Studio to the NinjaTrader.exe process as outlined in the steps from the help guide:


                      Please provide more details for your third question; are you referring to making references via right-click > References? It is typically a best practice to place DLLs in the Documents\NinjaTrader 7\bin\custom folder and then from the NinjaScript Editor you would add the reference to that file path.

                      I look forward to your reply.
                      Emily C.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by TheMarlin801, 10-13-2020, 01:40 AM
                      20 responses
                      3,913 views
                      0 likes
                      Last Post Bidder
                      by Bidder
                       
                      Started by timmbbo, 07-05-2023, 10:21 PM
                      3 responses
                      150 views
                      0 likes
                      Last Post grayfrog  
                      Started by Lumbeezl, 01-11-2022, 06:50 PM
                      30 responses
                      804 views
                      1 like
                      Last Post grayfrog  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      3 responses
                      11 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by Johnny Santiago, 10-11-2019, 09:21 AM
                      95 responses
                      6,194 views
                      0 likes
                      Last Post xiinteractive  
                      Working...
                      X