Visual Studio Debug options: Edit and Continue and Step Back

This forum is meant for anything you would like to share with other visitors
Post Reply
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Visual Studio Debug options: Edit and Continue and Step Back

Post 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
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Visual Studio Debug options: Edit and Continue and Step Back

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Visual Studio Debug options: Edit and Continue and Step Back

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply