Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New Install trying to debug

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

    New Install trying to debug

    I just got a new pc and installed Ninja and copied my custom folder and all of my code including indicators and strategies to the new computer. i was able to get it to compile in Editor and also the indicators are loading.

    However, when i try to attach to process like I do on my old computer, and place a breakpoint to see where the code is failing on a problem, I am getting a message stating

    The breakpoint will not be hit, no symbols have been loaded for this document

    I never had this issue on my old pc which used an older version of Visual studio.

    Can anyone help me out with this?

    #2
    Hello ErikY,

    Thank you for your post.

    Since this is a new PC and new install, please be sure you are following each step outlined here:


    More specifically, you must right-click the NinjaScript Editor and check the option for Debug Mode, then compile with F5 before launching the NinjaTrader.Custom project in Visual Studio. At this time, Visual Studio 2019 and 2022 are supported versions for using the Visual Studio icon in the NinjaScript Editor toolbar.

    Once debug mode has been enabled and the NinjaScript files have been compiled to generate the debug DLL, you should follow the Attach to Process steps on that page and then you should be able to create breakpoints successfully.

    Please let me know if you are still receiving the same message, and if so please provide a screenshot so I may better understand and assist you.
    • 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.
    ​Thank you for using NinjaTrader.

    Comment


      #3
      ok, thanks, so now I have a different message, its now saying breakpoint will not be hit becuase source code is different than the original, I saved and rebuilt the project and than compiled in editor, which is what I have always done, and this usually would go away on my old computer, but its not going away on this one
      Attached Files

      Comment


        #4
        Originally posted by ErikY View Post
        ok, thanks, so now I have a different message, its now saying breakpoint will not be hit becuase source code is different than the original, I saved and rebuilt the project and than compiled in editor, which is what I have always done, and this usually would go away on my old computer, but its not going away on this one
        This error can appear with breakpoints in Visual Studio when attaching the debugging if your source file has changed and the source no longer matches the code you're debugging.

        During compilation, the open-source code is compiled into NinjaTrader’s assembly source. The code that runs within NinjaTrader coming from the internal source is different than the open source script you are editing which is kept separate and exposed.

        To resolve this, follow one of the options to disable these safety checks:
        • To modify a single breakpoint, hover over the breakpoint icon in the editor and select the settings (gear) icon. A peek window is added to the editor. At the top of the peek window, there's a hyperlink that indicates the location of the breakpoint. Select the hyperlink to allow modification of the breakpoint location and check Allow the source code to be different from the original.
        • To modify this setting for all breakpoints, go to Debug > Options and Settings. On the Debugging/General page, clear the Require source files that exactly match the original version option. Make sure to reenable this option when you're finished debugging.


        These instructions come from the Microsoft documentation on Troubleshooting Breakpoints in the Visual Studio Debugger:

        Microsoft documentation: Learn > Troubleshoot > Visual Studio > Troubleshoot breakpoints in the debugger

        Please let us know if we may be of further assistance.

        Comment


          #5
          Thanks Emily, and I did find those work arounds, but on my original pc, I never had to do these workarounds, in fact, the setting for require source files is actually always checked on that version of visual studio and on that machine and I never have a problem, so I was unsure why this is happening on the new pc with the new version

          Comment


            #6
            Click image for larger version

Name:	Screenshot 2025-04-05 152001.png
Views:	210
Size:	339.1 KB
ID:	1339749Hello Emily, I am trying to get setup working with Visual Studio 2022 Community Edition, the debug process got attached but it is not stopping on the breakpoints. I see folllowing warnings in Visual Studio:

            There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "PresentationCore", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
            Appreciate any suggestions for resolving this.
            Last edited by uchauhan; 04-05-2025, 04:21 PM.

            Comment


              #7
              Hello uchauhan,

              Welcome to the NinjaTrader forums!

              The architecture type should default to x64. To confirm, after installing NinjaTrader you have clicked the Visual Studio button on the NinjaScript Editor to launch the project?

              Have you made any changes to the project properties?

              Have you saved a solution?

              Have you attempted to build or run the NinjaTrader project from Visual Studio?

              Are you updated to the latest release of NinjaTrader 8.1.4.2?



              To correct the error, in the Solution Explorer right-click the project (NinjaTrader.Custom) and select Properties.

              In the Build > General > set Platform target to x64.

              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks Emily, I have the latest Ninjatrader 8.1.4.2 64-bit and Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.13.5, and .NET framework version 4.8.09302.

                The strategy was compiled in Ninjatrader and debug mode turned on and then I opened it in Visual Studio to attach to the debug process with code type as "Managed (.NET Framework 4.x) code". The Solution Explorer -->Build--> General properties already has x64 selected,

                My machine is Intel CPU Ultra core 7 155h, so unclear why the AMD warinings are showing up.

                The process is getting attached, however the breakpoints are not working. After swithcing to "Managed .Net Framework 4.x code" type, I am getting a different message in the breakout hover: I have not made any changes to the code from Visual Studio.

                Click image for larger version  Name:	image.png Views:	0 Size:	299.4 KB ID:	1339923


                I had installed NT locally on my machine as described for the Onedrive configuration artcle, hwoever windows keeps copying over the NT folder to OneDrive. It started happening after Windows did an auto backup of my machine. Prior to that NT was working from my local folder. I am also seeing sync error for NT files from OneDrive. Could that be causing the issues. Is it possible to install NT in some other location so that it does not keep the files under "Documents" folder, so that Onedrive conflicts are not there. I want to have the document backs for my other documents enabled, but don't need it for the NT files.


                I also tried reinstalling NT after disabling Onedrive again and getting this message for debugging:

                Click image for larger version

Name:	image.png
Views:	206
Size:	25.6 KB
ID:	1339924

                ​Appreciate your guidance for proper setup for NT debugging to work.
                Attached Files
                Last edited by uchauhan; 04-07-2025, 06:51 PM.

                Comment


                  #9
                  Hello uchauhan,

                  See post # 4 in this thread.

                  Have you already allowed the source code to be different than the original?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Emily, I tried that already. Nothing happens on any of the breakpoints, so I am not able to do the actual debugging of the script inside Visual Studio. Is there anything else that I can try to get debuging working, perhaps a good example that I can test to verify the settings?
                    Last edited by uchauhan; 04-08-2025, 09:37 AM.

                    Comment


                      #11
                      Hello uchauhan,

                      May I have a screenshot of the settings window to show you have properly unchecked the setting?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Sure:

                        Click image for larger version

Name:	image.png
Views:	206
Size:	218.9 KB
ID:	1339995

                        Comment


                          #13
                          Hello uchauhan,

                          Thank you for the screenshot.

                          I'd like to schedule a call with you to take a look.

                          May I have you send an email to scriptingsupport [at] ninjatrader.com so we may schedule a call?

                          In the email please write Attn Chelsea #04276080.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello, when debugging, it tries attaching automatically - should I select the automatic "Managed .net 4.8" version when attaching Visual Studio debugger?

                            Comment


                              #15
                              Hello music_p13,

                              Likely that would be correct.

                              Attached is how this appears in the window on my end.
                              Attached Files
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              580 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              335 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              102 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X