views:

162

answers:

2

Hi,

Is it possible to get a context deadlock switching exception in a windows service?

JD.

A: 

Check your service ported code and make sure you have removed all UI code such as calls to MessageBoxes.

Mitch Wheat
A: 

According to this article ...

The most common symptom is that a call on an unmanaged COM component from managed code does not return.

Are you calling out to a COM component that takes a long time to return from an STAThread? If so, consider using a separate thread to do the call out to the COM component and then marshaling the return value across to the STAThread.

JP Alioto
It is the third party libraries I am using that cause the Context switch deadlock, so I am not sure to check if they are using COM components.
JD