Search code examples
c#visual-studiodebuggingvisual-studio-2015intellitrace

Dragging the instruction pointer backward while debugging in Visual Studio


For a demonstrating, take a look at the following section of this video.

Basically, I know this is possible in Visual Studio Community Edition 2015. I was wondering:

a) Is this related to Intellitrace and "Historic debugging"? b) Will there be any side-effect when I do this? Or is this just moving the instructions backwards and that's it?


Solution

  • It is just moving the instruction pointer backwards and that's it, to use your own words.

    This means that:

    • Any side-effects already incurred between where you drag it to and where you dragged it from has already incurred and won't be reversed.
    • Any variables changed in the same section of instructions will still be changed, they are not reversed to whatever values they had at the point you you drag the instruction pointer to

    So you can use this debugging aid to either force the program to take a path it didn't (for instance by dragging the instruction pointer inside an if-statement it skipped), to skip (by dragging the instruction pointer past some code you don't want to execute), or to rerun some code.

    But you must be aware of the above limitations. If the code is not safe to be executed again, then doing so will likely not help you debug.