> I'm facing odd hang-ups in a mixed unmanaged/Win Form app (actually this is
> a VS 2005 with a managed add-in loaded)
> that I think might be of interest here. The stack trace of the UI thread
> (captured using WinDbg) is posted below. Basically,
> what is happening here is some system event
> (Microsoft.Win32.SystemEvents.OnUserPreferenceChanged) being dispatched and
> handled via Control.MarshaledInvoke. However, the latter seems to never
> return. From the user perspective, the application
> appears to be unresponsive (i.e. it doesn't react to keyboard input), but it
> paints its windows, as WM_PAINT messages seem
> to be passed via the message filter in the CoWaitForMultipleHandles (I
> checked this by breaking in a WndProc of one of the windows).

Unfortunately, I have no experience with VS 2005 addins, so I can only
analyze the stack trace. For me, it looks like the
UserPreferenceChanged event needs to be handled on a UI thread, so it
is posted via a synchronization context and a control's Invoke method.
This is synchronous, i.e. Invoke waits until the posted message has
been handled, forever, as it seems.

Invoke definitely seems to think it is dealing with a UI thread that
differs from the current thread, so if this is true, the target UI
thread seems to be blocked somehow; this should be analyzed. If it is
not true and Invoke is posting the event to the same thread, this
would seem like a bug.

Fabian

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to