xsharp.eu • Visual Studio Debug options: Edit and Continue and Step Back
Page 1 of 1

Visual Studio Debug options: Edit and Continue and Step Back

Posted: Tue Nov 05, 2019 3:24 pm
by ic2
I thought I asked this earlier but couldn't find it back, also not in the NG's. This is what I found, is this correct:

Visual Studio Edit and Continue

Theory: This needs to be enabled in Options/Debugging, General first. It should allow you to change a line of code and continue with that line of code.
What I see: I can indeed make a change during debugging, then select Continue or Step Into from the debug menu, but VS warns me that I am debugging different code than is currently displayed - and doesn't do anything with the changes.

Visual Studio Step Back

Theory: During debugging it is possible to select Set Next Statement from the right mouse menu, also when this is earlier in the code
What I see: I can indeed make the program continue in an earlier line of code, but the variables are not changed back to the state they were at that line so the rerun may have limited value.
I suspect that when using the VS Enterprise Version and you set up Debug/Intellitrace, that it also restores the state of variables.

Am I right in the above statements?

Dick

Visual Studio Debug options: Edit and Continue and Step Back

Posted: Tue Nov 05, 2019 3:38 pm
by Chris
Hi Dick,

About the Step Back (or even forward) which is available also in XIDE, yes, it does not bring back the whole state in time, it only allows you to run again a specific part of code, with the current set of values. Or you can avoid executing a line or more, but jump to a place later in the code. Of course you can also manually modify the value of the variables (at least many of them) before executing the code again.

Not sure about Edit and Continue, will let Robert answer that.

Visual Studio Debug options: Edit and Continue and Step Back

Posted: Tue Nov 05, 2019 9:23 pm
by robert
Dick,
Edit and Continue requires 2 things:
1) that the editor buffer is Read/Write when running the debugger (this is controlled with the Options/Debugging flag)
2) that the VS support for a language runs the compiler and 'patches' the generated IL with the changed code.

We do not support 2) at this moment. We have looked at it and it is not trivial...

Robert