Hi there,

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).



I did some search in the Web, and it looks like a similar problem was in
.NET 1.1 and reproduced on multiprocessor machines. However,  I don't see

it being reported for .NET 2.0, and I'm running .NET 2.0 Framework on a
hyper-threaded workstation. Has anybody else here encountered this issue or

heard about it? I observe such hang-ups on a regular basis, so knowing its
origins is important for me.



Thanks for any ideas.

Regards,
Dmitry Shaporenkov


P.S. Here is the stack trace:

--------------------------------------------------------------

Thread 0

Current frame: ntdll!KiFastSystemCallRet

ChildEBP RetAddr Caller,Callee

0012f34c 7c90e9ab ntdll!ZwWaitForMultipleObjects+0xc

0012f350 7c8094f2 kernel32!WaitForMultipleObjectsEx+0x12c, calling
ntdll!ZwWaitForMultipleObjects

0012f38c 77d49402 USER32!PeekMessageW+0xbc, calling USER32!_PeekMessage

0012f3dc 7c8399f3 kernel32!_except_handler3

0012f3ec 77d495f9 USER32!RealMsgWaitForMultipleObjectsEx+0x13e, calling
kernel32!WaitForMultipleObjectsEx

0012f41c 77512744 ole32!CoUnmarshalInterface+0x18f1, calling
ole32!CoUnmarshalInterface+0x1887

0012f448 77512235 ole32!CoUnmarshalInterface+0x13e2, calling
USER32!MsgWaitForMultipleObjectsEx

0012f470 77557227 ole32!CoWaitForMultipleHandles+0xe6, calling
ole32!CoUnmarshalInterface+0x136c

0012f4e4 79f27b88 mscorwks!NT5WaitRoutine+0x51, calling
ole32!CoWaitForMultipleHandles

0012f4fc 79f17565 mscorwks!Thread::GetFinalApartment+0x8d, calling
mscorwks!_EH_epilog3

0012f504 79f27acf mscorwks!MsgWaitHelper+0xa5, calling
mscorwks!NT5WaitRoutine

0012f558 79f17565 mscorwks!Thread::GetFinalApartment+0x8d, calling
mscorwks!_EH_epilog3

0012f570 79f27a33 mscorwks!Thread::DoAppropriateAptStateWait+0x28, calling
mscorwks!MsgWaitHelper

0012f590 79f17493 mscorwks!Thread::DoAppropriateWaitWorker+0x144, calling
mscorwks!Thread::DoAppropriateAptStateWait

0012f614 79f1732f mscorwks!Thread::DoAppropriateWait+0x40, calling
mscorwks!Thread::DoAppropriateWaitWorker

0012f64c 79ef5723 mscorwks!AcquireSafeHandle+0x35, calling
mscorwks!_EH_epilog3

0012f664 7a07b49c mscorwks!WaitHandleNative::CorWaitOneNative+0x14e, calling
mscorwks!Thread::DoAppropriateWait

0012f6a0 79e74ebd mscorwks!HelperMethodFrame::LazyInit+0x17, calling
(JitHelp: CORINFO_HELP_GET_THREAD)

0012f6a8 79e74ea0 mscorwks!HelperMethodFrame::HelperMethodFrame+0x1d,
calling mscorwks!HelperMethodFrame::LazyInit

0012f6ac 7a2cd629 mscorwks!AppDomainNative::IsFinalizingForUnload, calling
mscorwks!UnwindAndContinueRethrowHelperAfterCatch

0012f6c0 7a07b2dd mscorwks!WaitHandleNative::CorWaitOneNative+0x21, calling
mscorwks!LazyMachStateCaptureState

0012f6d0 7a2cd629 mscorwks!AppDomainNative::IsFinalizingForUnload, calling
mscorwks!UnwindAndContinueRethrowHelperAfterCatch

0012f710 79e7bba9 mscorwks!PreStubWorker+0x130, calling
ntdll!RtlSetLastWin32Error

0012f720 7c8229bd kernel32!GetExitCodeThread+0x1b, calling
ntdll!ZwQueryInformationThread

0012f768 793d424e (MethodDesc 0x7924ad68 +0x2e
System.Threading.WaitHandle.WaitOne(Int64, Boolean)), calling
mscorwks!WaitHandleNative::CorWaitOneNative

0012f780 793d4193 (MethodDesc 0x7924ad50 +0x23
System.Threading.WaitHandle.WaitOne(Int32, Boolean)), calling (MethodDesc
0x7924ad68 +0 System.Threading.WaitHandle.WaitOne(Int64, Boolean))

0012f794 7b0caa0d (MethodDesc 0x7b5a5af8 +0xa1
System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle))

0012f7a8 7b3fab19 (MethodDesc 0x7b4a6468
System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control,
System.Delegate, System.Object[], Boolean)), calling (MethodDesc 0x7b5a5af8
+0
System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle))

0012f7c0 7b06e6a4 (MethodDesc 0x7b4a6468 +0x108
System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control,
System.Delegate, System.Object[], Boolean)), calling
kernel32!GetCurrentThreadId

0012f7c4 7a07dec3 mscorwks!ThreadNative::IsAlive+0x5f, calling
mscorwks!FrameWithCookie<HelperMethodFrame_1OBJ>::FrameWithCookie<HelperMeth
odFrame_1OBJ>

0012f7d4 7a07de96 mscorwks!ThreadNative::IsAlive+0x153, calling
mscorwks!_EH_epilog3

0012f838 7b05f6b4 (MethodDesc 0x7b4a6448 +0x48
System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])),
calling 7b64ef40

0012f874 7b318ff5 (MethodDesc 0x7b5ab248 +0x61
System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threadin
g.SendOrPostCallback, System.Object))

0012f888 7a52a1c4 (MethodDesc 0x7a8012c8 +0x68
Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean,
System.Object[]))

0012f89c 79eedb39 mscorwks!SystemNative::ArrayCopy+0x4f9, calling
mscorwks!_EH_epilog3

0012f8bc 7a529d4a (MethodDesc 0x7a7ffec0 +0x106
Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object,
System.Object[])), calling (MethodDesc 0x7a8012c8 +0
Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean,
System.Object[]))

0012f8e4 7b07552c (MethodDesc 0x7b4a63c0 +0xc
System.Windows.Forms.Control.DefWndProc(System.Windows.Forms.Message
ByRef)), calling 7b64f510

0012f908 7a5292bf (MethodDesc 0x7a7ffe68 +0x6f
Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr,
IntPtr)), calling (MethodDesc 0x7a7ffec0 +0
Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object,
System.Object[]))

0012f920 7a4a7c68 (MethodDesc 0x7a7ffee0 +0x308
Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)),
calling (MethodDesc 0x7a7ffe68 +0
Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr, IntPtr))

0012f9a4 003c3c54 003c3c54

0012f9c8 77d48734 USER32!InternalCallWinProc+0x28

0012f9f4 77d48816 USER32!UserCallWinProcCheckWow+0x150, calling
USER32!InternalCallWinProc

0012fa5c 77d489cd USER32!DispatchMessageWorker+0x306, calling
USER32!UserCallWinProcCheckWow

0012fabc 77d48a10 USER32!DispatchMessageW+0xf, calling
USER32!DispatchMessageWorker

0012facc 5008b9a8 msenv!EnvironmentMsgLoop+0x294, calling
USER32!DispatchMessageW

0012fb04 500cd542 msenv!CMsoCMHandler::FPushMessageLoop+0x1f, calling
msenv!EnvironmentMsgLoop

0012fb18 500cd4e9 msenv!SCM::FPushMessageLoop+0xb2

0012fb40 500cd487 msenv!SCM_MsoCompMgr::FPushMessageLoop+0x27, calling
msenv!SCM::FPushMessageLoop

0012fb58 500cd458 msenv!CMsoComponent::PushMsgLoop+0x25

0012fb74 500cd3c2 msenv!VStudioMainLogged+0x42e, calling
msenv!CMsoComponent::PushMsgLoop

0012fba0 500c1aeb msenv!CVsActivityLogSingleton::Instance+0xdf, calling
msenv!_EH_epilog3

0012fba4 50004ddc msenv!VActivityLogStartupEntries+0x40

0012fbbc 7c8399f3 kernel32!_except_handler3

0012fbc8 7c80cb22 kernel32!InternalFindAtom+0x126, calling
kernel32!_SEH_epilog

0012fbcc 7c839970 kernel32!FindAtomW+0x11, calling kernel32!InternalFindAtom

0012fbf4 0040952e devenv!util_CallVsMain+0x149

0012fc2c 0040685f devenv!CDevEnvAppId::Run+0x84e, calling
devenv!util_CallVsMain

0012fd5c 7c919a9c ntdll!LdrpGetProcedureAddress+0x186, calling
ntdll!LdrpSnapThunk

0012fd74 7c919b3f ntdll!LdrpGetProcedureAddress+0x29b, calling
ntdll!RtlLeaveCriticalSection

0012fd7c 7c919aeb ntdll!LdrpGetProcedureAddress+0xa6, calling
ntdll!_SEH_epilog

0012fe24 7c919aeb ntdll!LdrpGetProcedureAddress+0xa6, calling
ntdll!_SEH_epilog

0012fe28 7c919ba0 ntdll!LdrGetProcedureAddress+0x18, calling
ntdll!LdrpGetProcedureAddress

0012fe44 7c80ac66 kernel32!GetProcAddress+0x43, calling
ntdll!LdrGetProcedureAddress

0012fe4c 7c80ac78 kernel32!GetProcAddress+0x5b, calling
kernel32!BasepMapModuleHandle

0012fe6c 00401d34 devenv!util_GetUnicodeCommandLine+0xa4, calling
MSVCR80!wcspbrk

0012fe7c 00401d7d devenv!util_GetUnicodeCommandLine+0x117, calling
devenv!__security_check_cookie

0012ff18 00406a3c devenv!WinMain+0x68, calling devenv!CDevEnvAppId::Run

0012ff30 00406aa9 devenv!operator new[]+0x190, calling devenv!WinMain

0012ffc0 7c816d4f kernel32!BaseProcessStart+0x23

0012ffe0 7c8399f3 kernel32!_except_handler3




===================================
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