Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Visual Studio : Saving in VS no longer allows breakpoints to be hit

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

    Visual Studio : Saving in VS no longer allows breakpoints to be hit

    NT Forum,

    I have greatly enjoyed the increased integration between NinjaTrader (NT) and Visual Studio (VS). In VS, saving code kicks off a compile in NT. Brilliant!

    However, I recently had cause to disable and re-enable Debug Mode in the NinjaScript Editor (NSE). Since this event saving code in VS still kicks off a compile in NT. However, breakpoints will not be hit during debugging in VS. Hovering above the breakpoint in VS reveals the message :
    "The breakpoint will not currently be hit. The source code is different from the original version..."
    A compile in NSE is required for breakpoints to be hit.

    All attempts to remedy have failed. Any ideas on what must be done to reinstate breakpoints being hit with a simple save in VS are welcome.

    Thanks
    Shannon

    #2
    Originally posted by Shansen View Post
    NT Forum,

    I have greatly enjoyed the increased integration between NinjaTrader (NT) and Visual Studio (VS). In VS, saving code kicks off a compile in NT. Brilliant!

    However, I recently had cause to disable and re-enable Debug Mode in the NinjaScript Editor (NSE). Since this event saving code in VS still kicks off a compile in NT. However, breakpoints will not be hit during debugging in VS. Hovering above the breakpoint in VS reveals the message :
    "The breakpoint will not currently be hit. The source code is different from the original version..."
    A compile in NSE is required for breakpoints to be hit.

    All attempts to remedy have failed. Any ideas on what must be done to reinstate breakpoints being hit with a simple save in VS are welcome.

    Thanks
    Shannon
    Today I had trouble with this in Beta 4. I needed to attach the Debugger AFTER NT had done it's Compile (with Debug). From working with VS 2013 and NT 7 I had acquired the habit of NT-Compile THEN attach. The newest Beta 4 help file does say (correctly) to compile then attach.

    Comment


      #3
      Hello dalebru,
      Thank you for your assistance. This is stated in the help guide here: http://ninjatrader.com/support/helpG...isual%2Bstudio

      If you require further investigation into this matter Shannon, please let us know.

      Thank you in advance.
      Michael M.NinjaTrader Quality Assurance

      Comment


        #4
        Michael,

        Thanks for your response. I have followed all steps in the provided help guide it works as described in the help guide. However, in VS with the first save (Ctrl+S), again break points will not be hit. A compile in NinjaScript Editor will again allow breakpoints to be hit.

        I should note, saving in VS does kickoff off the compile in NT. The issue remains with the breakpoints.

        Any ideas are welcome.
        Regards
        Shannnon

        Comment


          #5
          Hello Shannon,

          I will need to discuss this with our product management team to see if this is expected behavior or not before we can proceed further. Our normal hours of operation are between 8:30AM EST and 6:00PM EST Monday through Friday.

          I will update this post as soon as possible.

          Thank you for your continued patience in the meantime.
          Michael M.NinjaTrader Quality Assurance

          Comment


            #6
            Michael,

            Thanks for the follow up.

            This behaviour appears to present where:
            a) more than one workspace is open (noting only one workspace can be "active" at at time)
            b) one workspace has Debug Mode toggled off (even where that workspace is "inactive").

            Regards
            Shannon

            Comment


              #7
              Hello Shannon,

              Could you please confirm the following: Are you using Edit and continue or do you have this disabled in Visual Studio?

              In general, the default settings would not allow you to edit a document and then save it during a debug which would be the standard NT way.

              If instead you have Edit and continue disabled, this would be expected because NinjaTrader its self sees a file change which causes the compile. The compile would generate a new debug file which the still attached Visual studio would not have loaded resulting in a message " The breakpoint will not currently be hit. The source code is different from the original version".

              Can you confirm is this the same process that is happening to you, if not can you detail the exact steps you are doing that causes this message?

              Thank you in advance.
              Michael M.NinjaTrader Quality Assurance

              Comment


                #8
                Michael,

                For clarity the "Edit and Continue" message (attached) you are referring to is not the issue.

                The process followed is as per Visual Studio Debugging (more or less). This process works as expected... where only one workspace is open and "Debug Mode" is toggled on.

                In NinjaScript Editor (NSE),
                1. Enable "Debug Mode".
                2. Compile.
                3. In the toolbar, click on the Visual Studio icon.
                In Microsoft Visual Studio (VS)
                4. Select Debug -> Attach to Process...
                5. In the popup window, select NinjaTrader from the process list and "Attach".
                Note: "Attach to" field is set to "Automatic: Native code" (Not the "Automatic: Managed code" or "Managed code" as listed in the guide). This appears to have no detrimental effect.
                6. Open the NinjaScript source file
                7. Set breakpoint/s
                In NinjaTrader Chart (NT)
                8. Run NinjaScript object (which stops at break point/s in VS).
                As noted in my prior post, the breakpoints will not be hit where:
                a) more than one workspace is open (noting only one workspace will be "active"), and
                b) one "inactive" workspace has "Debug Mode" toggled off.

                You will note, the behaviour experienced is the same as if you attempted to attach to NT with a single open workspace and "Debug Mode" was toggled off.

                My issue was resolved by closing an offending "inactive" workspace where "Debug Mode" was toggled off.

                Regards
                Shannon
                Attached Files
                Last edited by Shansen; 09-29-2015, 03:47 AM.

                Comment


                  #9
                  Hello Shannon,

                  Thank you for clarifying. After some further investigative work I have confirmed this issue on my end as well. I have submitted a bug report for this in NinjaTrader 8. Once I have further information from development, I will update this thread.

                  Thank you for your continued patience in the meantime.
                  Michael M.NinjaTrader Quality Assurance

                  Comment


                    #10
                    Hello Shannon,

                    Could you please confirm whether or not you have Edit and Continue disabled in Visual Studio? You can check this in Visual Studio via Tools -> Options -> Debugging -> Edit and Continue

                    If Edit and Continue is disabled, Visual Studio won't try to reload the assembly in the current debug session so this behavior is expected.

                    If Edit and Continue is not disabled, could you please confirm that these are the correct steps to replicate the issue?

                    1. Open two workspaces with code editors in NT
                    2. In secondary workspace code editor, make sure Debug Mode is turned off
                    3. In primary (active) workspace code editor, make sure Debug mode is turned on
                    4. Compile in the active workspace code editor
                    5. Click VS button in code editor toolbar to open Visual Studio
                    6. Attach to process in Visual Studio
                    7. Set a breakpoint (anywhere in the code)
                    8. Make a change to the code in Visual Studio and save
                    9. Will get message on breakpoint "The breakpoint will not currently be hit. The source code is different from the original version"

                    As so far I am unable to replicate the issue without disabling Edit and Continue.

                    Thank you in advance.
                    Michael M.NinjaTrader Quality Assurance

                    Comment


                      #11
                      From forum member 'stoner':
                      About Visual Studio : Saving in VS no longer allows breakpoints to be hit

                      I can't post on the above mentioned thread.

                      I wanted to let the community know...

                      I was experiencing a similar problem here and based on Shannon's comments I thought my issue had to do with the fact that I had two workspaces active with NinjaScript editors open in both. I tried closing one Editor and that didn't work. So I tried closing the workspace that the unused editor had been in and that didn't work. I tried restarting NT and that didn't work.

                      So I went back and read the Visual Studio Debugging documentation again to realized I had overlooked a critical instruction in step 1. In the NinjaScript Editor I had failed to right click and select Compile after I had turned the Debug Mode on.

                      Note that before I clicked Compile I closed my running VS instance in order to start from the beginning of the documentation's instructions.

                      Hope this helps someone else.
                      Michael M.NinjaTrader Quality Assurance

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by 8033075, Yesterday, 08:13 PM
                      1 response
                      30 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by futurenow, Yesterday, 06:13 PM
                      1 response
                      21 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by trader3000a, Today, 07:34 AM
                      2 responses
                      9 views
                      0 likes
                      Last Post trader3000a  
                      Started by focus333, Yesterday, 11:28 PM
                      1 response
                      22 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by futurenow, Yesterday, 07:03 PM
                      1 response
                      13 views
                      0 likes
                      Last Post NinjaTrader_Kate  
                      Working...
                      X