microsoft/microsoft-ui-xaml

Stowed Exception - COMException/Element not found

jhert0 opened this issue · 7 comments

jhert0 commented

Describe the bug

Not sure what was done to cause this crash but here is the stacktrace:

This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(44c.22c0): Unknown exception - code c000027b (first/second chance not available)
For analysis of this file, run !analyze -v
KERNELBASE!RaiseFailFastException+0x152:
00007ff9`8055c242 0f1f440000      nop     dword ptr [rax+rax]
0:000> !pde.dse
=========================================================================================
 PDE v11.3 - Copyright 2017 Andrew Richards
=========================================================================================
Stowed Exception Array @ 0x0000013499ac9400

Stowed Exception #1 @ 0x000001348b0a5f68
	0x80004005 (FACILITY_NULL - Default): E_FAIL - Unspecified failure

	Stack	 : 0x13499ed3bd0
		7ff98291a114 combase!RoOriginateLanguageException+0x54
		7ff8e7ab312d

>>> Associated CLR Exception <<<

WARNING: SOS needs to be upgraded for this version of the runtime. Some commands may not work correctly.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652

Exception object: 00000134d1801460
Exception type:   System.Runtime.InteropServices.COMException
Message:          
InnerException:   <none>
StackTrace (generated):
    SP               IP               Function
    0000000ACD37BAD0 00007FF8E7AAEF9B WinRT_Runtime!WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32)+0x5b
    0000000ACD37BB10 00007FF8E74E26EC Microsoft_WinUI!ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.MeasureOverride(WinRT.IObjectReference, Windows.Foundation.Size)+0x8c
    0000000ACD37BB50 00007FF8E66EF73F Microsoft_WinUI!ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr, Windows.Foundation.Size, Windows.Foundation.Size*)+0x4f

StackTraceString: <none>
HResult: 80004005

Stowed Exception #2 @ 0x000001348ad70768
	0x80004005 (FACILITY_NULL - Default): E_FAIL - Unspecified failure

	Stack	 : 0x1348ad6f750
		7ff938df580c Microsoft_ui_xaml!DirectUI::FrameworkElement::MeasureOverrideFromCore+0x2aa12c
		7ff938b6512f Microsoft_ui_xaml!CFrameworkElement::MeasureCore+0x47f
		7ff938c7ca3d Microsoft_ui_xaml!CUIElement::MeasureInternal+0x2ad
		7ff938b62085 Microsoft_ui_xaml!CUIElement::Measure+0x455
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938c0304f Microsoft_ui_xaml!CLayoutManager::UpdateLayout+0x1df
		7ff938c0218b Microsoft_ui_xaml!CCoreServices::NWDrawTree+0x46b
		7ff938c03c1a Microsoft_ui_xaml!CCoreServices::NWDrawMainTree+0x14a
		7ff938c03a8d Microsoft_ui_xaml!CWindowRenderTarget::Draw+0x6d
		7ff938c039c9 Microsoft_ui_xaml!CXcpBrowserHost::OnTick+0x59
		7ff938c7961a Microsoft_ui_xaml!CXcpDispatcher::Tick+0x8a
		7ff938c7953c Microsoft_ui_xaml!CXcpDispatcher::OnReentrancyProtectedWindowMessage+0x22c
		7ff938c788f2 Microsoft_ui_xaml!CXcpDispatcher::WindowProc+0xa2
		7ff938cdae59 Microsoft_ui_xaml!CDeferredInvoke::DispatchQueuedMessage+0x39
		7ff938cdadad Microsoft_ui_xaml!CXcpDispatcher::MessageTimerCallback+0x5d
		7ff938dc2cbd Microsoft_ui_xaml!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::UI::Dispatching::DispatcherQueueTimer *,ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *>,IInspectable *>::*)(ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *,IInspectable *)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,ABI::Windows::Foundation::ITypedEventHandler<ABI::Microsoft::UI::Dispatching::DispatcherQueueTimer *,IInspectable *>,Microsoft::WRL::FtmBase>,`CXcpDispatcher::Init'::`68'::<lambda_1> &,1,ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *,IInspectable *>::Invoke+0xd
		7ff960523588 CoreMessagingXP!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::Foundation::ITypedEventHandler_impl<Windows::Foundation::Internal::AggregateType<Microsoft::UI::Dispatching::DispatcherQueueTimer * __ptr64,Microsoft::UI::Dispatching::IDispatcherQueueTimer * __ptr64>,IInspectable * __ptr64>::*)(Microsoft::UI::Dispatching::IDispatcherQueueTimer * __ptr64,IInspectable * __ptr64) __ptr64>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::Foundation::ITypedEventHandler<Microsoft::UI::Dispatching::DispatcherQueueTimer * __ptr64,IInspectable * __ptr64>,Microsoft::WRL::FtmBase>,<lambda_82cf8073f4f042d1a68771c460cb9f49>,-1,Microsoft::UI::Dispatching::IDispatcherQueueTimer * __ptr64,IInspectable * __ptr64>::Invoke+0xa8
		7ff96052378e CoreMessagingXP!Microsoft::WRL::InvokeTraits<-2>::InvokeDelegates<<lambda_1e854da9c9ccd42f6138c3b007a32877>,Windows::Foundation::ITypedEventHandler<Microsoft::UI::Dispatching::DispatcherQueueTimer * __ptr64,IInspectable * __ptr64> >+0x8e
		7ff96052335b CoreMessagingXP!Microsoft::UI::Dispatching::DispatcherQueueTimer::TimerCallback+0xdb
		7ff9604fe748 CoreMessagingXP!CFlat::SehSafe::Execute<<lambda_654db17c35df07198786f0867aa10de6> >+0x2c
		7ff9604fe61b CoreMessagingXP!Microsoft::CoreUI::Dispatch::TimeoutHandler::ImportAdapter$+0x5b
		7ff9604be0a7 CoreMessagingXP!Microsoft::CoreUI::Dispatch::TimeoutManager::Callback_OnDispatch+0x1a7
		7ff9604a90d4 CoreMessagingXP!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem+0x1e4
		7ff9604a8963 CoreMessagingXP!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop+0x1b3
		7ff96049ed73 CoreMessagingXP!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x16b
		7ff9604a15ea CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue+0x15a
		7ff9604a1aeb CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x97
		7ff9604a19f4 CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw+0x80
		7ff9604de56d CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x59
		7ff9604de4f2 CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::HandleDispatchNotifyMessage+0x13e
		7ff9604de3a3 CoreMessagingXP!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0x73
		7ff981d38241 user32!UserCallWinProcCheckWow+0x2d1
		7ff981d37efc user32!DispatchClientMessage+0x9c
		7ff981d4302d user32!_fnDWORD+0x3d
		7ff982cd3434 ntdll!KiUserCallbackDispatcherContinue+0x0
		7ff9800d1534 win32u!NtUserGetMessage+0x14
		7ff981d4535a user32!GetMessageW+0x2a
		7ff938d76178 Microsoft_ui_xaml!DirectUI::FrameworkApplication::RunDesktopWindowMessageLoop+0x3c
		7ff938d308b6 Microsoft_ui_xaml!DirectUI::FrameworkApplication::StartDesktop+0x346
		7ff938c8fc2e Microsoft_ui_xaml!DirectUI::FrameworkApplicationFactory::Start+0x6e
		7ff8e5509ef5 Microsoft_WinUI!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start+0x145

Stowed Exception #3 @ 0x000001348ab40f78
	0x80004005 (FACILITY_NULL - Default): E_FAIL - Unspecified failure

	Stack	 : 0x1348ab3ff60
		7ff938e62987 Microsoft_ui_xaml!DirectUI::DXamlCore::GetPeerPrivate+0x20f727
		7ff938cb56c2 Microsoft_ui_xaml!DirectUI::DXamlCore::GetPeerPrivate+0x82
		7ff938d2cffd Microsoft_ui_xaml!DirectUI::FrameworkElement::FindNameImpl+0xb5
		7ff938d2cf0b Microsoft_ui_xaml!DirectUI::FrameworkElementGenerated::FindName+0x6b
		7ff938d960d0 Microsoft_ui_xaml!DirectUI::FrameworkElement::FindNameInPage+0x90
		7ff938d78d25 Microsoft_ui_xaml!DirectUI::BindingExpression::GetSourceElement+0xb5
		7ff938d78b4d Microsoft_ui_xaml!DirectUI::BindingExpression::AttachToElementName+0xed
		7ff938c608d6 Microsoft_ui_xaml!DirectUI::BindingExpression::AttachToEffectiveSource+0x186
		7ff938c6055c Microsoft_ui_xaml!DirectUI::BindingExpression::CalculateEffectiveSource+0x68
		7ff938c60bc5 Microsoft_ui_xaml!DirectUI::BindingExpression::OnAttach+0xa5
		7ff938bce89f Microsoft_ui_xaml!DirectUI::DependencyObject::SetValueExpression+0xbf
		7ff938cbeb4a Microsoft_ui_xaml!DirectUI::DependencyObject::SetBindingCore+0x52
		7ff938cbe9ef Microsoft_ui_xaml!DirectUI::DependencyObject::SetBindingCallback+0x127
		7ff938d6228b Microsoft_ui_xaml!CBinding::SetBinding+0x1b
		7ff938c5225c Microsoft_ui_xaml!XamlNativeRuntime::SetValue+0x33c
		7ff938cc9a2f Microsoft_ui_xaml!ObjectWriterRuntime::SetValueImpl+0x12f
		7ff938c4e27e Microsoft_ui_xaml!BinaryFormatObjectWriter::SetValueOnCurrentInstance+0x47e
		7ff938c4cf0d Microsoft_ui_xaml!BinaryFormatObjectWriter::WriteNode+0xa2d
		7ff938b5c110 Microsoft_ui_xaml!CTemplateContent::LoadXbfVersion2+0x140
		7ff938cfbcf8 Microsoft_ui_xaml!CTemplateContent::Load+0x40
		7ff938c47fa5 Microsoft_ui_xaml!CFrameworkTemplate::LoadContent+0x2d5
		7ff938d4d0cd Microsoft_ui_xaml!CDataTemplate::LoadContent+0x2d
		7ff938b843f1 Microsoft_ui_xaml!CFrameworkElement::ApplyTemplate+0x171
		7ff938b9596d Microsoft_ui_xaml!CContentPresenter::ApplyTemplate+0x28d
		7ff938c6233c Microsoft_ui_xaml!CFrameworkElement::InvokeApplyTemplate+0x5c
		7ff938b64da7 Microsoft_ui_xaml!CFrameworkElement::MeasureCore+0xf7
		7ff938c7ca3d Microsoft_ui_xaml!CUIElement::MeasureInternal+0x2ad
		7ff938b62085 Microsoft_ui_xaml!CUIElement::Measure+0x455
		7ff938b75909 Microsoft_ui_xaml!CControl::MeasureOverride+0x49
		7ff938bce466 Microsoft_ui_xaml!DirectUI::FrameworkElementGenerated::MeasureOverride+0xd6
		7ff938bcca7a Microsoft_ui_xaml!DirectUI::ContentControl::MeasureOverride+0x14a
		7ff938b4b855 Microsoft_ui_xaml!DirectUI::FrameworkElement::MeasureOverrideFromCore+0x175
		7ff938b6512f Microsoft_ui_xaml!CFrameworkElement::MeasureCore+0x47f
		7ff938c7ca3d Microsoft_ui_xaml!CUIElement::MeasureInternal+0x2ad
		7ff938b62085 Microsoft_ui_xaml!CUIElement::Measure+0x455
		7ff938b60dcf Microsoft_ui_xaml!DirectUI::UIElementGenerated::Measure+0xcf
		7ff938cb2438 Microsoft_ui_xaml!DirectUI::ListViewBase::SetupContainerContentChangingAfterPrepare+0x288
		7ff938b8ccb6 Microsoft_ui_xaml!DirectUI::ModernCollectionBasePanel::PrepareContainerViaItemsHost+0x166
		7ff938b66d0f Microsoft_ui_xaml!DirectUI::ModernCollectionBasePanel::Generate+0x72f
		7ff938c36199 Microsoft_ui_xaml!DirectUI::ModernCollectionBasePanel::RunGenerate+0x109
		7ff938b8b4ac Microsoft_ui_xaml!DirectUI::ModernCollectionBasePanel::RunVirtualization+0x13c
		7ff938cf20db Microsoft_ui_xaml!DirectUI::ModernCollectionBasePanel::MeasureOverride+0x10b
		7ff938b4b855 Microsoft_ui_xaml!DirectUI::FrameworkElement::MeasureOverrideFromCore+0x175
		7ff938b6512f Microsoft_ui_xaml!CFrameworkElement::MeasureCore+0x47f
		7ff938c7ca3d Microsoft_ui_xaml!CUIElement::MeasureInternal+0x2ad
		7ff938b62085 Microsoft_ui_xaml!CUIElement::Measure+0x455
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b62023 Microsoft_ui_xaml!CUIElement::Measure+0x3f3
		7ff938b75909 Microsoft_ui_xaml!CControl::MeasureOverride+0x49
		7ff938b75896 Microsoft_ui_xaml!CItemsControl::MeasureOverride+0x46
		7ff938bce466 Microsoft_ui_xaml!DirectUI::FrameworkElementGenerated::MeasureOverride+0xd6
		7ff938da15a0 Microsoft_ui_xaml!DirectUI::ListViewBase::MeasureOverride+0x70
		7ff8e66efa06

Stowed Exception #4 @ 0x000001348ad41188
	0x80070490 (FACILITY_WIN32 - Win32 Undecorated Error Codes): Element not found.

	Stack	 : 0x1348ad40170
		7ff93900207c Microsoft_ui_xaml!CUIAWindow::get_HostRawElementProvider+0xec
		7ff96501ea4b uiautomationcore!UiaUtils::EntryPointFromImmediateProvider+0x7b
		7ff96501f905 uiautomationcore!UiaUtils::GetFragmentRootWithHostProviderEntryPoint+0xe5
		7ff9650187b2 uiautomationcore!GetProviderEventInfo+0x82
		7ff9650265bc uiautomationcore!UiaRaiseAutomationPropertyChangedEvent+0x2cc
		7ff939001210 Microsoft_ui_xaml!CUIAWindow::UIARaiseAutomationPropertyChangedEvent+0x180
		7ff938ef9e5b Microsoft_ui_xaml!CCoreServices::UIARaiseAutomationPropertyChangedEvent+0x53
		7ff93921604a Microsoft_ui_xaml!DirectUI::AutomationPeer::RaisePropertyChangedEvent+0x42
		7ff93921630b Microsoft_ui_xaml!DirectUI::AutomationPeer::RaisePropertyChangedEventImpl+0x12f
		7ff9390bfa7c Microsoft_ui_xaml!DirectUI::AutomationPeerGenerated::RaisePropertyChangedEvent+0xec
		7ff8e749d98b

Steps to reproduce the bug

Do not know how to reproduce.

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.2: 1.4.231008000

Windows version

No response

Additional context

No response

Can you go back into the dumps folder under Windows on the machine and see if a dump was produced. It will be difficult to proceed without that.

@jhert0 Thanks for the dump! The dump confirms you hit a "failed resurrection" issue, which happens when garbage collection has determined an element is unreachable and available to be collected. Sometimes an element can be resurrected in this state, but many times they can't, resulting in this failure.

These issues frequently are challenging to track down. I think these can either be a platform issue or triggered by something unusual an app or control is doing.

In this case, the dump shows the issue is happening on a Grid with name "NavItemGrid", and something is trying to bind to this element which is not part of the tree. The dump also shows this error, which may or may not be related to the property trying to be set with this binding:

"Failed to assign to property 'Microsoft.UI.Xaml.FrameworkElement.Tag'." [Line: 88 Position: 47]

The stack shows some UI is being loaded. Does that include the "NavItemGrid"? If it does, is it possible GC was either directly triggered or some COM call was made (possibly indirectly) which may have allowed GC to run in the middle of loading? If GC ran in the middle of loading, that could potentially result in an element being incorrectly marked as unreachable (it just isn't reachable yet).

jhert0 commented

NavItemGrid does have a binding to Tag, It's binding to a FontIcon on the page, I'm not really sure what the purpose of that code is, I didn't write it. The FontIcon is lower in the page and maybe could habe not be loaded in yet when trying to bind to it, I'm not sure if that matters.

It could have been loading the home page when the app first launched or either loading it when navigating home because that's where that Grid is.

@jhert0 do you have a repro of this to share or get a time travel trace?

jhert0 commented

Sorry no I don't know how to reproduce it and I don't have a time travel debug.

@jhert0 without more details unfortunately this issue is not actionable. If you hit this again, please capture a dump/ttt trace and ping back on this issue. Thanks!