Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.12] Crash when persisting a defterm window #11354

Closed
zadjii-msft opened this issue Sep 28, 2021 · 16 comments
Closed

[1.12] Crash when persisting a defterm window #11354

zadjii-msft opened this issue Sep 28, 2021 · 16 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. Severity-Crash Crashes are real bad news.

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented Sep 28, 2021

discovered in the 1.12 bug bash on 9/28

  • Enable window persisting.
  • Open a couple Terminal windows, then launch pwsh so that it opens as a new defterm window.
  • "Quit" the terminal.
  • You'll get a crash like the one below:
Details
0:000> k
 # Child-SP          RetAddr               Call Site
00 (Inline Function) --------`--------     Windows_UI_Xaml!ctl::ComObjectBase::QueryInterfaceBase+0x9 [onecoreuap\windows\dxaml\xcp\components\com\comobjectbase.cpp @ 36] 
01 000000f3`c4bde9a0 00007ff9`0c2b91df     Windows_UI_Xaml!ctl::ComObject<DirectUI::ContentControl>::QueryInterface+0x11 [onecoreuap\windows\dxaml\xcp\components\com\inc\ComObject.h @ 36] 
02 000000f3`c4bde9d0 00007ff8`deb3f1d7     Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x4f [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35] 
03 000000f3`c4bdea00 00007ff8`deaea933     Microsoft_UI_Xaml!DllGetActivationFactory+0x633c7
04 000000f3`c4bdea40 00007ff8`deb37266     Microsoft_UI_Xaml!DllGetActivationFactory+0xeb23
05 000000f3`c4bdea70 00007ff8`deb37234     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b456
06 000000f3`c4bdeaa0 00007ff8`deaaadc4     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424
07 000000f3`c4bdead0 00007ff9`0c1c3d34     Microsoft_UI_Xaml+0x2adc4
08 (Inline Function) --------`--------     Windows_UI_Xaml!ctl::release_interface_nonull+0x1a [onecoreuap\windows\dxaml\xcp\components\com\inc\ComUtils.h @ 152] 
09 000000f3`c4bdeb00 00007ff9`0c1c260f     Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4 [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697] 
0a (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::TrackerPtr<IInspectable,1,0>::Clear+0xd [onecoreuap\windows\dxaml\xcp\components\lifetime\inc\TrackerPtr.h @ 267] 
0b (Inline Function) --------`--------     Windows_UI_Xaml!ctl::WeakReferenceSourceNoThreadId::RemovePtrValue+0x17b [onecoreuap\windows\dxaml\xcp\components\lifetime\inc\WeakReferenceSourceNoThreadId.h @ 233] 
0c 000000f3`c4bdeb80 00007ff9`0c1c21c9     Windows_UI_Xaml!DirectUI::DependencyObject::ClearPeerReferences+0x23f [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 757] 
0d 000000f3`c4bdebc0 00007ff9`0c28b434     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0x29 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 493] 
0e (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeer+0x2e [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 547] 
0f (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x2e [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639] 
10 000000f3`c4bdebf0 00007ff9`0c28ab89     Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x1b4 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891] 
11 000000f3`c4bdec90 00007ff9`0c28a26a     Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925] 
12 000000f3`c4bded00 00007ff9`0c289abb     Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x172 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039] 
13 000000f3`c4bded30 00007ff9`0c288412     Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8f [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105] 
14 000000f3`c4bded60 00007ff9`0c3f6f93     Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0x122 [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346] 
15 (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::WindowsXamlManager::EnqueueClose::__l2::<lambda_fb82c00b6d7c6024e3fa60b065facdab>::operator()+0x9 [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 298] 
16 000000f3`c4bdedc0 00007ff9`40e09ca0     Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_fb82c00b6d7c6024e3fa60b065facdab> &,-1>::Invoke+0x13 [onecore\external\sdk\inc\wrl\event.h @ 354] 
17 000000f3`c4bdedf0 00007ff9`40dabba0     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911] 
18 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
19 000000f3`c4bdee20 00007ff9`40dabaf1     CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c [CFlatCorlib\1.0.210714011\CFlatCorlib\SehSafe.inl @ 11] 
1a 000000f3`c4bdee50 00007ff9`40dcaf83     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1 [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
1b (Inline Function) --------`--------     CoreMessaging!CFlat::DelegateImpl<Microsoft::CoreUI::ActionCallback,0,void __cdecl(void),long __cdecl(void *),0>::Invoke+0x22 [CFlatCorlib\1.0.210714011\CFlatCorlib\Delegate.h @ 337] 
1c 000000f3`c4bdeea0 00007ff9`40dc9d15     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3 [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62] 
1d 000000f3`c4bdef60 00007ff9`40dcbb7e     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5 [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379] 
1e (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x447 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 968] 
1f (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x4b0 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 504] 
20 000000f3`c4bdefb0 00007ff9`40dc82e6     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 654] 
21 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x1db [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 774] 
22 000000f3`c4bdf0a0 00007ff9`40e1458a     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108] 
23 000000f3`c4bdf130 00007ff9`40e1c43d     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045] 
24 000000f3`c4bdf170 00007ff9`40e1c4d1     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201] 
25 000000f3`c4bdf1c0 00007ff9`40de291c     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171] 
26 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x99 [mincore\coreui\dev\system\Dispatch\minwin\UserAdapterN.cpp @ 505] 
27 000000f3`c4bdf1f0 00007ff9`46683b38     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110] 
28 000000f3`c4bdf260 00007ff9`4668368c     user32!UserCallWinProcCheckWow+0x338 [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282] 
29 000000f3`c4bdf3d0 00007ff9`46696b2a     user32!DispatchClientMessage+0x9c [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3435] 
2a 000000f3`c4bdf430 00007ff9`469098f4     user32!__fnDWORD+0x3a [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214] 
2b 000000f3`c4bdf490 00007ff9`43db13b4     ntdll!KiUserCallbackDispatcherContinue [minkernel\ntos\rtl\amd64\trampoln.asm @ 607] 
2c 000000f3`c4bdf518 00007ff9`46691b96     win32u!ZwUserPeekMessage+0x14 [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165] 
2d 000000f3`c4bdf520 00007ff9`46691a8a     user32!_PeekMessage+0xb6 [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930] 
2e 000000f3`c4bdf590 00007ff9`37ea14f5     user32!PeekMessageW+0x13a [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761] 
2f 000000f3`c4bdf600 00007ff9`37ea39b9     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75] 
30 000000f3`c4bdf690 00007ff7`90643703     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080] 
31 (Inline Function) --------`--------     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x45 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
32 000000f3`c4bdf6c0 00007ff7`90635c85     WindowsTerminal!AppHost::~AppHost+0x93 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 106] 
33 000000f3`c4bdf700 00007ff7`9062cc42     WindowsTerminal!wWinMain+0xd2b5 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\main.cpp @ 199] 
34 (Inline Function) --------`--------     WindowsTerminal!invoke_main+0x21 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118] 
35 000000f3`c4bdf920 00007ff9`454a6d50     WindowsTerminal!__scrt_common_main_seh+0x106 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
36 000000f3`c4bdf960 00007ff9`46864c6b     KERNEL32!BaseThreadInitThunk+0x10 [clientcore\base\win32\client\thread.c @ 75] 
37 000000f3`c4bdf990 00000000`00000000     ntdll!RtlUserThreadStart+0x2b [minkernel\ntdll\rtlstrt.c @ 1152] 

See also: #11083, #9800

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Settings Issues related to settings and customizability, for console or terminal Severity-Crash Crashes are real bad news. Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. Priority-1 A description (P1) labels Sep 28, 2021
@zadjii-msft zadjii-msft added this to the Terminal v1.12 milestone Sep 28, 2021
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Sep 28, 2021
@ianjoneill
Copy link
Contributor

ianjoneill commented Sep 29, 2021

I'm also seeing a crash on exit sometimes, but my machine's running Windows 10 (so don't have defterm enabled) and I don't have window persisting enabled either.

I'm on commit 2be394f.

The stacktrace looks similar (it's difficult to compare as the one above isn't formatted - you need to put a blank line between the <details> and the opening of the code block) but not the exactly the same - I can create a separate issue if you prefer. Later I'll try updating to the latest code on main to see if that makes a difference.

0:000> k
 # Child-SP          RetAddr               Call Site
00 000000d2`b070ec10 00007fff`fd683ab8     Windows_UI_Xaml!std::pair<void *,ctl::WeakRefPtr>::operator=<std::pair<void *,ctl::WeakRefPtr>,0>+0x6 [onecore\internal\sdk\inc\ucrt\stl120\utility @ 198] 
01 000000d2`b070ec40 00007fff`fd682e18     Windows_UI_Xaml!std::_Move_unchecked<std::pair<void *,ctl::WeakRefPtr> *,std::pair<void *,ctl::WeakRefPtr> *>+0x28 [onecore\internal\sdk\inc\ucrt\stl120\xutility @ 2086] 
02 (Inline Function) --------`--------     Windows_UI_Xaml!std::vector<std::pair<void *,ctl::WeakRefPtr>,std::allocator<std::pair<void *,ctl::WeakRefPtr> > >::erase+0x9 [onecore\internal\sdk\inc\ucrt\stl120\vector @ 1212] 
03 (Inline Function) --------`--------     Windows_UI_Xaml!containers::detail::vector_tree<containers::detail::map_traits<void *,ctl::WeakRefPtr,std::less<void>,std::allocator<std::pair<void *,ctl::WeakRefPtr> >,0> >::erase+0x9 [onecoreuap\windows\dxaml\xcp\components\base\inc\vector_tree.h @ 306] 
04 000000d2`b070ec70 00007fff`fd682d8f     Windows_UI_Xaml!DirectUI::DXamlCore::UnregisterLayoutUpdatedEventSource+0x60 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1887] 
05 000000d2`b070eca0 00007fff`f9ae649a     Windows_UI_Xaml!DirectUI::FrameworkElement::remove_LayoutUpdated+0x11f [onecoreuap\windows\dxaml\xcp\dxaml\lib\frameworkelement_partial.cpp @ 962] 
06 (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::impl::event_revoker<winrt::Windows::UI::Xaml::IFrameworkElement,&winrt::impl::abi<winrt::Windows::UI::Xaml::IFrameworkElement,void>::type::`vcall'{400}'>::revoke_impl+0xe [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 5602] 
07 000000d2`b070ed00 00007fff`f9addfdd     Microsoft_Terminal_Control!winrt::impl::event_revoker<winrt::Windows::UI::Xaml::IFrameworkElement,&winrt::impl::abi<winrt::Windows::UI::Xaml::IFrameworkElement,void>::type::`vcall'{400}'>::~event_revoker<winrt::Windows::UI::Xaml::IFrameworkElement,&winrt::impl::abi<winrt::Windows::UI::Xaml::IFrameworkElement,void>::type::`vcall'{400}'>+0x5a [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 5577] 
08 000000d2`b070ed50 00007fff`f9adac64     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControl::~TermControl+0x2d [F:\windows-terminal\src\cascadia\TerminalControl\TermControl.cpp @ 512] 
09 000000d2`b070ed80 00007fff`f9ad2727     Microsoft_Terminal_Control!winrt::impl::heap_implements<winrt::Microsoft::Terminal::Control::implementation::TermControl>::`scalar deleting destructor'+0x14
0a (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::impl::root_implements<winrt::Microsoft::Terminal::Control::implementation::SearchBoxControl,winrt::Microsoft::Terminal::Control::SearchBoxControl,winrt::composing,winrt::Windows::UI::Xaml::Controls::IControlOverrides,winrt::Windows::UI::Xaml::Controls::IControlOverrides6,winrt::Windows::UI::Xaml::IFrameworkElementOverrides,winrt::Windows::UI::Xaml::IFrameworkElementOverrides2,winrt::Windows::UI::Xaml::IUIElementOverrides,winrt::Windows::UI::Xaml::IUIElementOverrides7,winrt::Windows::UI::Xaml::IUIElementOverrides8,winrt::Windows::UI::Xaml::IUIElementOverrides9,winrt::Windows::UI::Xaml::Markup::IComponentConnector,winrt::Windows::UI::Xaml::Markup::IComponentConnector2>::NonDelegatingRelease+0x3d [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 7385] 
0b (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::impl::root_implements<winrt::Microsoft::Terminal::Control::implementation::SearchBoxControl,winrt::Microsoft::Terminal::Control::SearchBoxControl,winrt::composing,winrt::Windows::UI::Xaml::Controls::IControlOverrides,winrt::Windows::UI::Xaml::Controls::IControlOverrides6,winrt::Windows::UI::Xaml::IFrameworkElementOverrides,winrt::Windows::UI::Xaml::IFrameworkElementOverrides2,winrt::Windows::UI::Xaml::IUIElementOverrides,winrt::Windows::UI::Xaml::IUIElementOverrides7,winrt::Windows::UI::Xaml::IUIElementOverrides8,winrt::Windows::UI::Xaml::IUIElementOverrides9,winrt::Windows::UI::Xaml::Markup::IComponentConnector,winrt::Windows::UI::Xaml::Markup::IComponentConnector2>::Release+0x3d [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 7266] 
0c (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::implements<winrt::Microsoft::Terminal::Control::implementation::SearchBoxControl,winrt::Microsoft::Terminal::Control::SearchBoxControl,winrt::composing,winrt::Windows::UI::Xaml::Controls::IControlOverrides,winrt::Windows::UI::Xaml::Controls::IControlOverrides6,winrt::Windows::UI::Xaml::IFrameworkElementOverrides,winrt::Windows::UI::Xaml::IFrameworkElementOverrides2,winrt::Windows::UI::Xaml::IUIElementOverrides,winrt::Windows::UI::Xaml::IUIElementOverrides7,winrt::Windows::UI::Xaml::IUIElementOverrides8,winrt::Windows::UI::Xaml::IUIElementOverrides9,winrt::Windows::UI::Xaml::Markup::IComponentConnector,winrt::Windows::UI::Xaml::Markup::IComponentConnector2>::Release+0x3d [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 7859] 
0d 000000d2`b070edb0 00007fff`fd6936b3     Microsoft_Terminal_Control!winrt::impl::produce_base<winrt::Microsoft::Terminal::Control::implementation::SearchBoxControl,winrt::Microsoft::Terminal::Control::ISearchBoxControl,void>::Release+0x47 [F:\windows-terminal\src\cascadia\TerminalControl\Generated Files\winrt\base.h @ 6934] 
0e (Inline Function) --------`--------     Windows_UI_Xaml!ctl::release_interface+0x1b [onecoreuap\windows\dxaml\xcp\components\com\inc\ComUtils.h @ 137] 
0f 000000d2`b070ede0 00007fff`fd84fc59     Windows_UI_Xaml!DirectUI::DependencyObject::ReleaseForPeerReferenceHelper+0xa3 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 2641] 
10 000000d2`b070ee10 00007fff`fd60d366     Windows_UI_Xaml!DirectUI::DependencyObject::ClearPeerReferences+0x242729 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 748] 
11 000000d2`b070ee40 00007fff`fd5bf182     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0x26 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 493] 
12 000000d2`b070ee80 00007fff`fd5bf121     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeer+0x42 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 547] 
13 000000d2`b070eeb0 00007fff`fd5c0b20     Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x11 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639] 
14 000000d2`b070eee0 00007fff`fd5c0099     Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x1d0 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1812] 
15 000000d2`b070ef80 00007fff`fd5bfdda     Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d5 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 862] 
16 000000d2`b070eff0 00007fff`fd5bf545     Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x15a [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 973] 
17 000000d2`b070f020 00007fff`fdf3b9f4     Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x85 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 2958] 
18 000000d2`b070f050 00007fff`fdf3c373     Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xfc [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 282] 
19 (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::WindowsXamlManager::EnqueueClose::__l2::<lambda_6689f931d1d2ff748962254369ea1967>::operator()+0x9 [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 242] 
1a 000000d2`b070f090 00007ff8`35d87406     Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_6689f931d1d2ff748962254369ea1967> &,-1>::Invoke+0x13 [onecore\external\sdk\inc\wrl\event.h @ 245] 
1b 000000d2`b070f0c0 00007ff8`35d553db     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x16
1c 000000d2`b070f0f0 00007ff8`35d49c34     CoreMessaging!Microsoft__CoreUI__Dispatch__TimeoutHandler$CallbackThunk+0x11b
1d 000000d2`b070f170 00007ff8`35d494de     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x2c4
1e 000000d2`b070f230 00007ff8`35d5996b     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x15e
1f 000000d2`b070f2a0 00007ff8`35d58e26     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x6fb
20 000000d2`b070f3d0 00007ff8`35d57061     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x1d6
21 000000d2`b070f4c0 00007ff8`35d56e83     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter_DoWork+0xf1
22 000000d2`b070f5a0 00007ff8`39c4e7e8     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter_WindowProc+0xa3
23 000000d2`b070f620 00007ff8`39c4e229     user32!UserCallWinProcCheckWow+0x2f8
24 000000d2`b070f7b0 00007ff8`2d08150b     user32!DispatchMessageWorker+0x249
25 000000d2`b070f830 00007ff8`2d0839b9     Microsoft_Toolkit_Win32_UI_XamlHost+0x150b
26 000000d2`b070f8c0 00007ff6`f9e1912e     Microsoft_Toolkit_Win32_UI_XamlHost+0x39b9
27 (Inline Function) --------`--------     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x45 [F:\windows-terminal\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
28 000000d2`b070f8f0 00007ff6`f9e1625f     WindowsTerminal!AppHost::~AppHost+0x8e [F:\windows-terminal\src\cascadia\WindowsTerminal\AppHost.cpp @ 98] 
29 000000d2`b070f930 00007ff6`f9e3ed42     WindowsTerminal!wWinMain+0x4bf [F:\windows-terminal\src\cascadia\WindowsTerminal\main.cpp @ 199] 
2a (Inline Function) --------`--------     WindowsTerminal!invoke_main+0x21 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118] 
2b 000000d2`b070fb30 00007ff8`3af47034     WindowsTerminal!__scrt_common_main_seh+0x106 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
2c 000000d2`b070fb70 00007ff8`3b162651     kernel32!BaseThreadInitThunk+0x14
2d 000000d2`b070fba0 00000000`00000000     ntdll!RtlUserThreadStart+0x21

@zadjii-msft
Copy link
Member Author

@ianjoneill Yea I'd file a new issue for that, that looks like a different stack to me. If they do come down to the same root cause then we can re-dup them later but my gut says they aren't.

FWIW I had a similar crash to the OP one this morning, and that was not persisting a defterm window, that was just closing a couple tabs, so maybe that element of the repro isn't necessary.

@Rosefield
Copy link
Contributor

I don't have a W11 install so I can't help with any defterm issues, but if there are consistent repro steps for the other crash on close I can try to fix that. Although crashing on trying to revoke an event handler seems unrelated to my changes 🤷

@zadjii-msft
Copy link
Member Author

Another day, another crash. No defterm in this one. Defterm might not be the root cause, but it did trigger it for me 2/2 times during the bug bash.

Details
0:000> k
 # Child-SP          RetAddr               Call Site
00 0000006d`3754ee80 00007ffe`15832d2f     Windows_UI_Xaml!DllGetActivationFactory+0x31ed1
01 0000006d`3754eeb0 00007ffd`c375f1d7     Windows_UI_Xaml!DllGetActivationFactory+0x146bf
02 0000006d`3754eee0 00007ffd`c370a933     Microsoft_UI_Xaml!DllGetActivationFactory+0x633c7
03 0000006d`3754ef20 00007ffd`c3757266     Microsoft_UI_Xaml!DllGetActivationFactory+0xeb23
04 0000006d`3754ef50 00007ffd`c3757234     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b456
05 0000006d`3754ef80 00007ffd`c36cadc4     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424
06 0000006d`3754efb0 00007ffe`1562c4e4     Microsoft_UI_Xaml+0x2adc4
07 0000006d`3754efe0 00007ffe`15639834     Windows_UI_Xaml!GetErrorContextIndex+0x19064
08 0000006d`3754f060 00007ffe`15817151     Windows_UI_Xaml!GetErrorContextIndex+0x263b4
09 0000006d`3754f0a0 00007ffe`15816eca     Windows_UI_Xaml!GetErrorContextIndex+0x203cd1
0a 0000006d`3754f0d0 00007ffe`158166a9     Windows_UI_Xaml!GetErrorContextIndex+0x203a4a
0b 0000006d`3754f170 00007ffe`158163e1     Windows_UI_Xaml!GetErrorContextIndex+0x203229
0c 0000006d`3754f1e0 00007ffe`15815a3f     Windows_UI_Xaml!GetErrorContextIndex+0x202f61
0d 0000006d`3754f210 00007ffe`158150f3     Windows_UI_Xaml!GetErrorContextIndex+0x2025bf
0e 0000006d`3754f240 00007ffe`159a67c3     Windows_UI_Xaml!GetErrorContextIndex+0x201c73
0f 0000006d`3754f2a0 00007ffe`3e419940     Windows_UI_Xaml!DllMain+0xdc63
10 0000006d`3754f2d0 00007ffe`3e3f8520     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911] 
11 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
12 0000006d`3754f300 00007ffe`3e3f8471     CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11] 
13 0000006d`3754f330 00007ffe`3e3daee3     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1 [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
14 (Inline Function) --------`--------     CoreMessaging!CFlat::DelegateImpl<Microsoft::CoreUI::ActionCallback,0,void __cdecl(void),long __cdecl(void *),0>::Invoke+0x22 [CFlatCorlib\1.0.210907006\CFlatCorlib\Delegate.h @ 337] 
15 0000006d`3754f380 00007ffe`3e3d9c75     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3 [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62] 
16 0000006d`3754f440 00007ffe`3e3dbade     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5 [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379] 
17 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x447 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 968] 
18 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x4b0 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 504] 
19 0000006d`3754f490 00007ffe`3e3d8246     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704] 
1a (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x1db [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 774] 
1b 0000006d`3754f580 00007ffe`3e424562     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108] 
1c 0000006d`3754f610 00007ffe`3e42c51d     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045] 
1d 0000006d`3754f650 00007ffe`3e42c5b1     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201] 
1e 0000006d`3754f6a0 00007ffe`3e4014fc     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171] 
1f (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x99 [mincore\coreui\dev\system\Dispatch\minwin\UserAdapterN.cpp @ 505] 
20 0000006d`3754f6d0 00007ffe`437e9b48     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110] 
21 0000006d`3754f740 00007ffe`437e969c     user32!UserCallWinProcCheckWow+0x338 [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282] 
22 0000006d`3754f8b0 00007ffe`437f6c3a     user32!DispatchClientMessage+0x9c [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365] 
23 0000006d`3754f910 00007ffe`43f251d4     user32!__fnDWORD+0x3a [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214] 
24 0000006d`3754f970 00007ffe`416a13b4     ntdll!KiUserCallbackDispatcherContinue [minkernel\ntos\rtl\amd64\trampoln.asm @ 607] 
25 0000006d`3754f9f8 00007ffe`437f1ca6     win32u!ZwUserPeekMessage+0x14 [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165] 
26 0000006d`3754fa00 00007ffe`437f1b9a     user32!_PeekMessage+0xb6 [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930] 
27 0000006d`3754fa70 00007ffe`1f3914f5     user32!PeekMessageW+0x13a [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761] 
28 0000006d`3754fae0 00007ffe`1f3939b9     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75] 
29 0000006d`3754fb70 00007ff7`c5634df1     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080] 
2a 0000006d`3754fba0 00007ff7`c55d7eb9     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51 [d:\dev\public\terminal\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
2b 0000006d`3754fc00 00007ff7`c55cfa99     WindowsTerminal!AppHost::~AppHost+0x49 [d:\dev\public\terminal\src\cascadia\WindowsTerminal\AppHost.cpp @ 107] 
2c 0000006d`3754fc40 00007ff7`c56d3992     WindowsTerminal!wWinMain+0x279 [d:\dev\public\terminal\src\cascadia\WindowsTerminal\main.cpp @ 199] 
2d 0000006d`3754fe00 00007ff7`c56d38be     WindowsTerminal!invoke_main+0x32 [d:\a01\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123] 
2e 0000006d`3754fe40 00007ff7`c56d377e     WindowsTerminal!__scrt_common_main_seh+0x12e [d:\a01\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
2f 0000006d`3754feb0 00007ff7`c56d3a0e     WindowsTerminal!__scrt_common_main+0xe [d:\a01\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331] 
30 0000006d`3754fee0 00007ffe`42e86ab0     WindowsTerminal!wWinMainCRTStartup+0xe [d:\a01\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17] 
31 0000006d`3754ff10 00007ffe`43edc44b     KERNEL32!BaseThreadInitThunk+0x10 [clientcore\base\win32\client\thread.c @ 75] 
32 0000006d`3754ff40 00000000`00000000     ntdll!RtlUserThreadStart+0x2b [minkernel\ntdll\rtlstrt.c @ 1152] 

This is a slightly different stack, and I'm working off d053f6c so it's possible this is just in the local branch. Wanted to post somewhere for posterity before I close the debugger.

@Rosefield
Copy link
Contributor

Rosefield commented Sep 30, 2021

Any information about what the actual exception is, in addition to the call stack? My best guess is that there are places where I am capturing this explicitly/implicitly in an event handler across an async boundary and that gets used while Close is happening.

I haven't seen an exception thrown on app.Close() in all of my testing, but there are a bunch of

Exception thrown at 0x00007FF81CB24ED9 (KernelBase.dll) in WindowsTerminal.exe: WinRT originate error - 0x80000013 : 'The given object has already been closed / disposed and may no longer be used.'.

that get logged while closing the _window.

@zadjii-msft
Copy link
Member Author

In that part of the call stack, I have no idea. I have yet to hit this with VS with "break on RoOriginate exceptions" on, but I haven't been trying too hard at that. But I do get breaks into the post-mortem debugger pretty frequently, so this is a "definitely gotta figure this out" for 1.12

@zadjii-msft
Copy link
Member Author

Another day, another crash

Details
0:000> k
 # Child-SP          RetAddr               Call Site
00 (Inline Function) --------`--------     Windows_UI_Xaml!ctl::ComObjectBase::QueryInterfaceBase+0x9 [onecoreuap\windows\dxaml\xcp\components\com\comobjectbase.cpp @ 36] 
01 00000060`630fe940 00007ffd`d4bf2d2f     Windows_UI_Xaml!ctl::ComObject<DirectUI::Button>::QueryInterface+0x11 [onecoreuap\windows\dxaml\xcp\components\com\inc\ComObject.h @ 36] 
02 00000060`630fe970 00007ffd`3077f1d7     Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x4f [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35] 
03 00000060`630fe9a0 00007ffd`3072a933     Microsoft_UI_Xaml!DllGetActivationFactory+0x633c7
04 00000060`630fe9e0 00007ffd`30777266     Microsoft_UI_Xaml!DllGetActivationFactory+0xeb23
05 00000060`630fea10 00007ffd`30777234     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b456
06 00000060`630fea40 00007ffd`306eadc4     Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424
07 00000060`630fea70 00007ffd`d49ec4e4     Microsoft_UI_Xaml+0x2adc4
08 (Inline Function) --------`--------     Windows_UI_Xaml!ctl::release_interface_nonull+0x1a [onecoreuap\windows\dxaml\xcp\components\com\inc\ComUtils.h @ 152] 
09 00000060`630feaa0 00007ffd`d49f9834     Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4 [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697] 
0a (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::TrackerPtr<IInspectable,1,0>::Clear+0xe [onecoreuap\windows\dxaml\xcp\components\lifetime\inc\TrackerPtr.h @ 267] 
0b (Inline Function) --------`--------     Windows_UI_Xaml!ctl::WeakReferenceSourceNoThreadId::RemovePtrValue+0x17 [onecoreuap\windows\dxaml\xcp\components\lifetime\inc\WeakReferenceSourceNoThreadId.h @ 233] 
0c (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::DependencyObject::ClearPeerReferences+0x86 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 760] 
0d 00000060`630feb20 00007ffd`d4bd7151     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490] 
0e (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeer+0x33 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 547] 
0f 00000060`630feb60 00007ffd`d4bd6eca     Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639] 
10 00000060`630feb90 00007ffd`d4bd66a9     Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891] 
11 00000060`630fec30 00007ffd`d4bd63e1     Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925] 
12 00000060`630feca0 00007ffd`d4bd5a3f     Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039] 
13 00000060`630fecd0 00007ffd`d4bd50f3     Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105] 
14 00000060`630fed00 00007ffd`d4d667c3     Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3 [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346] 
15 (Inline Function) --------`--------     Windows_UI_Xaml!DirectUI::WindowsXamlManager::EnqueueClose::__l2::<lambda_fff66c81a3ad945c7b56bba29c46338b>::operator()+0x9 [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 298] 
16 00000060`630fed60 00007ffd`fd8b9940     Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_fff66c81a3ad945c7b56bba29c46338b> &,-1>::Invoke+0x13 [onecore\external\sdk\inc\wrl\event.h @ 354] 
17 00000060`630fed90 00007ffd`fd898520     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911] 
18 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
19 00000060`630fedc0 00007ffd`fd898471     CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11] 
1a 00000060`630fedf0 00007ffd`fd87aee3     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1 [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
1b (Inline Function) --------`--------     CoreMessaging!CFlat::DelegateImpl<Microsoft::CoreUI::ActionCallback,0,void __cdecl(void),long __cdecl(void *),0>::Invoke+0x22 [CFlatCorlib\1.0.210907006\CFlatCorlib\Delegate.h @ 337] 
1c 00000060`630fee40 00007ffd`fd879c75     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3 [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62] 
1d 00000060`630fef00 00007ffd`fd87bade     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5 [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379] 
1e (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x447 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 968] 
1f (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x4b0 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 504] 
20 00000060`630fef50 00007ffd`fd878246     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704] 
21 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x1db [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 774] 
22 00000060`630ff040 00007ffd`fd8c4562     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108] 
23 00000060`630ff0d0 00007ffd`fd8cc51d     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045] 
24 00000060`630ff110 00007ffd`fd8cc5b1     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201] 
25 00000060`630ff160 00007ffd`fd8a14fc     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171] 
26 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x99 [mincore\coreui\dev\system\Dispatch\minwin\UserAdapterN.cpp @ 505] 
27 00000060`630ff190 00007ffe`01f29b48     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110] 
28 00000060`630ff200 00007ffe`01f2969c     user32!UserCallWinProcCheckWow+0x338 [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282] 
29 00000060`630ff370 00007ffe`01f36c3a     user32!DispatchClientMessage+0x9c [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365] 
2a 00000060`630ff3d0 00007ffe`033c51d4     user32!__fnDWORD+0x3a [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214] 
2b 00000060`630ff430 00007ffe`00f013b4     ntdll!KiUserCallbackDispatcherContinue [minkernel\ntos\rtl\amd64\trampoln.asm @ 607] 
2c 00000060`630ff4b8 00007ffe`01f31ca6     win32u!ZwUserPeekMessage+0x14 [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165] 
2d 00000060`630ff4c0 00007ffe`01f31b9a     user32!_PeekMessage+0xb6 [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930] 
2e 00000060`630ff530 00007ffd`de6b14f5     user32!PeekMessageW+0x13a [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761] 
2f 00000060`630ff5a0 00007ffd`de6b39b9     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75] 
30 00000060`630ff630 00007ff6`10635cb1     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080] 
31 00000060`630ff660 00007ff6`105d7eb9     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51 [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
32 00000060`630ff6c0 00007ff6`105cfa99     WindowsTerminal!AppHost::~AppHost+0x49 [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107] 
33 00000060`630ff700 00007ff6`106d69d2     WindowsTerminal!wWinMain+0x279 [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199] 
34 00000060`630ff8c0 00007ff6`106d68fe     WindowsTerminal!invoke_main+0x32 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123] 
35 00000060`630ff900 00007ff6`106d67be     WindowsTerminal!__scrt_common_main_seh+0x12e [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
36 00000060`630ff970 00007ff6`106d6a4e     WindowsTerminal!__scrt_common_main+0xe [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331] 
37 00000060`630ff9a0 00007ffe`01e66ab0     WindowsTerminal!wWinMainCRTStartup+0xe [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17] 
38 00000060`630ff9d0 00007ffe`0337c44b     KERNEL32!BaseThreadInitThunk+0x10 [clientcore\base\win32\client\thread.c @ 75] 
39 00000060`630ffa00 00000000`00000000     ntdll!RtlUserThreadStart+0x2b [minkernel\ntdll\rtlstrt.c @ 1152] 
0:000> !xamlstowed
-------------------------
Callstack for hr=80004002 - No such interface supported

    Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e  (7ffdd4bf2d4e) [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35]
    Microsoft_UI_Xaml!DllGetActivationFactory+0x123e0  (7ffd3072e1f0)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x10108  (7ffd3072bf18)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b468  (7ffd30777278)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424  (7ffd30777234)
    Microsoft_UI_Xaml+0x2adc4  (7ffd306eadc4)
    Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4  (7ffdd49ec4e4) [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697]
    Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4  (7ffdd49f9834) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490]
    Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41  (7ffdd4bd7151) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639]
    Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a  (7ffdd4bd6eca) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891]
    Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1  (7ffdd4bd66a9) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925]
    Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1  (7ffdd4bd63e1) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039]
    Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b  (7ffdd4bd5a3f) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105]
    Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3  (7ffdd4bd50f3) [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346]
    Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long  (7ffdd4d667c3) [onecore\external\sdk\inc\wrl\event.h @ 354]
    CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20  (7ffdfd8b9940) [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911]
    CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c  (7ffdfd898520) [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11]
    CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1  (7ffdfd898471) [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3  (7ffdfd87aee3) [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5  (7ffdfd879c75) [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379]
    CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe  (7ffdfd87bade) [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6  (7ffdfd878246) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76  (7ffdfd8c4562) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75  (7ffdfd8cc51d) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21  (7ffdfd8cc5b1) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc  (7ffdfd8a14fc) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110]
    user32!UserCallWinProcCheckWow+0x338  (7ffe01f29b48) [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282]
    user32!DispatchClientMessage+0x9c  (7ffe01f2969c) [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365]
    user32!__fnDWORD+0x3a  (7ffe01f36c3a) [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214]
    ntdll!KiUserCallbackDispatcherContinue  (7ffe033c51d4) [minkernel\ntos\rtl\amd64\trampoln.asm @ 607]
    win32u!ZwUserPeekMessage+0x14  (7ffe00f013b4) [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165]
    user32!_PeekMessage+0xb6  (7ffe01f31ca6) [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930]
    user32!PeekMessageW+0x13a  (7ffe01f31b9a) [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145  (7ffdde6b14f5) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19  (7ffdde6b39b9) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080]
    WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51  (7ff610635cb1) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
    WindowsTerminal!AppHost::~AppHost+0x49  (7ff6105d7eb9) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107]
    WindowsTerminal!wWinMain+0x279  (7ff6105cfa99) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199]
    WindowsTerminal!invoke_main+0x32  (7ff6106d69d2) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123]
    WindowsTerminal!__scrt_common_main_seh+0x12e  (7ff6106d68fe) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
    WindowsTerminal!__scrt_common_main+0xe  (7ff6106d67be) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
    WindowsTerminal!wWinMainCRTStartup+0xe  (7ff6106d6a4e) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17]
    KERNEL32!BaseThreadInitThunk+0x10  (7ffe01e66ab0) [clientcore\base\win32\client\thread.c @ 75]
    ntdll!RtlUserThreadStart+0x2b  (7ffe0337c44b) [minkernel\ntdll\rtlstrt.c @ 1152]
-------------------------
Callstack for hr=80004002 - No such interface supported

    Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e  (7ffdd4bf2d4e) [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35]
    Microsoft_UI_Xaml!DllGetActivationFactory+0x633c7  (7ffd3077f1d7)
    Microsoft_UI_Xaml!DllGetActivationFactory+0xeb23  (7ffd3072a933)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b456  (7ffd30777266)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424  (7ffd30777234)
    Microsoft_UI_Xaml+0x2adc4  (7ffd306eadc4)
    Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4  (7ffdd49ec4e4) [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697]
    Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4  (7ffdd49f9834) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490]
    Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41  (7ffdd4bd7151) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639]
    Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a  (7ffdd4bd6eca) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891]
    Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1  (7ffdd4bd66a9) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925]
    Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1  (7ffdd4bd63e1) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039]
    Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b  (7ffdd4bd5a3f) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105]
    Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3  (7ffdd4bd50f3) [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346]
    Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long  (7ffdd4d667c3) [onecore\external\sdk\inc\wrl\event.h @ 354]
    CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20  (7ffdfd8b9940) [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911]
    CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c  (7ffdfd898520) [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11]
    CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1  (7ffdfd898471) [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3  (7ffdfd87aee3) [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5  (7ffdfd879c75) [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379]
    CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe  (7ffdfd87bade) [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6  (7ffdfd878246) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76  (7ffdfd8c4562) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75  (7ffdfd8cc51d) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21  (7ffdfd8cc5b1) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc  (7ffdfd8a14fc) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110]
    user32!UserCallWinProcCheckWow+0x338  (7ffe01f29b48) [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282]
    user32!DispatchClientMessage+0x9c  (7ffe01f2969c) [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365]
    user32!__fnDWORD+0x3a  (7ffe01f36c3a) [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214]
    ntdll!KiUserCallbackDispatcherContinue  (7ffe033c51d4) [minkernel\ntos\rtl\amd64\trampoln.asm @ 607]
    win32u!ZwUserPeekMessage+0x14  (7ffe00f013b4) [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165]
    user32!_PeekMessage+0xb6  (7ffe01f31ca6) [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930]
    user32!PeekMessageW+0x13a  (7ffe01f31b9a) [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145  (7ffdde6b14f5) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19  (7ffdde6b39b9) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080]
    WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51  (7ff610635cb1) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
    WindowsTerminal!AppHost::~AppHost+0x49  (7ff6105d7eb9) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107]
    WindowsTerminal!wWinMain+0x279  (7ff6105cfa99) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199]
    WindowsTerminal!invoke_main+0x32  (7ff6106d69d2) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123]
    WindowsTerminal!__scrt_common_main_seh+0x12e  (7ff6106d68fe) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
    WindowsTerminal!__scrt_common_main+0xe  (7ff6106d67be) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
    WindowsTerminal!wWinMainCRTStartup+0xe  (7ff6106d6a4e) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17]
    KERNEL32!BaseThreadInitThunk+0x10  (7ffe01e66ab0) [clientcore\base\win32\client\thread.c @ 75]
    ntdll!RtlUserThreadStart+0x2b  (7ffe0337c44b) [minkernel\ntdll\rtlstrt.c @ 1152]
-------------------------
Callstack for hr=80004002 - No such interface supported

    Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e  (7ffdd4bf2d4e) [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35]
    Microsoft_UI_Xaml!DllGetActivationFactory+0x123e0  (7ffd3072e1f0)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x10108  (7ffd3072bf18)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b468  (7ffd30777278)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424  (7ffd30777234)
    Microsoft_UI_Xaml+0x2adc4  (7ffd306eadc4)
    Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4  (7ffdd49ec4e4) [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697]
    Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4  (7ffdd49f9834) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490]
    Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41  (7ffdd4bd7151) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639]
    Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a  (7ffdd4bd6eca) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891]
    Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1  (7ffdd4bd66a9) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925]
    Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1  (7ffdd4bd63e1) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039]
    Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b  (7ffdd4bd5a3f) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105]
    Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3  (7ffdd4bd50f3) [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346]
    Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long  (7ffdd4d667c3) [onecore\external\sdk\inc\wrl\event.h @ 354]
    CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20  (7ffdfd8b9940) [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911]
    CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c  (7ffdfd898520) [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11]
    CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1  (7ffdfd898471) [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3  (7ffdfd87aee3) [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5  (7ffdfd879c75) [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379]
    CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe  (7ffdfd87bade) [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6  (7ffdfd878246) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76  (7ffdfd8c4562) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75  (7ffdfd8cc51d) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21  (7ffdfd8cc5b1) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc  (7ffdfd8a14fc) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110]
    user32!UserCallWinProcCheckWow+0x338  (7ffe01f29b48) [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282]
    user32!DispatchClientMessage+0x9c  (7ffe01f2969c) [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365]
    user32!__fnDWORD+0x3a  (7ffe01f36c3a) [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214]
    ntdll!KiUserCallbackDispatcherContinue  (7ffe033c51d4) [minkernel\ntos\rtl\amd64\trampoln.asm @ 607]
    win32u!ZwUserPeekMessage+0x14  (7ffe00f013b4) [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165]
    user32!_PeekMessage+0xb6  (7ffe01f31ca6) [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930]
    user32!PeekMessageW+0x13a  (7ffe01f31b9a) [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145  (7ffdde6b14f5) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19  (7ffdde6b39b9) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080]
    WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51  (7ff610635cb1) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
    WindowsTerminal!AppHost::~AppHost+0x49  (7ff6105d7eb9) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107]
    WindowsTerminal!wWinMain+0x279  (7ff6105cfa99) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199]
    WindowsTerminal!invoke_main+0x32  (7ff6106d69d2) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123]
    WindowsTerminal!__scrt_common_main_seh+0x12e  (7ff6106d68fe) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
    WindowsTerminal!__scrt_common_main+0xe  (7ff6106d67be) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
    WindowsTerminal!wWinMainCRTStartup+0xe  (7ff6106d6a4e) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17]
    KERNEL32!BaseThreadInitThunk+0x10  (7ffe01e66ab0) [clientcore\base\win32\client\thread.c @ 75]
    ntdll!RtlUserThreadStart+0x2b  (7ffe0337c44b) [minkernel\ntdll\rtlstrt.c @ 1152]
-------------------------
Callstack for hr=80004002 - No such interface supported

    Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e  (7ffdd4bf2d4e) [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35]
    Microsoft_UI_Xaml!DllGetActivationFactory+0x633c7  (7ffd3077f1d7)
    Microsoft_UI_Xaml!DllGetActivationFactory+0xeb23  (7ffd3072a933)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b456  (7ffd30777266)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424  (7ffd30777234)
    Microsoft_UI_Xaml+0x2adc4  (7ffd306eadc4)
    Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4  (7ffdd49ec4e4) [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697]
    Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4  (7ffdd49f9834) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490]
    Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41  (7ffdd4bd7151) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639]
    Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a  (7ffdd4bd6eca) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891]
    Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1  (7ffdd4bd66a9) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925]
    Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1  (7ffdd4bd63e1) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039]
    Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b  (7ffdd4bd5a3f) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105]
    Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3  (7ffdd4bd50f3) [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346]
    Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long  (7ffdd4d667c3) [onecore\external\sdk\inc\wrl\event.h @ 354]
    CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20  (7ffdfd8b9940) [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911]
    CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c  (7ffdfd898520) [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11]
    CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1  (7ffdfd898471) [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3  (7ffdfd87aee3) [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5  (7ffdfd879c75) [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379]
    CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe  (7ffdfd87bade) [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6  (7ffdfd878246) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76  (7ffdfd8c4562) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75  (7ffdfd8cc51d) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21  (7ffdfd8cc5b1) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc  (7ffdfd8a14fc) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110]
    user32!UserCallWinProcCheckWow+0x338  (7ffe01f29b48) [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282]
    user32!DispatchClientMessage+0x9c  (7ffe01f2969c) [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365]
    user32!__fnDWORD+0x3a  (7ffe01f36c3a) [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214]
    ntdll!KiUserCallbackDispatcherContinue  (7ffe033c51d4) [minkernel\ntos\rtl\amd64\trampoln.asm @ 607]
    win32u!ZwUserPeekMessage+0x14  (7ffe00f013b4) [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165]
    user32!_PeekMessage+0xb6  (7ffe01f31ca6) [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930]
    user32!PeekMessageW+0x13a  (7ffe01f31b9a) [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145  (7ffdde6b14f5) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19  (7ffdde6b39b9) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080]
    WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51  (7ff610635cb1) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
    WindowsTerminal!AppHost::~AppHost+0x49  (7ff6105d7eb9) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107]
    WindowsTerminal!wWinMain+0x279  (7ff6105cfa99) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199]
    WindowsTerminal!invoke_main+0x32  (7ff6106d69d2) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123]
    WindowsTerminal!__scrt_common_main_seh+0x12e  (7ff6106d68fe) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
    WindowsTerminal!__scrt_common_main+0xe  (7ff6106d67be) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
    WindowsTerminal!wWinMainCRTStartup+0xe  (7ff6106d6a4e) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17]
    KERNEL32!BaseThreadInitThunk+0x10  (7ffe01e66ab0) [clientcore\base\win32\client\thread.c @ 75]
    ntdll!RtlUserThreadStart+0x2b  (7ffe0337c44b) [minkernel\ntdll\rtlstrt.c @ 1152]
-------------------------
Callstack for hr=80004002 - No such interface supported

    Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e  (7ffdd4bf2d4e) [onecoreuap\windows\dxaml\xcp\components\com\weakreference.cpp @ 35]
    Microsoft_UI_Xaml!DllGetActivationFactory+0x123e0  (7ffd3072e1f0)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x10108  (7ffd3072bf18)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b468  (7ffd30777278)
    Microsoft_UI_Xaml!DllGetActivationFactory+0x5b424  (7ffd30777234)
    Microsoft_UI_Xaml+0x2adc4  (7ffd306eadc4)
    Windows_UI_Xaml!DirectUI::TrackerTargetReference::Clear+0x1f4  (7ffdd49ec4e4) [onecoreuap\windows\dxaml\xcp\components\lifetime\lib\trackertargetreference.cpp @ 697]
    Windows_UI_Xaml!DirectUI::DependencyObject::DisconnectFrameworkPeerCore+0xe4  (7ffdd49f9834) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 490]
    Windows_UI_Xaml!DirectUI::DependencyObject::EndShutdown+0x41  (7ffdd4bd7151) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 639]
    Windows_UI_Xaml!DirectUI::DXamlCore::ShutdownAllPeers+0x18a  (7ffdd4bd6eca) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1891]
    Windows_UI_Xaml!DirectUI::DXamlCore::CommonShutdown+0x1d1  (7ffdd4bd66a9) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 925]
    Windows_UI_Xaml!DirectUI::DXamlCore::DeinitializeInstance+0x1b1  (7ffdd4bd63e1) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 1039]
    Windows_UI_Xaml!DirectUI::DXamlCore::Deinitialize+0x8b  (7ffdd4bd5a3f) [onecoreuap\windows\dxaml\xcp\dxaml\lib\dxamlcore.cpp @ 3105]
    Windows_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Close+0xd3  (7ffdd4bd50f3) [onecoreuap\windows\dxaml\xcp\dxaml\lib\windowsxamlmanager_partial.cpp @ 346]
    Windows_UI_Xaml!Microsoft::WRL::Details::DelegateArgTraits<long  (7ffdd4d667c3) [onecore\external\sdk\inc\wrl\event.h @ 354]
    CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20  (7ffdfd8b9940) [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911]
    CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c  (7ffdfd898520) [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11]
    CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1  (7ffdfd898471) [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3  (7ffdfd87aee3) [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62]
    CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5  (7ffdfd879c75) [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379]
    CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe  (7ffdfd87bade) [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6  (7ffdfd878246) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76  (7ffdfd8c4562) [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75  (7ffdfd8cc51d) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21  (7ffdfd8cc5b1) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171]
    CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc  (7ffdfd8a14fc) [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110]
    user32!UserCallWinProcCheckWow+0x338  (7ffe01f29b48) [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282]
    user32!DispatchClientMessage+0x9c  (7ffe01f2969c) [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365]
    user32!__fnDWORD+0x3a  (7ffe01f36c3a) [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214]
    ntdll!KiUserCallbackDispatcherContinue  (7ffe033c51d4) [minkernel\ntos\rtl\amd64\trampoln.asm @ 607]
    win32u!ZwUserPeekMessage+0x14  (7ffe00f013b4) [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165]
    user32!_PeekMessage+0xb6  (7ffe01f31ca6) [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930]
    user32!PeekMessageW+0x13a  (7ffe01f31b9a) [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145  (7ffdde6b14f5) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75]
    Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19  (7ffdde6b39b9) [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080]
    WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x51  (7ff610635cb1) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
    WindowsTerminal!AppHost::~AppHost+0x49  (7ff6105d7eb9) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\AppHost.cpp @ 107]
    WindowsTerminal!wWinMain+0x279  (7ff6105cfa99) [d:\dev\private\OpenConsole\src\cascadia\WindowsTerminal\main.cpp @ 199]
    WindowsTerminal!invoke_main+0x32  (7ff6106d69d2) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 123]
    WindowsTerminal!__scrt_common_main_seh+0x12e  (7ff6106d68fe) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
    WindowsTerminal!__scrt_common_main+0xe  (7ff6106d67be) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
    WindowsTerminal!wWinMainCRTStartup+0xe  (7ff6106d6a4e) [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp @ 17]
    KERNEL32!BaseThreadInitThunk+0x10  (7ffe01e66ab0) [clientcore\base\win32\client\thread.c @ 75]
    ntdll!RtlUserThreadStart+0x2b  (7ffe0337c44b) [minkernel\ntdll\rtlstrt.c @ 1152]

=========================
@$xamlstowed()                 : 5 ErrorContexts
    length           : 0x5
    [0x0]            : 0x2090a040d70 : 0x80004002 in Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e [Type: ErrorContext *]
    [0x1]            : 0x2090a0d75a0 : 0x80004002 in Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e [Type: ErrorContext *]
    [0x2]            : 0x20918892f90 : 0x80004002 in Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e [Type: ErrorContext *]
    [0x3]            : 0x20918894e10 : 0x80004002 in Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e [Type: ErrorContext *]
    [0x4]            : 0x2091750ac50 : 0x80004002 in Windows_UI_Xaml!ctl::Details::WeakReferenceImpl::Resolve+0x6e [Type: ErrorContext *]

No defterm involved, and this one was on #11404, which is a little behind main but not enough that I'd write it off.

I'm not sure more stacks like this are actually going to help me figure this out at all 😕

@Rosefield
Copy link
Contributor

Is this something that you can reproduce on W10 as well? Can you get the error still if persisting windows is turned off? I'm still struggling to reproduce that error.

@Rosefield
Copy link
Contributor

Does this happen when you use the quit action vs closing the window some other way? I did add a couple of get_weak() calls into WindowManager for the various event handlers which might line up with that error.

@zadjii-msft
Copy link
Member Author

Unfortunately, I don't have a Win10 laying around easy ;__; That one was definitely through just a close with the X.

I still haven't really debugged too thoroughly. Thought I'd leave the stack here in case it was relevant in the future, but it almost certainly isn't. I still need to find some time to put this through the wringer

@zadjii-msft
Copy link
Member Author

Oh many it did happen again, on 1.12.2781.0 which is todays bugbash build. Not totally sure what happened again:

  • had 2 windows
  • had quit them once
  • had restored them from state
  • closed the monarch window (with the X)
  • that caused the crash!

I think there were defterms in the monarch but can't be sure. Wasn't expecting it - we went through the whole bash without running into this, until I was signing out of the meeting.

VERY possible that this is just a different manifestation of #11366

@zadjii-msft
Copy link
Member Author

INTERESTING. This morning, I hit the crash here:

Details
0:000> k
 # Child-SP          RetAddr               Call Site
00 (Inline Function) --------`--------     WindowsTerminal!BaseWindow<IslandWindow>::GetWindowRect+0x8 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\BaseWindow.h @ 127] 
01 00000077`8c3aeb80 00007ff6`c565db44     WindowsTerminal!AppHost::_GetWindowLaunchPosition+0x39 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 411] 
02 00000077`8c3aec00 00007ff6`c565be41     WindowsTerminal!AppHost::_GetWindowLayoutAsync$_ResumeCoro$1+0x194 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 728] 
03 (Inline Function) --------`--------     WindowsTerminal!std::experimental::coroutine_handle<void>::resume+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\experimental\coroutine @ 107] 
04 (Inline Function) --------`--------     WindowsTerminal!std::experimental::coroutine_handle<void>::operator()+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\experimental\coroutine @ 99] 
05 (Inline Function) --------`--------     WindowsTerminal!winrt::resume_foreground::__l2::awaitable::await_suspend::__l2::<lambda_2ab9998b3c4eacdb9b89a7a0699bc21a>::operator()+0x9 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.UI.Core.h @ 3327] 
06 00000077`8c3aeca0 00007ffd`e3f5fb80     WindowsTerminal!winrt::impl::delegate<winrt::Windows::UI::Core::DispatchedHandler,<lambda_2ab9998b3c4eacdb9b89a7a0699bc21a> >::Invoke+0x11 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.UI.Core.h @ 1278] 
07 00000077`8c3aecd0 00007ffd`e3f5fa42     Windows_UI!Windows::UI::Core::CDispatcher::InvokeAndCompleteItem+0x120 [onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\dispatcher.cpp @ 1294] 
08 (Inline Function) --------`--------     Windows_UI!Windows::UI::Core::CDispatcher::EnqueueAsyncWork::__l16::<lambda_980f345bc6e4ac8a906323c24a5fe9b1>::operator()+0x1c [onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\dispatcher.cpp @ 898] 
09 00000077`8c3aed20 00007ffd`fd8b9940     Windows_UI!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_980f345bc6e4ac8a906323c24a5fe9b1>,-1>::Invoke+0x22 [onecore\external\sdk\inc\wrl\event.h @ 354] 
0a 00000077`8c3aed60 00007ffd`fd898520     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911] 
0b (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
0c 00000077`8c3aed90 00007ffd`fd898471     CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11] 
0d 00000077`8c3aedc0 00007ffd`fd87aee3     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1 [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
0e (Inline Function) --------`--------     CoreMessaging!CFlat::DelegateImpl<Microsoft::CoreUI::ActionCallback,0,void __cdecl(void),long __cdecl(void *),0>::Invoke+0x22 [CFlatCorlib\1.0.210907006\CFlatCorlib\Delegate.h @ 337] 
0f 00000077`8c3aee10 00007ffd`fd879c75     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3 [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62] 
10 00000077`8c3aeed0 00007ffd`fd87bade     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5 [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379] 
11 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x447 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 968] 
12 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x4b0 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 504] 
13 00000077`8c3aef20 00007ffd`fd878246     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704] 
14 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x1db [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 774] 
15 00000077`8c3af010 00007ffd`fd8c4562     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108] 
16 00000077`8c3af0a0 00007ffd`fd8cc51d     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045] 
17 00000077`8c3af0e0 00007ffd`fd8cc5b1     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201] 
18 00000077`8c3af130 00007ffd`fd8a14fc     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171] 
19 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x99 [mincore\coreui\dev\system\Dispatch\minwin\UserAdapterN.cpp @ 505] 
1a 00000077`8c3af160 00007ffe`01f29b48     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110] 
1b 00000077`8c3af1d0 00007ffe`01f2969c     user32!UserCallWinProcCheckWow+0x338 [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282] 
1c 00000077`8c3af340 00007ffe`01f36c3a     user32!DispatchClientMessage+0x9c [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365] 
1d 00000077`8c3af3a0 00007ffe`033c51d4     user32!__fnDWORD+0x3a [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214] 
1e 00000077`8c3af400 00007ffe`00f013b4     ntdll!KiUserCallbackDispatcherContinue [minkernel\ntos\rtl\amd64\trampoln.asm @ 607] 
1f 00000077`8c3af488 00007ffe`01f31ca6     win32u!ZwUserPeekMessage+0x14 [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165] 
20 00000077`8c3af490 00007ffe`01f31b9a     user32!_PeekMessage+0xb6 [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930] 
21 00000077`8c3af500 00007ffd`ed9614f5     user32!PeekMessageW+0x13a [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761] 
22 00000077`8c3af570 00007ffd`ed9639b9     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75] 
23 00000077`8c3af600 00007ff6`c5673783     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080] 
24 (Inline Function) --------`--------     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x45 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
25 00000077`8c3af630 00007ff6`c5665db1     WindowsTerminal!AppHost::~AppHost+0x93 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 106] 
26 00000077`8c3af670 00007ff6`c565ce22     WindowsTerminal!wWinMain+0xd2c1 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\main.cpp @ 199] 
27 (Inline Function) --------`--------     WindowsTerminal!invoke_main+0x21 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118] 
28 00000077`8c3af890 00007ffe`01e66ab0     WindowsTerminal!__scrt_common_main_seh+0x106 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
29 00000077`8c3af8d0 00007ffe`0337c44b     KERNEL32!BaseThreadInitThunk+0x10 [clientcore\base\win32\client\thread.c @ 75] 
2a 00000077`8c3af900 00000000`00000000     ntdll!RtlUserThreadStart+0x2b [minkernel\ntdll\rtlstrt.c @ 1152] 

In the AppHost dtor, trying to read the _GetWindowLaunchPosition. That obviously doesn't work, because we've already freed the window. There is no _window anymore!

Very interesting. I forget why tearing the _window down first is important

@Rosefield
Copy link
Contributor

Perhaps something like this would help with that last stack trace, but I don't know if it is sufficient to actually solve the problem generally.

Rosefield@2233047

@ghost ghost added the In-PR This issue has a related PR label Oct 6, 2021
@zadjii-msft
Copy link
Member Author

zadjii-msft commented Oct 6, 2021

You know, that's probably right, because I hit the following this morning with a breakpoint on the _app = nullptr; line in ~AppHost. At that point, the monarch is still kickin, but the app is gone, so presumably the coroutine would kick off and try to ask questions about the app.

Details
 	WindowsTerminal.exe!winrt::impl::consume_Windows_UI_Core_ICoreDispatcher<winrt::Windows::UI::Core::ICoreDispatcher>::RunAsync(const winrt::Windows::UI::Core::CoreDispatcherPriority & priority, const winrt::Windows::UI::Core::DispatchedHandler & agileCallback) Line 190	C++
 	WindowsTerminal.exe!`winrt::resume_foreground'::`2'::awaitable::await_suspend(std::experimental::coroutine_handle<void> handle) Line 3325	C++
 	WindowsTerminal.exe!winrt::impl::notify_awaiter<`winrt::resume_foreground'::`2'::awaitable>::await_suspend<std::experimental::coroutine_traits<winrt::Windows::Foundation::IAsyncOperation<winrt::hstring>,AppHost *>::promise_type>(std::experimental::coroutine_handle<std::experimental::coroutine_traits<winrt::Windows::Foundation::IAsyncOperation<winrt::hstring>,AppHost *>::promise_type> handle) Line 8886	C++
>	WindowsTerminal.exe!AppHost::_GetWindowLayoutAsync$_ResumeCoro$1() Line 727	C++
 	[External Code]	
 	WindowsTerminal.exe!<lambda_39b7a89e7f73623df1d2e33af146a478>::operator()<winrt::Windows::Foundation::IInspectable const &>(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & args) Line 92	C++
 	WindowsTerminal.exe!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>,<lambda_39b7a89e7f73623df1d2e33af146a478>>::Invoke(void * sender, void * args) Line 895	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & args) Line 2525	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>,winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs> & delegate, const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & <args_1>) Line 5762	C++
 	Microsoft.Terminal.Remoting.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>>::operator()<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & <args_1>) Line 5897	C++
 	Microsoft.Terminal.Remoting.dll!<lambda_3734f30e4a6f111258186fd8c903d202>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs const &>(const winrt::Windows::Foundation::IInspectable & <args_0>, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & <args_1>) Line 2520	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>,<lambda_3734f30e4a6f111258186fd8c903d202>>::Invoke(void * sender, void * args) Line 895	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>::operator()(const winrt::Windows::Foundation::IInspectable & sender, const winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs & args) Line 2525	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>,std::nullptr_t,winrt::Microsoft::Terminal::Remoting::implementation::GetWindowLayoutArgs>(const winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs> & delegate, void * const & <args_0>, const winrt::Microsoft::Terminal::Remoting::implementation::GetWindowLayoutArgs & <args_1>) Line 5762	C++
 	Microsoft.Terminal.Remoting.dll!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs>>::operator()<std::nullptr_t,winrt::Microsoft::Terminal::Remoting::implementation::GetWindowLayoutArgs>(void * const & <args_0>, const winrt::Microsoft::Terminal::Remoting::implementation::GetWindowLayoutArgs & <args_1>) Line 5897	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Microsoft::Terminal::Remoting::implementation::Peasant::GetWindowLayout() Line 304	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::produce<winrt::Microsoft::Terminal::Remoting::implementation::Peasant,winrt::Microsoft::Terminal::Remoting::IPeasant>::GetWindowLayout(void * * result) Line 1247	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::consume_Microsoft_Terminal_Remoting_IPeasant<winrt::Microsoft::Terminal::Remoting::IPeasant>::GetWindowLayout() Line 310	C++
 	Microsoft.Terminal.Remoting.dll!<lambda_fc1a410c0531896355b3e1a4af608fe1>::operator()<unsigned __int64,winrt::Microsoft::Terminal::Remoting::IPeasant>(const unsigned __int64 & __formal, const winrt::Microsoft::Terminal::Remoting::IPeasant & p) Line 1015	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Microsoft::Terminal::Remoting::implementation::Monarch::_forEachPeasant<<lambda_fc1a410c0531896355b3e1a4af608fe1> &,<lambda_f304ae241c39a80e0e0fe73a1c609478> &>(winrt::Microsoft::Terminal::Remoting::implementation::Monarch::GetAllWindowLayouts::__l2::<lambda_fc1a410c0531896355b3e1a4af608fe1> & func, winrt::Microsoft::Terminal::Remoting::implementation::Monarch::GetAllWindowLayouts::__l2::<lambda_f304ae241c39a80e0e0fe73a1c609478> & onError) Line 142	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Microsoft::Terminal::Remoting::implementation::Monarch::GetAllWindowLayouts() Line 1026	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::produce<winrt::Microsoft::Terminal::Remoting::implementation::Monarch,winrt::Microsoft::Terminal::Remoting::IMonarch>::GetAllWindowLayouts(void * * result) Line 1028	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::consume_Microsoft_Terminal_Remoting_IMonarch<winrt::Microsoft::Terminal::Remoting::IMonarch>::GetAllWindowLayouts() Line 138	C++
 	Microsoft.Terminal.Remoting.dll!winrt::Microsoft::Terminal::Remoting::implementation::WindowManager::GetAllWindowLayouts() Line 622	C++
 	Microsoft.Terminal.Remoting.dll!winrt::impl::produce<winrt::Microsoft::Terminal::Remoting::implementation::WindowManager,winrt::Microsoft::Terminal::Remoting::IWindowManager>::GetAllWindowLayouts(void * * result) Line 1767	C++
 	WindowsTerminal.exe!winrt::impl::consume_Microsoft_Terminal_Remoting_IWindowManager<winrt::Microsoft::Terminal::Remoting::IWindowManager>::GetAllWindowLayouts() Line 694	C++
 	WindowsTerminal.exe!AppHost::_SaveWindowLayouts$_ResumeCoro$1() Line 822	C++

So yea, cleaning those up early is probably a good idea.

EDIT 10/7/21

Hit it again in a peasant window that wasn't under a debugger or anything. Just wanted to close the window. No SUI in that window ever.

At the very least we should prvent the persist from doing something after the _window is nulled out. Or like, manually collect the state at that point, then continue with the teardown. Idk.

0:000> k
 # Child-SP          RetAddr               Call Site
00 (Inline Function) --------`--------     WindowsTerminal!BaseWindow<IslandWindow>::GetWindowRect+0x8 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\BaseWindow.h @ 127] 
01 000000da`25cfecc0 00007ff6`c565db44     WindowsTerminal!AppHost::_GetWindowLaunchPosition+0x39 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 411] 
02 000000da`25cfed40 00007ff6`c565be41     WindowsTerminal!AppHost::_GetWindowLayoutAsync$_ResumeCoro$1+0x194 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 728] 
03 (Inline Function) --------`--------     WindowsTerminal!std::experimental::coroutine_handle<void>::resume+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\experimental\coroutine @ 107] 
04 (Inline Function) --------`--------     WindowsTerminal!std::experimental::coroutine_handle<void>::operator()+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\experimental\coroutine @ 99] 
05 (Inline Function) --------`--------     WindowsTerminal!winrt::resume_foreground::__l2::awaitable::await_suspend::__l2::<lambda_2ab9998b3c4eacdb9b89a7a0699bc21a>::operator()+0x9 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.UI.Core.h @ 3327] 
06 000000da`25cfede0 00007ffd`e3f5fb80     WindowsTerminal!winrt::impl::delegate<winrt::Windows::UI::Core::DispatchedHandler,<lambda_2ab9998b3c4eacdb9b89a7a0699bc21a> >::Invoke+0x11 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.UI.Core.h @ 1278] 
07 000000da`25cfee10 00007ffd`e3f5fa42     Windows_UI!Windows::UI::Core::CDispatcher::InvokeAndCompleteItem+0x120 [onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\dispatcher.cpp @ 1294] 
08 (Inline Function) --------`--------     Windows_UI!Windows::UI::Core::CDispatcher::EnqueueAsyncWork::__l16::<lambda_980f345bc6e4ac8a906323c24a5fe9b1>::operator()+0x1c [onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\dispatcher.cpp @ 898] 
09 000000da`25cfee60 00007ffd`fd8b9940     Windows_UI!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_980f345bc6e4ac8a906323c24a5fe9b1>,-1>::Invoke+0x22 [onecore\external\sdk\inc\wrl\event.h @ 354] 
0a 000000da`25cfeea0 00007ffd`fd898520     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 911] 
0b (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
0c 000000da`25cfeed0 00007ffd`fd898471     CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c [CFlatCorlib\1.0.210907006\CFlatCorlib\SehSafe.inl @ 11] 
0d 000000da`25cfef00 00007ffd`fd87aee3     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xb1 [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 
0e (Inline Function) --------`--------     CoreMessaging!CFlat::DelegateImpl<Microsoft::CoreUI::ActionCallback,0,void __cdecl(void),long __cdecl(void *),0>::Invoke+0x22 [CFlatCorlib\1.0.210907006\CFlatCorlib\Delegate.h @ 337] 
0f 000000da`25cfef50 00007ffd`fd879c75     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x6d3 [mincore\CoreUI\Dev\System\Dispatch\DeferredCall.cs @ 62] 
10 000000da`25cff010 00007ffd`fd87bade     CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x1a5 [mincore\CoreUI\Dev\System\Dispatch\DeferredCallDispatcher.cs @ 379] 
11 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x447 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 968] 
12 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x4b0 [mincore\CoreUI\Dev\System\Dispatch\Dispatcher.cs @ 504] 
13 000000da`25cff060 00007ffd`fd878246     CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x5fe [mincore\CoreUI\Dev\System\Dispatch\EventLoop.cs @ 704] 
14 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x1db [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 774] 
15 000000da`25cff150 00007ffd`fd8c4562     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x2a6 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1108] 
16 000000da`25cff1e0 00007ffd`fd8cc51d     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x76 [mincore\CoreUI\Dev\System\Dispatch\UserAdapter.cs @ 1045] 
17 000000da`25cff220 00007ffd`fd8cc5b1     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x75 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 201] 
18 000000da`25cff270 00007ffd`fd8a14fc     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleVariableDispatchNotifyMessage+0x21 [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 171] 
19 (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x99 [mincore\coreui\dev\system\Dispatch\minwin\UserAdapterN.cpp @ 505] 
1a 000000da`25cff2a0 00007ffe`01f29b48     CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0xfc [mincore\coreui\dev\system\Dispatch\UserAdapterCommonN.cpp @ 110] 
1b 000000da`25cff310 00007ffe`01f2969c     user32!UserCallWinProcCheckWow+0x338 [clientcore\windows\core\ntuser\client\clmsg.cxx @ 282] 
1c 000000da`25cff480 00007ffe`01f36c3a     user32!DispatchClientMessage+0x9c [clientcore\windows\core\ntuser\client\daytona\objfre\amd64\client.cxx @ 3365] 
1d 000000da`25cff4e0 00007ffe`033c51d4     user32!__fnDWORD+0x3a [onecoreuap\restricted\windows\inc\ntuser\inc\ntcb.h @ 1214] 
1e 000000da`25cff540 00007ffe`00f013b4     ntdll!KiUserCallbackDispatcherContinue [minkernel\ntos\rtl\amd64\trampoln.asm @ 607] 
1f 000000da`25cff5c8 00007ffe`01f31ca6     win32u!ZwUserPeekMessage+0x14 [onecoreuap\windows\core\umode\moderncore\objfre\amd64\usrstubs.asm @ 165] 
20 000000da`25cff5d0 00007ffe`01f31b9a     user32!_PeekMessage+0xb6 [clientcore\windows\core\ntuser\client\ntstubs.cxx @ 930] 
21 000000da`25cff640 00007ffd`de8d14f5     user32!PeekMessageW+0x13a [onecoreuap\restricted\windows\inc\private\core\ntuser\client\cltxt.h @ 761] 
22 000000da`25cff6b0 00007ffd`de8d39b9     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication::Close+0x145 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\XamlApplication.cpp @ 75] 
23 000000da`25cff740 00007ff6`c5673783     Microsoft_Toolkit_Win32_UI_XamlHost!winrt::impl::produce<winrt::Microsoft::Toolkit::Win32::UI::XamlHost::implementation::XamlApplication,winrt::Windows::Foundation::IClosable>::Close+0x19 [D:\a\1\s\Microsoft.Toolkit.Win32.UI.XamlApplication\x64\Release\Generated Files\winrt\Windows.Foundation.h @ 1080] 
24 (Inline Function) --------`--------     WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close+0x45 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121] 
25 000000da`25cff770 00007ff6`c5665db1     WindowsTerminal!AppHost::~AppHost+0x93 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 106] 
26 000000da`25cff7b0 00007ff6`c565ce22     WindowsTerminal!wWinMain+0xd2c1 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\main.cpp @ 199] 
27 (Inline Function) --------`--------     WindowsTerminal!invoke_main+0x21 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118] 
28 000000da`25cff9d0 00007ffe`01e66ab0     WindowsTerminal!__scrt_common_main_seh+0x106 [d:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
29 000000da`25cffa10 00007ffe`0337c44b     KERNEL32!BaseThreadInitThunk+0x10 [clientcore\base\win32\client\thread.c @ 75] 
2a 000000da`25cffa40 00000000`00000000     ntdll!RtlUserThreadStart+0x2b [minkernel\ntdll\rtlstrt.c @ 1152] 

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Oct 15, 2021
@ghost ghost removed the In-PR This issue has a related PR label Oct 19, 2021
PankajBhojwani pushed a commit that referenced this issue Oct 20, 2021
Don't crash if we try to save the window layout while we are closing, and try to avoid saving at all.

Might impact #11354 

## Detailed Description of the Pull Request / Additional comments
- Revoke the event handler/save throttler so we don't even try to get the window layout when we are closing
- Try to check for nullptrs, but then apply `try {} CATCH_LOG()` liberally

## Validation Steps Performed
The happy path of saving normally is still fine, but I haven't been unlucky enough to trigger the crash myself.
PankajBhojwani pushed a commit that referenced this issue Oct 20, 2021
Don't crash if we try to save the window layout while we are closing, and try to avoid saving at all.

Might impact #11354 

## Detailed Description of the Pull Request / Additional comments
- Revoke the event handler/save throttler so we don't even try to get the window layout when we are closing
- Try to check for nullptrs, but then apply `try {} CATCH_LOG()` liberally

## Validation Steps Performed
The happy path of saving normally is still fine, but I haven't been unlucky enough to trigger the crash myself.
@zadjii-msft zadjii-msft modified the milestones: Terminal v2.0, 22H1 Jan 4, 2022
@zadjii-msft zadjii-msft modified the milestones: 22H1, Terminal v1.14 Feb 2, 2022
@DHowett
Copy link
Member

DHowett commented Feb 2, 2022

I'm clearing the Blocking tag, as this is (1) a Preview feature and (2) not reproing ??

@DHowett DHowett removed the Severity-Blocking We won't ship a release like this! No-siree. label Feb 2, 2022
@zadjii-msft
Copy link
Member Author

I'll do you one better - I haven't seen this in months. I'm not leaving a no repro bug open like this. I'll know where to find it if I see it again.

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Feb 2, 2022
@zadjii-msft zadjii-msft added the Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

No branches or pull requests

4 participants