gpt4 book ai didi

com - 'COM context' MDA 消息中引用的 'ContextSwitchDeadlock' 是什么?

转载 作者:行者123 更新时间:2023-12-04 21:06:55 25 4
gpt4 key购买 nike

在运行单元测试时,我得到如下所示的 MDA。

在错误消息中,被称为“COM 上下文”的十六进制值是什么?

我可以确定给定 STA 线程的这个值吗?如果是,怎么办?

Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vstesthost.exe'. Additional Information: The CLR has been unable to transition from COM context 0x14cff0 to COM context 0x14d218 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.

最佳答案

据我所知(查看 mscorwks 反汇编)它是一个 IObjContext*,从 CoGetContextToken() 返回.

基本上,它看起来像是使用 mscorwks!CtxEntry::EnterContextOle32BugAware() 中的 IContextCallback::ContextCallback() 排队的调用,后者又调用 mscorwks!CtxEntry::EnterContextCallback() 一旦对象上下文(公寓)处理了消息。他们使用 CLREvent 来表示回调完成。对于 STA 线程,不发送消息会导致事件等待超时,从而触发 ContextSwitchDeadlock MDA。

注意:我没有在调试器下运行它,所以我无法确认行为,但这可能相当准确。

关于com - 'COM context' MDA 消息中引用的 'ContextSwitchDeadlock' 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1158805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com