为什么Visual Studio在调试时停顿? [英] Why does Visual Studio stall while debugging?

查看:118
本文介绍了为什么Visual Studio在调试时停顿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,当我正在调试一个c#应用程序时,我会打破一个断点,当我尝试继续,步进或进入时,它什么都不做。突出显示当前行的黄色线条消失,但从未到达下一行。该应用仍然冻结,因为我在一个断点,我可以做任何事情,但打停止调试按钮并重新启动。这不会一直发生,但一旦它开始在应用程序,它似乎总是发生在那个应用程序之后。我发现在类声明之前添加以下代码修复该应用程序的问题,但是很好奇为什么会发生这种情况。

  [System.Diagnostics.DebuggerDisplay(Form1)]  

其他详细信息:
我没有注意到任何类型的模式,特定的行在冻结时。我写的大多数应用程序都使用线程,所以每次都有一个很好的机会。

解决方案

我遇到这种行为,虽然这是我的第一次。



我已经通过这个问题,通过两种方式


  1. 您的方式放置此属性,[System.Diagnostics.DebuggerDisplay(Form1)]

  2. 关闭工具 - >选项 - >调试 - >通用 - >启用属性评估和其他隐式函数调用。

我仍在调试我的代码,但在我看来某些Autos评估失败(可能会引发异常),这可能会导致调试器崩溃。



请让我们知道这是否也是这样。 p>

Sometimes, while I am debugging a c# application, I will hit a break point and when I try to continue, step or step into, it just does nothing. The yellow line highlighting the current line goes away, but it never reaches the next line. The app is still frozen like I am on a breakpoint and I can do nothing but hit the stop debugging button and restart. This doesn't happen all the time, but once it starts on an app it seems like it always happens after that for that app. I have found that adding the following code just before the class declaration "fixes" the problem for that app, but am very curious as to why this is happening.

[System.Diagnostics.DebuggerDisplay("Form1")]

Additional details: I have not noticed any kind of pattern as to what the particular line does when it freezes. Most of the apps I write use threading, so there is a decent chance this is happening within a thread every time.

解决方案

I have come across with this kind of behavior, though this is my first time.

I have got through this problem, by two ways

  1. Your way of putting this attribute, [System.Diagnostics.DebuggerDisplay("Form1")]
  2. Turning off Tools->Options->Debugging->General->Enable Property evaluation and other implicit function calls.

I am still debugging my code but It seems to me that some of the Autos evaluation is failing (possibly throwing an exception), which is possibly crashing the debugger.

Please let us know if this is also your case.

这篇关于为什么Visual Studio在调试时停顿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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