Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

System.ExecutionEngineException error when debug using Visual studio 2019

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

    System.ExecutionEngineException error when debug using Visual studio 2019

    Hi,
    I'm trying to debug simple scripts using visual studio and I've major issue to do it

    - Install Visual studio 2019
    - I open the script
    - Select debug mode
    - Compile the script using debug mode
    - open the VC through the button
    - In the VC, attach the Ninjatrader process

    Here, when I did it before (few years) the script source code opens, but in my case, nothing happens if I open manually the script code and put a breakpoint, if I hit run I get System.ExecutionEngineException error
    Click image for larger version

Name:	syste.ExceptionError.png
Views:	494
Size:	8.7 KB
ID:	1272390

    To get rid of this issue, I tried :

    - remove many time VC 2019, install VC 2022, go back to 2019, many times
    - Tested various Ninjatrader versions (actually 8.0.22, tested,8.028, 8.1.17), tried to remove Ninjatrader 8 in my document to get fresh installs

    Could you help to resolve this issue ?

    Thanks


    #2
    Hello bourasrafik,

    Thanks for your post.

    What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

    NinjaTrader version 8.0.22.0 is an old version of NinjaTrader and you would need to update to either NinjaTrader 8.0.28.0 or 8.1.1.7 first.

    Please follow the steps below to update NinjaTrader to the latest version.

    To update NinjaTrader
    • Shutdown all programs including NinjaTrader *important
    • Download NinjaTrader from the link below
    • Double click the downloaded file to execute it
    • Follow the on screen instructions
    • Restart NinjaTrader
    You can read about changes to this release in the release notes linked below.
    https://ninjatrader.com/support/help...ease_notes.htm

    After updating NinjaTrader to the latest version, open a New > NinjaScript Editor window, open the script in the Editor window, right-click in the Editor, select 'Debug Mode' to enable it, select the Visual Studio button on the Editor Toolbar to open Visual Studio, in Visual Studio select 'Debug' > 'Attach to process', select NinjaTrader from the list of processes, then select Attach. Be sure the "Attach to" field is set to "Automatic: Managed code" or "Managed code". Then, open the NinjaScript source file within Microsoft Visual Studio.

    I have tested opening Visual Studio 2019 from NinjaTrader 8.1.1.7 and was able to do this successfully. Please see the demonstration video below and follow the steps seen in the video to open Visual Studio from NinjaTrader for debugging.

    Demonstration Video: https://brandonh-ninjatrader.tinytak...OV8yMjIxNDQ2Ng

    Note that you will need to make sure that Visual Studio is closed, not open, when clicking the 'Visual Studio' button on the NinjaScript Editor Toolbar.​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,
      This waht I did multiple time, I was in the 8.0.28 version, I re-installed the VC 2019 and the Ninjatrader too (repaired too through installer), now i run on worst issue i'm unable to compile at all all strategies (see picture below)
      Click image for larger version

Name:	Fraework error.png
Views:	385
Size:	22.9 KB
ID:	1272518

      I had also target processor mismatch between the VC and Ninjatrader

      What can I do else ?
      Thanks

      Comment


        #4
        Hello bourasrafik,

        Thanks for your notes.

        The error looks like you may have an AssemblyAttributes.cs file in the Custom folder which is conflicting with a .NET file. This may occur when building something in Visual Studio

        Open a File Explorer window and check in Documents > NinjaTrader 8 > bin > Custom >obj > Debug for a file named AssemblyAttributes.cs. If you find this file, delete the obj as well as the bin folders within the Custom folder.​

        Doing a build from Visual Studio could cause multiple files to occur. Note that you should never compile from Visual Studio.

        From the Visual Studio Debugging help guide: You can also use Visual Studio as editor for your NinjaScript files - for that open the project as in step 2 above and then use Visual Studio for editing and once done save the file (don't run or build the solution then in Visual Studio), preferably with the NinjaScript editor opened still at the same time, so changes would be auto compiled in then.

        Visual Studio Debugging: https://ninjatrader.com/support/help..._debugging.htm

        Here is a forum thread detailing this compilation error and resolving it: https://forum.ninjatrader.com/forum/...rk#post1127976
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hi Brandon,
          It solved my compiling issue, thanks but, I go back to original issue, as soon as I attach the process, I get the exception in unkown module (same image above), I followed the exact same steps in your video.
          What else can I do ?
          Thanks

          Comment


            #6
            Hello bourasrafik,

            Thanks for your notes.

            Please create a clean environment by following the steps below. As Visual Studio is an external application and the error does not provide any detail on what is throwing an exception it would be best to start with a clean slate to make sure that something imported is not causing a problem.

            Creating a clean environment can be done by following the steps below:
            1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
            2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from account.ninjatrader.com
            3. After reinstalling, open NinjaTrader
            If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names. For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.

            After creating a clean environment by following the steps above, open NinjaTrader and follow the steps in the Visual Studio Debugging help guide page (these are also the steps in the demonstration video I shared) and test to see if the error persists.

            Visual Studio Debugging: https://ninjatrader.com/support/help..._debugging.htm

            Below are some forum threads detailing this Visual Studio error.
            Hello, While trying to debug the code of an custom indicator I receive the following error message in VS: System.ExecutionEngineException: &quot;Exception of

            Hi, I am running into an issue that occurs whenever I want to attempt to debug any of my indicators or strategies. I enter into debug mode on the NinjaScript editor, and then attach the NinjaScript process to Visual Studio, and then get this error &quot;The Application is in Break Mode.&quot; Then this window pops up that says


            I look forward to assisting further.
            Last edited by NinjaTrader_BrandonH; 10-11-2023, 12:03 PM.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              Hi,
              I found the reason, starting from scratch resolved the issue, but, I was curious as I already did this without fixing it before, the difference is this case is I copy the data base files from my old to the new one and in this case it works! weired, in fact in my previous installation I install dxfeed add-on to get data and this is the difference, in my previous tests I installed it to get data to test but in the last one, i copy the data that I already downloaded, having the new Ninjatrader installation without dxfeed does not have the issue.
              I tested by installing again the add-on and right away I get the issue.
              I opened a ticket at dxfeed

              Thanks for helping

              Comment


                #8
                To the Original Poster, I had the same issue, and had to drop DXFEED, their add on does something that does not allow Visual Studio to work anymore, which made it a non-starter for me.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                60 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                39 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                21 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                23 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                51 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X