runtime: Deadlock with SystemEvents when application is shutdown
This is very similar to #62042.
The process is being shut down. There’s a window message processing thread for the system events (thread 6). Main thread (thread 0) is blocked on SystemEvents
code hooked on the ProcessExit
event. The SystemEvents.Shutdown
code runs in the finalizer thread (thread 9) and waits for the message processing thread to die. The message processing thread is blocked on Invoke
in SystemEvents.RaiseEvent
that can never finish.
Dump here.
Parallel stacks:
Shutdown thread:
Thread 0
TEB information is not available so a stack size of 0xFFFF is assumed
Current frame: win32u!NtUserMsgWaitForMultipleObjectsEx + 0xc
ChildEBP RetAddr Caller, Callee
053BEF04 7691fcef user32!RealMsgWaitForMultipleObjectsEx + 0x8f, calling win32u!NtUserMsgWaitForMultipleObjectsEx
053BEF6C 774c0e6c combase!CCliModalLoop::PeekRPCAndDDEMessage + 0x31 [onecore\com\combase\dcomrem\callctrl.cxx:2607], calling combase!CCliModalLoop::MyPeekMessage [onecore\com\combase\dcomrem\callctrl.cxx:2918]
053BEF78 7691fbfd user32!MsgWaitForMultipleObjectsEx + 0x4d, calling user32!RealMsgWaitForMultipleObjectsEx
053BEF9C 7748adc8 combase!CCliModalLoop::BlockFn + 0x14b [onecore\com\combase\dcomrem\callctrl.cxx:2156], calling user32!MsgWaitForMultipleObjectsEx
053BF01C 7749b574 combase!ClassicSTAThreadWaitForHandles + 0xb4 [onecore\com\combase\dcomrem\classicsta.cpp:54], calling combase!CCliModalLoop::BlockFn [onecore\com\combase\dcomrem\callctrl.cxx:2036]
053BF0CC 74960362 coreclr!GetCurrentThreadTypeNT5 + 0x11d [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:134], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF0D8 7749a987 combase!CoWaitForMultipleHandles + 0x77 [onecore\com\combase\dcomrem\sync.cxx:122], calling combase!ClassicSTAThreadWaitForHandles [onecore\com\combase\dcomrem\classicsta.cpp:38]
053BF104 74ac4324 coreclr!MsgWaitHelper + 0x38 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3351], calling combase!CoWaitForMultipleHandles [onecore\com\combase\dcomrem\sync.cxx:86]
053BF128 74a37dee coreclr!Thread::DoAppropriateAptStateWait + 0x16b515 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3389], calling coreclr!MsgWaitHelper [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3315]
053BF140 748cc72d coreclr!Thread::DoAppropriateWaitWorker + 0x111 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3526], calling coreclr!Thread::DoAppropriateAptStateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3378]
053BF1D0 748cc5c8 coreclr!Thread::DoAppropriateWait + 0x76 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3243], calling coreclr!Thread::DoAppropriateWaitWorker [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3447]
053BF240 748cc2c7 coreclr!CLREventBase::WaitEx + 0x3c [D:\a\_work\1\s\src\coreclr\vm\synch.cpp:462], calling coreclr!Thread::DoAppropriateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3217]
053BF264 748cbf31 coreclr!CLREventBase::Wait + 0x1a [D:\a\_work\1\s\src\coreclr\vm\synch.cpp:413], calling coreclr!CLREventBase::WaitEx [D:\a\_work\1\s\src\coreclr\vm\synch.cpp:417]
053BF274 77763230 KERNELBASE!SetEvent + 0x10, calling ntdll_77890000!NtSetEvent
053BF27C 74992287 coreclr!FinalizerThread::RaiseShutdownEvents + 0x45 [D:\a\_work\1\s\src\coreclr\vm\finalizerthread.h:64], calling coreclr!CLREventBase::Wait [D:\a\_work\1\s\src\coreclr\vm\synch.cpp:410]
053BF28C 74991931 coreclr!EEShutDownHelper + 0x2aa [D:\a\_work\1\s\src\coreclr\vm\ceemain.cpp:1310], calling coreclr!FinalizerThread::RaiseShutdownEvents [D:\a\_work\1\s\src\coreclr\vm\finalizerthread.h:52]
053BF2D8 7496a9bd coreclr!`anonymous namespace'::GetConfigDWORD + 0x23 [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:240], calling coreclr!`anonymous namespace'::EnvGetString [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:139]
053BF2E4 7496aa18 coreclr!`anonymous namespace'::GetConfigDWORD + 0x7e [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:256], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF318 7496aa18 coreclr!`anonymous namespace'::GetConfigDWORD + 0x7e [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:256], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF31C 7496a984 coreclr!CLRConfig::GetConfigValue + 0x1c [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:434], calling coreclr!`anonymous namespace'::GetConfigDWORD [D:\a\_work\1\s\src\coreclr\utilcode\clrconfig.cpp:222]
053BF33C 749757e0 coreclr!CorHost2::ExecuteAssembly + 0x190 [D:\a\_work\1\s\src\coreclr\vm\corhost.cpp:400], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF380 749207b2 coreclr!CrstBase::Leave + 0xa [D:\a\_work\1\s\src\coreclr\vm\crst.cpp:358], calling ntdll_77890000!RtlLeaveCriticalSection
053BF3B0 74992417 coreclr!AppDomainIterator::Next + 0x55 [D:\a\_work\1\s\src\coreclr\vm\appdomain.hpp:2987], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF3B4 749923ba coreclr!MulticoreJitManager::StopProfileAll + 0x50 [D:\a\_work\1\s\src\coreclr\vm\multicorejit.cpp:1499], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
053BF3E4 74991652 coreclr!EEShutDown + 0x66 [D:\a\_work\1\s\src\coreclr\vm\ceemain.cpp:1712], calling coreclr!EEShutDownHelper [D:\a\_work\1\s\src\coreclr\vm\ceemain.cpp:1215]
053BF414 74978206 coreclr!CorHost2::UnloadAppDomain2 + 0x36 [D:\a\_work\1\s\src\coreclr\vm\corhost.cpp:922], calling coreclr!EEShutDown [D:\a\_work\1\s\src\coreclr\vm\ceemain.cpp:1671]
053BF420 74978124 coreclr!coreclr_shutdown_2 + 0x54 [D:\a\_work\1\s\src\coreclr\dlls\mscoree\unixinterface.cpp:357]
Event processing thread:
Thread 9
TEB information is not available so a stack size of 0xFFFF is assumed
Current frame: ntdll_77890000!NtWaitForMultipleObjects + 0xc
ChildEBP RetAddr Caller, Callee
1421F394 77761963 KERNELBASE!WaitForMultipleObjectsEx + 0x133, calling ntdll_77890000!NtWaitForMultipleObjects
1421F3BC 777619a1 KERNELBASE!WaitForMultipleObjectsEx + 0x171, calling KERNELBASE!__security_check_cookie
1421F3DC 777619b9 KERNELBASE!WaitForMultipleObjectsEx + 0x189, calling ntdll_77890000!RtlActivateActivationContextUnsafeFast
1421F440 778ee1a9 ntdll_77890000!RtlSetLastWin32Error + 0x39, calling ntdll_77890000!__security_check_cookie
1421F44C 77478b35 combase!CObjectContext::QIHelper + 0x175 [onecore\com\combase\dcomrem\context.cxx:1724]
1421F468 774789b5 combase!CObjectContext::QueryInterface + 0x15 [onecore\com\combase\dcomrem\context.cxx:1538], calling combase!CObjectContext::QIHelper [onecore\com\combase\dcomrem\context.cxx:1644]
1421F47C 749603eb coreclr!SafeQueryInterface + 0x65 [D:\a\_work\1\s\src\coreclr\vm\interoputil.cpp:1146]
1421F4BC 774cb578 combase!CObjectContext::GetCurrentThreadType + 0x18 [onecore\com\combase\dcomrem\context.cxx:4492], calling combase!IsApartmentInitialized [onecore\com\combase\class\compobj.cxx:4115]
1421F4D0 74960338 coreclr!GetCurrentThreadTypeNT5 + 0xf3 [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:132]
1421F4D4 74960362 coreclr!GetCurrentThreadTypeNT5 + 0x11d [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:134], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
1421F510 74960362 coreclr!GetCurrentThreadTypeNT5 + 0x11d [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:134], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
1421F528 748cc912 coreclr!Thread::DoAppropriateAptStateWait + 0x39 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3394], calling KERNELBASE!WaitForMultipleObjectsEx
1421F548 748cc72d coreclr!Thread::DoAppropriateWaitWorker + 0x111 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3526], calling coreclr!Thread::DoAppropriateAptStateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3378]
1421F5D8 748cc5c8 coreclr!Thread::DoAppropriateWait + 0x76 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3243], calling coreclr!Thread::DoAppropriateWaitWorker [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3447]
1421F648 748cc262 coreclr!WaitHandleNative::CorWaitOneNative + 0x52 [D:\a\_work\1\s\src\coreclr\vm\comwaithandle.cpp:31], calling coreclr!Thread::DoAppropriateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3217]
1421F6C0 748cc23f coreclr!WaitHandleNative::CorWaitOneNative + 0x2f [D:\a\_work\1\s\src\coreclr\vm\comwaithandle.cpp:24], calling coreclr!LazyMachStateCaptureState
1421F6E8 148f54b4 (MethodDesc 0d51f51c + 0x74 System.Threading.WaitHandle.WaitOneNoCheck(Int32)), calling 748cc210 (stub for System.Threading.WaitHandle.WaitOneCore(IntPtr, Int32))
1421F71C 148f568f (MethodDesc 0d51f510 + 0xf System.Threading.WaitHandle.WaitOne(Int32)), calling (MethodDesc 0d51f51c + 0 System.Threading.WaitHandle.WaitOneNoCheck(Int32))
1421F72C 148f566b (MethodDesc 0d51f5b4 + 0xb System.Threading.WaitHandle.WaitOne(Int32, Boolean))
1421F734 148f34a4 (MethodDesc 0d43a394 + 0x1a4 System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle))
1421F784 148f2f02 (MethodDesc 0d43b058 + 0x28a System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)), calling (MethodDesc 0d43a394 + 0 System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle))
1421F818 148f2b81 (MethodDesc 0d43aefc + 0x49 System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])), calling 1490af50
1421F854 148f2a9f (MethodDesc 117f2f08 + 0xaf System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)), calling 1490af3c
1421F880 148f29a0 (MethodDesc 11b799b0 + 0x70 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[]))
1421F8B4 148f272d (MethodDesc 11b79278 + 0xed Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[])), calling 1490af00
1421F908 148f2625 (MethodDesc 11b79268 + 0x1d Microsoft.Win32.SystemEvents.RaiseEvent(System.Object, System.Object[])), calling (MethodDesc 11b79278 + 0 Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[]))
1421F91C 148f28dd (MethodDesc 11b79238 + 0x8d Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr, IntPtr)), calling 1490ae9c
1421F93C 1180ece2 (MethodDesc 11b792b8 + 0x33a Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)), calling 1490aeb0
1421F954 76938cf3 user32!_InternalCallWinProc + 0x2b
1421F9C4 1180e979 (MethodDesc 11b7b60c + 0x41 ILStubClass.IL_STUB_ReversePInvoke(Int32, Int32, Int32, Int32))
1421F9EC 777649c0 KERNELBASE!GetProcessMitigationPolicy + 0xc0, calling ntdll_77890000!NtQueryInformationProcess
1421FA08 76938cf3 user32!_InternalCallWinProc + 0x2b
1421FA34 769193da user32!UserCallWinProcCheckWow + 0x4aa, calling user32!_InternalCallWinProc
1421FA78 769190b3 user32!UserCallWinProcCheckWow + 0x183, calling ntdll_77890000!RtlActivateActivationContextUnsafeFast
1421FA98 76920c56 user32!CallHookWithSEH + 0x2a
1421FB24 76917ee5 user32!DispatchMessageWorker + 0x4c5, calling user32!UserCallWinProcCheckWow
1421FB64 74941460 coreclr!NDirectImportWorker + 0x6b [D:\a\_work\1\s\src\coreclr\vm\dllimport.cpp:6081], calling ntdll_77890000!RtlSetLastWin32Error
1421FBA0 76917a10 user32!DispatchMessageW + 0x10, calling user32!DispatchMessageWorker
1421FBAC 1180dd0a (MethodDesc 11b792c8 + 0xea Microsoft.Win32.SystemEvents.WindowThreadProc()), calling user32!DispatchMessageW
1421FBC8 1180dd0a (MethodDesc 11b792c8 + 0xea Microsoft.Win32.SystemEvents.WindowThreadProc()), calling user32!DispatchMessageW
1421FC28 732d75f1 (MethodDesc 11b7a660 + 0x31 System.Threading.Thread+StartHelper.Callback(System.Object))
1421FC38 732dfb51 (MethodDesc 113f83d8 + 0x51 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object))
1421FC48 749cc1dd coreclr!ThePreStub + 0x11, calling coreclr!PreStubWorker [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp:1955]
1421FC6C 732d65f2 (MethodDesc 0793f238 + 0x72 System.Threading.Thread.StartCallback()), calling System_Private_CoreLib + 0x44e9a8
1421FC80 749cbecf coreclr!CallDescrWorkerInternal + 0x34
1421FC8C 749149da coreclr!CallDescrWorkerWithHandler + 0x66 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:69], calling coreclr!CallDescrWorkerInternal
1421FCA0 749149a9 coreclr!CallDescrWorkerWithHandler + 0x35 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:65], calling coreclr!_chkstk [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\misc\i386\chkstk.asm:65]
1421FCC0 74932d7b coreclr!DispatchCallSimple + 0x7f [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:220], calling coreclr!CallDescrWorkerWithHandler [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:54]
1421FD08 749b6e8b coreclr!ThreadNative::KickOffThread_Worker + 0x4b [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:158], calling coreclr!DispatchCallSimple [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:173]
1421FD2C 74934e6f coreclr!ManagedThreadBase_DispatchMiddle + 0x8c [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:7365]
1421FD70 748ca122 coreclr!Thread::HasStarted + 0x444 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:1986], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
1421FDB0 74934d9f coreclr!ManagedThreadBase_DispatchOuter + 0x62 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:7543], calling coreclr!ManagedThreadBase_DispatchMiddle [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:7325]
1421FDE8 748c9ade coreclr!ThreadNative::KickOffThread + 0x4e [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:207], calling coreclr!EventPipeHelper::IsEnabled [D:\a\_work\1\s\src\coreclr\vm\eventtrace.cpp:7862]
1421FE08 748c9b0f coreclr!ThreadNative::KickOffThread + 0x7f [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:230], calling coreclr!ManagedThreadBase_DispatchOuter [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:7476]
1421FE3C 76816709 kernel32!BaseThreadInitThunk + 0x19
1421FE4C 778f7d1d ntdll_77890000!__RtlUserThreadStart + 0x2b
1421FEA4 778f7ceb ntdll_77890000!_RtlUserThreadStart + 0x1b, calling ntdll_77890000!__RtlUserThreadStart
Finalizer thread:
Thread 6
TEB information is not available so a stack size of 0xFFFF is assumed
Current frame: ntdll_77890000!NtWaitForMultipleObjects + 0xc
ChildEBP RetAddr Caller, Callee
0ADAF8C4 77761963 KERNELBASE!WaitForMultipleObjectsEx + 0x133, calling ntdll_77890000!NtWaitForMultipleObjects
0ADAF90C 777619b9 KERNELBASE!WaitForMultipleObjectsEx + 0x189, calling ntdll_77890000!RtlActivateActivationContextUnsafeFast
0ADAF93C 7490f1f4 coreclr!MemberLoader::GetMethodDescFromMethodDef + 0x48 [D:\a\_work\1\s\src\coreclr\vm\memberload.cpp:640], calling coreclr!MethodDesc::CheckRestore [D:\a\_work\1\s\src\coreclr\vm\method.cpp:3953]
0ADAF944 7490f080 coreclr!MethodDesc::EnsureActive + 0x4a [D:\a\_work\1\s\src\coreclr\vm\method.cpp:209], calling coreclr!DomainFile::EnsureLoadLevel [D:\a\_work\1\s\src\coreclr\vm\domainfile.cpp:112]
0ADAF950 778ee1a9 ntdll_77890000!RtlSetLastWin32Error + 0x39, calling ntdll_77890000!__security_check_cookie
0ADAF95C 74910b85 coreclr!TransitionFrame::GetReturnAddressPtr + 0x15 [D:\a\_work\1\s\src\coreclr\vm\frames.h:943]
0ADAF970 749102a4 coreclr!ExternalMethodFixupWorker + 0x4c4 [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp:2814], calling ntdll_77890000!RtlSetLastWin32Error
0ADAF97C 77478b35 combase!CObjectContext::QIHelper + 0x175 [onecore\com\combase\dcomrem\context.cxx:1724]
0ADAF998 774789b5 combase!CObjectContext::QueryInterface + 0x15 [onecore\com\combase\dcomrem\context.cxx:1538], calling combase!CObjectContext::QIHelper [onecore\com\combase\dcomrem\context.cxx:1644]
0ADAF9AC 749603eb coreclr!SafeQueryInterface + 0x65 [D:\a\_work\1\s\src\coreclr\vm\interoputil.cpp:1146]
0ADAF9EC 774cb578 combase!CObjectContext::GetCurrentThreadType + 0x18 [onecore\com\combase\dcomrem\context.cxx:4492], calling combase!IsApartmentInitialized [onecore\com\combase\class\compobj.cxx:4115]
0ADAFA00 74960338 coreclr!GetCurrentThreadTypeNT5 + 0xf3 [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:132]
0ADAFA04 74960362 coreclr!GetCurrentThreadTypeNT5 + 0x11d [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:134], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
0ADAFA40 74960362 coreclr!GetCurrentThreadTypeNT5 + 0x11d [D:\a\_work\1\s\src\coreclr\vm\olecontexthelpers.cpp:134], calling coreclr!_EH_epilog3 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\eh\i386\ehprolg3.c:529]
0ADAFA58 748cc912 coreclr!Thread::DoAppropriateAptStateWait + 0x39 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3394], calling KERNELBASE!WaitForMultipleObjectsEx
0ADAFA78 748cc72d coreclr!Thread::DoAppropriateWaitWorker + 0x111 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3526], calling coreclr!Thread::DoAppropriateAptStateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3378]
0ADAFB08 748cc5c8 coreclr!Thread::DoAppropriateWait + 0x76 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3243], calling coreclr!Thread::DoAppropriateWaitWorker [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3447]
0ADAFB78 749b1858 coreclr!Thread::JoinEx + 0x53 [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:447], calling coreclr!Thread::DoAppropriateWait [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:3217]
0ADAFBA4 749b170d coreclr!ThreadNative::DoJoin + 0xbd [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:889], calling coreclr!Thread::JoinEx [D:\a\_work\1\s\src\coreclr\vm\threads.cpp:419]
0ADAFBE4 749b1624 coreclr!ThreadNative::Join + 0x64 [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:454], calling coreclr!ThreadNative::DoJoin [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:835]
0ADAFC44 749b15f5 coreclr!ThreadNative::Join + 0x35 [D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:445], calling coreclr!LazyMachStateCaptureState
0ADAFC50 749cc1dd coreclr!ThePreStub + 0x11, calling coreclr!PreStubWorker [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp:1955]
0ADAFC74 732d72db (MethodDesc 0793f88c + 0xb System.Threading.Thread.Join()), calling System_Private_CoreLib + 0x44e9a8
0ADAFC78 148f5220 (MethodDesc 11b79298 + 0xa0 Microsoft.Win32.SystemEvents.Shutdown()), calling 1490b1d0
0ADAFCA4 148f5169 (MethodDesc 11b792a8 + 0x11 Microsoft.Win32.SystemEvents.Shutdown(System.Object, System.EventArgs)), calling 1490b1bc
0ADAFCB4 0570d228 0570d228
0ADAFCE4 732122b5 (MethodDesc 07940258 + 0x55 System.AppContext.OnProcessExit())
0ADAFCF8 749cbecf coreclr!CallDescrWorkerInternal + 0x34
0ADAFD04 749149da coreclr!CallDescrWorkerWithHandler + 0x66 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:69], calling coreclr!CallDescrWorkerInternal
0ADAFD18 749149a9 coreclr!CallDescrWorkerWithHandler + 0x35 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:65], calling coreclr!_chkstk [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\misc\i386\chkstk.asm:65]
0ADAFD38 74915bba coreclr!MethodDescCallSite::CallTargetWorker + 0xe7 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:551], calling coreclr!CallDescrWorkerWithHandler [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:54]
0ADAFD3C 74916477 coreclr!ArgIteratorTemplate<ArgIteratorBase>::ComputeReturnFlags + 0x1b [D:\a\_work\1\s\src\coreclr\vm\callingconvention.h:1549], calling coreclr!MetaSig::GetReturnTypeNormalized [D:\a\_work\1\s\src\coreclr\vm\siginfo.cpp:5204]
0ADAFD58 74915b21 coreclr!MethodDescCallSite::CallTargetWorker + 0x4e [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:384], calling coreclr!_alloca_probe_16 [d:\a01\_work\11\s\src\vctools\crt\vcstartup\src\misc\i386\alloca16.asm:44]
0ADAFD90 74936e1b coreclr!MethodDescCallSite::MethodDescCallSite + 0x3e [D:\a\_work\1\s\src\coreclr\vm\callhelpers.h:174], calling coreclr!MethodDesc::GetCallTarget [D:\a\_work\1\s\src\coreclr\vm\method.cpp:2206]
0ADAFD98 74936e26 coreclr!MethodDescCallSite::MethodDescCallSite + 0x49 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.h:175], calling coreclr!ArgIteratorTemplate<ArgIteratorBase>::ForceSigWalk [D:\a\_work\1\s\src\coreclr\vm\callingconvention.h:1652]
0ADAFDAC 749bf1b6 coreclr!AppDomain::RaiseExitProcessEvent + 0x2d [D:\a\_work\1\s\src\coreclr\vm\appdomain.cpp:4294], calling coreclr!MethodDescCallSite::CallTargetWorker [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp:262]
0ADAFE3C 749bf155 coreclr!FinalizerThread::FinalizerThreadStart + 0x65 [D:\a\_work\1\s\src\coreclr\vm\finalizerthread.cpp:401], calling coreclr!AppDomain::RaiseExitProcessEvent [D:\a\_work\1\s\src\coreclr\vm\appdomain.cpp:4279]
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (14 by maintainers)
Not really. I don’t fully understand why SystemEventInvokeInfo.Invoke uses
Send
on the synchronization context. I would have expectedPost
to be sufficient since it still guarantees ordering but doesn’t block the event processing thread. If there is a requirement to block the thread, it would still make sense to change toPost
but with additional logic that waits both for thePost
to finish or the shutdown to be signalled (the crucial missing part).That may work but I am not sure what would be the consequences.
The UI thread is the one where the application shutdown was initialized. It’s now deep inside the CoreCLR shutdown sequence and definitely not pumping messages.
There are two possible scenarios here:
Application.Run
, which can happen for numerous reasons (eg. you bail out on early app logic initialization error, show message box, and try to exit).SynchronizationContext.Send
call still waits for the message to be processed but that can never happen.