tags:

views:

34

answers:

1

I am trying to debug a .NET 3.5 application which uses WPF. On most of our machines the application launches fine, but we have a single machine on which the application hangs on the first .Show(). The process seems to spin with full CPU usage, and eventually (if I'm attached with a debugger) I get:

Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'D:\Projects....\foobar.exe'. Additional Information: The CLR has been unable to transition from COM context 0x1aa168 to COM context 0x1a9ff8 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.

I apologise for any transcription errors above, I cannot copy paste the text.

The system on which this occurs is running Windows XP SP3. We have other systems with Windows XP SP3 on which our software runs fine.

The callstack at the point of the hang looks like this:

[External Code]
PresentationNative_v0300.dll!FetchRun() + 0x90 bytes PresentationNative_v0300.dll!_LsSetParaProperties@24() + 0x71 bytes
PresentationNative_v0300.dll!_LsCreateLineCore@44() + 0x12c bytes
PresentationNative_v0300.dll!_LoCreateLine@40() + 0x85 bytes foobar.exe!FooBar.Window1.Window1() Line 109 + 0x10 bytes C# [External Code]
user32.dll!_InternalCallWinProc@20() + 0x28 bytes
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
user32.dll!_DispatchMessageWorker@8() + 0xdc bytes
user32.dll!DispatchMessageW@4() + 0xf bytes mscoree.dll!_CorExeMain@0() + 0x32 bytes
mscoree.dll!ShellShim_CorExeMain@0() + 0x3a4e bytes
mscoree.dll!__CorExeMain_Exported@0() + 0x8 bytes
kernel32.dll!_BaseProcessStart@4() + 0x23 bytes

Does anyone have any ideas what can cause this?

I will attempt to reinstall .NET 3.5 shortly, but to be honest we are clutching at straws.

A: 

http://wpfwonderland.wordpress.com/2007/08/16/clr-has-been-unable-to-transition-from-com-context-for-60-seconds/

This will help you from breaking the execution. But, you need to profile further and fix the issue.

HTH

Avatar