开发者

is it possible to edit code while debugging in visual studio, like in eclipse (java)

Is there an option to edit the code when debugging in a breakpoint in Visual Studio. When I stop, all files seems locked for editing.

Is there a way to change this behaviour? It is possible in Eclipse

EDIT: after trying all suggested belo开发者_运维技巧w (including move it to debug from release) now it is telling me I don't have the correct ms-office version and debug cannot start in debug mode. However, in release mode it was working. I am trying to debug an outlook add-in.


Yes, it's called "Edit and Continue", in Tools | Options under Debugging. Note that it's not compatible with IntelliTrace, so you have to disable that if you're using it. (Thank you Anton Semenov for that info.)

Edit: If you're using a really old version (the original VS.Net, as opposed to VS.Net 2005 or later), it was pretty fiddly about this (or didn't have it, I can't quite recall; I just remember being frustrated). But if you're using VS.Net 2005 or later, in my experience, it's enabled by default and works very well. When execution is paused (and you said you'd hit a breakpoint, so...), you can make quite a variety of changes and the environment will happily compile them and continue. Make sure all of the projects you want to debug are in the solution.


In general, it is possible, but you have to make sure you are compiling your project to x86 platform.

For this, right click on the project name in the Solution Explorer, go to Build and set the Platform Target to x86.

Edit:
Of course, in order to be able to edit a file, the execution need to be paused (in a breakpoint, for example)


yes you can update code in debug mode. Set the break point to the point which u want to edit . When the execution comes to this point then edit your code then press f5. It will take the changes.


win7

Yes, it's called "Edit and Continue", in Tools | Options under Debugging. Note that it's not compatible with IntelliTrace


win10 can turn on IntelliTrace


# How to set a Visual Studio breakpoint to pause execution of your program at that point

To set a breakpoint, first decide which executable line of code you want the program to stop on 'Before' that line of code is executed.

Set the cursor flashing anywhere on that line.

Press [F9] to set the breakpoint, and a red circle appears on the far left.

Press [F5] to run program.

To close the program, click on the program window so that it is your active window, and press [Ctrl]+[Pause].

To disable the breakpoint, but not delete it, set your cursor flashing on that line again, and press [Ctrl]+[F9], which turns the circle white. (Or Right-click the red circle, and click "Disable Breakpoint")

To delete the breakpoint, Right-click the red circle, and click "Delete Breakpoint".


Using the mouse as an alternative way to set, disable, or delete breakpoints

Once you know where the breakpoints show up on the left side of the Visual Studio window, you can set a breakpoint by double-clicking at the point where you want the breakpoint to be placed, and it will be placed there.

If you double-click a red breakpoint, it will be removed.

If you hover your mouse pointer on a breakpoint, two little icons appear slightly above, and to the right of the breakpoint.

Clicking that right-side icon toggles the breakpoint from active to disabled, and vice-versa.


For many more details, see the topic:

"Getting Started with the Debugger"

https://msdn.microsoft.com/en-us/library/mt243867.aspx


Also, see the left column on the page from the link above for the additional pages:

"Navigating through Code with the Debugger"

https://msdn.microsoft.com/en-us/library/y740d9d3.aspx

"Using Breakpoints"

https://msdn.microsoft.com/en-us/library/5557y8b4.aspx


Video: And for a 5-minute introductory video, see:

"Debugging in VS Code"

https://code.visualstudio.com/docs/introvideos/debugging

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜