如何避免contextswitchdeadlock和Disconnected Context警告消息 [英] How to Avoid contextswitchdeadlock and Disconnected Context Warning messages

查看:169
本文介绍了如何避免contextswitchdeadlock和Disconnected Context警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我谷歌过去3天没收到这条警告消息





检测到ContextSwitchDeadlock

消息:CLR无法从COM上下文0x44d3a8过渡到COM上下文0x44d5d0 60秒。拥有目标上下文/公寓的线程很可能是在非抽空等待或处理非常长时间运行的操作而不抽取Windows消息。这种情况通常会对性能产生负面影响,甚至可能导致应用程序变得无响应或内存使用量随时间不断累积。为了避免这个问题,所有单线程单元(STA)线程都应该使用抽取等待原语(例如CoWaitForMultipleHandles)并在长时间运行操作期间定期泵送消息。

Hi all,

I google to avoid this warning message from past 3 days I was getting


ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x44d3a8 to COM context 0x44d5d0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

推荐答案

你好所有,



Hi all,

at last I am able to avoid this warning

http://www.rocha.org/2010/05/contextswitchdeadlock-was-detected.html


Just click Ctrl+Alt+E in your project and you will get exceptions window select
 Managed Debugging Assistants you should uncheck the ContextSwitchDeadlock thats all..

Thanks all,


这不是解决方案,只是忽略了问题。 br />


我有同样的问题,但我知道原因是因为我正在处理的应用程序将在MTA和STA之间切换,并从托管代码与COM交互。



在坚果壳中你需要在STA模式下泵送按钮(我在我的模式中)案例)。



查看以下一些链接:

非抽空等待或处理非常长时间运行的操作而不抽取Windows消息。 [非抽空等待或处理非常长时间运行的操作而不抽取Windows消息]



contextSwitchDeadlock MDA [ contextSwitchDeadlock MDA ] >


决议:已检测到上下文切换死锁! |早期叮咬 [ ^ ]

我不建议忽略错误。相反,你应该尝试修复它。
This is not a solution but simply ignoring the Issue.

I have the same issue but and i know the cause is because the application i work on will switch between MTA and STA and interact with COM from managed code.

In a nut shell you need to Pump the meassages when in STA mode (well i do in my case).

Check out some of the following links:
Non pumping wait or processing a very long running operation without pumping Windows messages.[Non pumping wait or processing a very long running operation without pumping Windows messages]

contextSwitchDeadlock MDA[contextSwitchDeadlock MDA]

Resolution: Context Switch Deadlock was detected !!! | Early Bites[^]
I would not recommending ignoring the error. Instead you should attempt to fix it.


这篇关于如何避免contextswitchdeadlock和Disconnected Context警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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