Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 below (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.

like image 280
oshai Avatar asked Apr 15 '11 06:04

oshai


People also ask

Can you edit code while debugging in Visual Studio?

If selected, Visual Studio automatically compiles and applies code changes when you continue debugging from a break state. Otherwise, you can choose to apply changes using Debug > Apply Code Changes.

How do I change the debug code in Visual Studio?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

Does Eclipse have an interactive debugger?

The console in Eclipse is interactive, when a running application reads from the Console Input Stream. It is not meant to be a feature of Eclipse to generally aid in debugging, it is meant to allow console based Java applications to read input from the user when debugging (as in I can type into a console prompt).

How do you debug a program while it is still in use Java?

Most debuggers allow you to debug a program in one of 2 ways: You run the program from within the debugger. You attach debugger to an already running program.


2 Answers

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.

like image 182
T.J. Crowder Avatar answered Sep 22 '22 13:09

T.J. Crowder


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)

like image 40
Oscar Mederos Avatar answered Sep 23 '22 13:09

Oscar Mederos