在VS 2010中使用VB.NET的基于Visio的应用程序
我们正在VS 2010中使用VB.NET开发基于Visio的应用程序.在此应用程序中,我们处理图形上的数百个形状.当试图(以编程方式)将数百个Visio形状添加到工程图时,我们遇到了问题.在图形上放置多个Visio形状时,我们使用的是Visio.ActivePage.DropMany和Visio.ActivePage.SetResults方法.添加少量形状时,我们不会出现此错误.下面是错误消息的详细信息:
检测到ContextSwitchDeadlock
消息:CLR在60秒钟内无法从COM上下文0x57ea58过渡到COM上下文0x57e830.拥有目标上下文/公寓的线程很可能要么执行非泵送等待,要么处理一个很长时间运行的操作而不泵送Windows消息.这种情况通常会对性能造成负面影响,甚至可能导致应用程序变得无响应或随着时间的推移不断累积内存使用量.为避免此问题,所有单线程单元(STA)线程应使用泵送等待原语(例如CoWaitForMultipleHandles),并在长时间运行的操作期间例行泵送消息.
We are developing a Visio based application using VB.NET in VS 2010. In this application, we deal with hundreds of shapes on the drawing. We are running into problem when trying to add hundreds of Visio shapes to drawing (programmaticaly). We are using Visio.ActivePage.DropMany and Visio.ActivePage.SetResults methods when dropping multiple Visio shapes on drawing. We don''t get this error when adding few shapes. Below is the error message in detail:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x57ea58 to COM context 0x57e830 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.
Did您尝试 Google [不要抽水等待或处理很长时间运行的操作而不抽水Windows消息. [ ^ ]
错误:线程拥有目标上下文/公寓的人很可能在做 [ CLR无法从COM上下文转换0xXXXXXX到COM上下文0xXXXXXX持续60秒 [ ^ ]
Did you try to Google[^] it? Best way to find some help for such issues is to Google and see if others faced something similar and what they shared.
Look at the following threads:
Non pumping wait or processing a very long running operation without pumping Windows messages.[^]
Error :The thread that owns the destination context/apartment is most likely either doing[^]
The CLR has been unable to transition from COM context 0xXXXXXX to COM context 0xXXXXXX for 60 seconds[^]
这无法解决我的问题:(
This couldn''t solve my issue :(