Step through a program backwards after an Exception has occurred - Visual Studio

前端 未结 4 1166
孤城傲影
孤城傲影 2021-01-11 17:43

Is there a way to step back through a program from the point where an error/Exception has occurred? Or look at the sequence in which the methods were called before the erro

相关标签:
4条回答
  • 2021-01-11 18:11

    In the Ultimate versions of Visual Studio 2010 you can use Inellitrace to go back in the execution, as Dan Puzey mentioned.

    However, in any version of Visual Studio you can still get a lot of information just from the call stack. It doesn't only show the calls that lead up to the current position, by double clicking on points in the Call Stack window you can jump to the point in the code where each method was called. The state of the stack is preserved, so you can even still see the values of local variables in the calling method.

    0 讨论(0)
  • 2021-01-11 18:11

    You will see the trace in the Stack Trace (Call Stack Window in Visual Studio).

    If you are using debugger you can drag and drop the yellow arrow to the previous lines of code to repeat the scenario. However, it does not always work.

    0 讨论(0)
  • 2021-01-11 18:20

    Right click on the line of code to which you want to get back and select "Set next statement" Another option is to drag the yellow arrow to the desired line.

    0 讨论(0)
  • 2021-01-11 18:24

    If you have VS2010 Ultimate, the "Intellitrace" functionality allows you to do exactly that. It basically logs a huge amount of execution data (up to and including every method call & parameter made) and allows you to step back in time to examine variable values at those points.

    0 讨论(0)
提交回复
热议问题