检测到 ContextSwitchDeadlock

环境:VS 2005

硬件:指纹鼠标

错误:CLR 无法从 COM 上下文 0x1a0598 转换为 COM 上下文 0x1a0708,这种状态已持续 60 秒。
拥有目标上下文/单元的线程很有可能执行的是非泵式等待或者在不发送 Windows 消息的情况下处理一个运行时间非常长的操作。
这种情况通常会影响到性能,甚至可能导致应用程序不响应或者使用的内存随时间不断累积。
要避免此问题,所有单线程单元(STA)线程都应使用泵式等待基元(如 CoWaitForMultipleHandles),并在运行时间很长的操作过程中定期发送消息。

解决方案:

在Debug -> Exceptions -> Managed Debug Assistants里 去掉ContextSwitchDeadlock一项前面的钩。

Managed Debugging Assistants" (MDA) and can be disabled by Debug->Exceptions ... > Expand the MDA node and uncheck the box against contextswitchdeadlock

 

posted @ 2009-07-16 20:56  winzheng  阅读(2910)  评论(2编辑  收藏  举报