Visual Studio在断点上冻结 [英] Visual Studio freezes on breakpoints

查看:166
本文介绍了Visual Studio在断点上冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从一个星期后,我看到一个非常讨厌的行为从VS2010:
当我正在调试一个项目,调试器停止在断点Windows冻结了几十秒。我说Windows冻结,因为鼠标和键盘在这段时间内是无用的。

Since a week back I'm seeing a very annoying behavior from VS2010: As I'm debugging a project and the debugger stops on a breakpoint Windows freezes for almost ten seconds. I say "Windows freezes" because the mouse and keyboard are useless during this time period.

这个问题只发生在我调试一个特定的项目,两个不同的机器具有相同的结果。这个项目是WPF,我在一个点钩住键盘(不是鼠标),但该代码没有被触及几个月,而问题只有一个星期。

The problem only happens as I debug a specific project and I've tried it on two diffrent machines with the same result. The project is WPF and I do hook the keyboard at one point (not the mouse though) but that code hasn't been touched for months while the problem is just a week old.

我在安装之前就安装了Telerik的大套件(试用版),所以我的第一个怀疑是Telerik的VS集成是罪魁祸首。我卸载了所有Telerik VS集成(JustXXX产品),但问题仍然存在。

I did install Telerik's big suite of everything (trial) just before this started to show so my first suspicion was Telerik's VS integration was the culprit. I uninstalled all Telerik VS integrations (the "JustXXX" products) but the problem remain.

我会非常感谢任何人可以提供一个提示,

I would be very greatful to anyone being abe to give a hint as to what might be going on here.

感谢

编辑1:
我现在已经尝试建立一个新的解决方案,将所有项目移动到它,但问题仍然存在。

EDIT 1: I have now tried building a new solution, moving all projects into it but the problem remains.

然后我卸载了所有Telerik,只是为了确保,但这也是没有效果。

I then uninstalled everything Telerik, just to make sure, but this also was to no effect.

下一个测试是在不同的机器上加载完全相同的解决方案,这有帮助。该机器没有与VS2010的第三方集成,除了reSHarper 6.1。

The next test was to load the exact same solution on a different machine and that did help. That machine has no 3rd party integrations with VS2010 except for reSHarper 6.1.

我还分析了更多的问题位,典型的情况是,前几次断点是打开UI冻结大约十秒钟。鼠标/键盘停止响应,但光标在代码编辑器中保持闪烁。接下来的几个断点是一样的,并且经常从一行到另一行会导致很长的延迟(没有UI冻结)。

I have also analyzed the issue bit more and the typical scenario is that the first few times a breakpoint is hit the UI freezes for apeoximately ten seconds. Mouse/keyboard stops responding but the cursor keeps blinking in the code editor. The next few breakpoints does the same and often stepping from one line to another will cause a very long delay (no UI freeze though).

此外,如果第一个断点是设置非常早在我的应用程序启动代码我可能不会遇到的问题。但是当我继续遍历代码时,调试器变得更慢,因为应用程序初始化自身(在单独的线程)。

Also, if the first breakpoint is set very early in my application startup code I might not experience the problem. But as I continue to step through the code the debugger becomes more sluggish as the application initializes itself (in separate threads).

正如我之前说过的,单个应用程序所以代码是明显相关的。

As I've said before this happens for a single application so the code is clearly related somehow.

有没有人知道调试器的工作原理?除了设置断点或用户从一行到另一行(刷新堆栈跟踪和观察窗口)所需的明显步骤之外,后台会发生什么可能会冻结所有内容,以及如何实现?

Does anyone have good knowledge of how the debugger operates? Apart from the obvious steps needed whenever a breakpoint is set or the user steps from one line to another (refresh stack trace and watch windows) what is going on in the background that might freeze up everything and how is it possible?

我最后的希望是完全重新安装VS2010,但我希望能在这个选项之前解决这个问题。

My last hope is a complete reinstall of VS2010 but I hope I can solve this before that option is required.

推荐答案

我终于找到了这种奇怪行为的原因。正如我在原来的帖子中提到的,在应用程序初始化期间,我钩了键盘( AND 鼠标,我忘了我这样做),以便能够检测用户不活动。

I have finally found the cause for this weird behavior. As I mentioned in the original post I do hook the keyboard (AND mouse, I had forgotten I did that) during the application's initialization in order to be able to detect user inactivity.

监视发生在一个后台线程中,它只是等待一个 AutoResetEvent 来发现用户活动或不活动。由于某种奇怪的原因, AutoResetEvent.WaitOne(...)会以某种方式影响调试器。我当前的修复是只是避免等待,如果调试器附加。

The monitoring takes place in a background thread that simply waits for an AutoResetEvent to discover user activity or inactivity. For some odd reason the AutoResetEvent.WaitOne(...) somehow affects the debugger. My current fix is to just avoid the wait if the debugger is attached.

我仍然无法解释为什么这种情况发生。它已经工作了一年,但问题的原因终于找到并处理。

I still cannot explain why this happens now. It has been working for a year but the cause for the problem is finally found and dealt with.

我已经提交了我的问题给Microsoft,希望得到一个很好的解释。如果我这样做,我会在这里张贴。

I have submitted my question to Microsoft, hoping to get a good explanation. If I do I will post it here.

这篇关于Visual Studio在断点上冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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