Visual Studio 2010 中的调用堆栈时间机器 [英] Call stack time machine in Visual Studio 2010

查看:21
本文介绍了Visual Studio 2010 中的调用堆栈时间机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道标题有点雄心勃勃,但我想知道是否有办法在调试 C# 程序时在调用堆栈窗口 (Visual Studio 2010) 中显示以前的状态后重新启动(例如点击继续"/F5) 从那里开始.

I know the title is a bit ambitious, but I am wondering if there is a way, after displaying a previous state in the call stack window (Visual Studio 2010) when debugging a C# program, to restart (like when hitting "Continue"/F5) from there.

这对于调试生成异常的 lambda 表达式特别有用,因为无法移到外面.

This would be particularly useful to debug a lambda expression that generates an exception, as there is no way to move outside.

对于真正的 OO 代码时间机器,所有对象的历史状态都需要存储在内存中,所以我怀疑现阶段是否可行.现在如果所有对象的状态没有太大变化,那么我们可以保持当前状态并及时跳回(作为使用编辑并继续"做同样事情的快捷方式).

For a real OO code time machine, the historical state of all objects would need to be stored in memory, so I doubt it is feasible at this stage. Now if the state of all objects has not changed much, then we could keep the current state and jump back in time (as a shortcut to doing the same thing with "edit and continue").

推荐答案

有时,您可以右键单击堆栈框架并选择Unwind to here"(或非常相似的措辞).这并不总是可能的,我不确定必要条件是什么,但我将猜测什么可能会阻止它:

Some times, you can right click on a stack frame and choose "Unwind to here" (or very similar wording). It's not always possible, and I'm not sure what the necessary conditions are, but I'm going to make a guess as to what might prevent it:

  • 中间调用堆栈上的原生代码框架
  • 在 StackOverflowException 处停止(显然,无论如何都会导致进程死亡)
  • 也许 lambda 表达式或其他阻止编辑并继续工作的东西 (?)

基本上,任何不寻常"的东西.

Basically, anything "unusual".

除此之外,如果它有效,那么你去!

Other than that, if it works, then there you go!

这篇关于Visual Studio 2010 中的调用堆栈时间机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆