APP unexpectedly crashing in Windows.UI.Xaml.dll

1

My UWP application unexpetedly crashing in debug and release. It is not depends on moving mouse or pressing keys in keyboard. It can be works for some minutes or hours and crash in Windows.UI.Xaml.dll, sometimes in SharedLibrary.dll. Interesting that it crashes very often on 64 OS Windows, but very seldom on 32 Windows. I tested in Windows 10.0.17763 and 10.0.17134. On my computer in debug configuration it crashes always in Windows.UI.Xaml.dll!ctl::ComObject::AddRef() with Exception thrown at 0x00007FF868934853 (Windows.UI.Xaml.dll) in Outdoor.UWP.exe: 0xC0000005: Access violation reading location 0x0000000000000008. Stack trace

Windows.UI.Xaml.dll!ctl::ComObject::AddRef() Line 83 C++ [Inline Frame] Windows.UI.Xaml.dll!ctl::addref_interface(DirectUI::DependencyObject *) Line 121 C++ Windows.UI.Xaml.dll!DirectUI::DependencyObject::AddRefForPeerReferenceHelper() Line 2585 C++ [Inline Frame] Windows.UI.Xaml.dll!DirectUI::DependencyObject::SetExpectedReferenceOnPeer(CDependencyObject *) Line 4001 C++ [Inline Frame] Windows.UI.Xaml.dll!CFxCallbacks::FrameworkCallbacks_SetExpectedReferenceOnPeer(CDependencyObject *) Line 1101 C++ Windows.UI.Xaml.dll!CDependencyObject::SetExpectedReferenceOnPeer() Line 2847 C++ Windows.UI.Xaml.dll!CDependencyObject::OnParentChange(CDependencyObject * pOldParent, CDependencyObject * pParent, bool hasAtLeastOneParent) Line 1623 C++ Windows.UI.Xaml.dll!CMultiParentShareableDependencyObject::AddParent(CDependencyObject * pNewParent, bool fPublic, void(*)(CDependencyObject *, DirtyFlags::Value) pfnNewParentRenderChangedHandler) Line 53 C++ [Inline Frame] Windows.UI.Xaml.dll!CDOCollection::ChangeParent(CDependencyObject *) Line 1081 C++ [Inline Frame] Windows.UI.Xaml.dll!CDOCollection::SetChildParent(CDependencyObject * fPublic, CDependencyObject *) Line 1193 C++ Windows.UI.Xaml.dll!CDOCollection::Append(CDependencyObject * pObject, unsigned int * pnIndex) Line 536 C++ Windows.UI.Xaml.dll!CStateTriggerCollection::Append(CDependencyObject * object, unsigned int * index) Line 48 C++ Windows.UI.Xaml.dll!CVisualStateManager2::FaultInStateTriggers(CVisualStateGroupCollection * groupCollection, CustomWriterRuntimeObjectCreator & creator) Line 612 C++ Windows.UI.Xaml.dll!CVisualStateManager2::FaultInChildren(CVisualStateGroupCollection * groupCollection) Line 339 C++ Windows.UI.Xaml.dll!CVisualStateGroupCollection::EnsureFaultedIn() Line 255 C++ Windows.UI.Xaml.dll!Jupiter::VisualStateManager::DeferredNameScopeEntry::TryGetOrCreateElement(bool * shouldRetryLookup) Line 36 C++ Windows.UI.Xaml.dll!Jupiter::NameScoping::NameScopeTableEntry::TryGetElement(bool * shouldRetry) Line 90 C++ Windows.UI.Xaml.dll!Jupiter::NameScoping::StandardNameScopeTable::TryGetElementImpl(const xstring_ptr_view & name, bool * shouldRetry) Line 23 C++ [Inline Frame] Windows.UI.Xaml.dll!Jupiter::NameScoping::NameScopeTable::TryGetElement(const xstring_ptr_view &) Line 38 C++ Windows.UI.Xaml.dll!Jupiter::NameScoping::NameScopeRoot::GetNamedObjectIfExists(const xstring_ptr_view & name, const CDependencyObject * nameScopeOwner, Jupiter::NameScoping::NameScopeType nameScopeType) Line 57 C++ Windows.UI.Xaml.dll!CCoreServices::ClearNamedObject(const xstring_ptr_view & strName, const CDependencyObject * pNamescopeOwner, CDependencyObject * originalEntry) Line 135 C++ Windows.UI.Xaml.dll!CDependencyObject::UnregisterName(CDependencyObject * pNamescopeOwner) Line 761 C++ Windows.UI.Xaml.dll!CDependencyObject::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1189 C++ Windows.UI.Xaml.dll!CVisualStateGroup::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 64 C++ Windows.UI.Xaml.dll!CDependencyObject::Leave(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1122 C++ Windows.UI.Xaml.dll!CDOCollection::ChildLeave(CDependencyObject * pChild, CDependencyObject * pNamescopeOwner, LeaveParams params, unsigned int fCanProcessEnterLeave) Line 401 C++ Windows.UI.Xaml.dll!CDOCollection::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 208 C++ Windows.UI.Xaml.dll!CVisualStateGroupCollection::LeaveImpl(CDependencyObject * namescopeOwner, LeaveParams params) Line 183 C++ Windows.UI.Xaml.dll!CDependencyObject::Leave(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1122 C++ Windows.UI.Xaml.dll!CDependencyObject::LeaveObjectProperty(CDependencyObject * pDO, CDependencyObject * namescopeOwner, LeaveParams params) Line 1415 C++ Windows.UI.Xaml.dll!CDependencyObject::LeaveSparseProperties(CDependencyObject * namescopeOwner, LeaveParams params) Line 1386 C++ Windows.UI.Xaml.dll!CDependencyObject::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1224 C++ Windows.UI.Xaml.dll!CUIElement::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1676 C++ Windows.UI.Xaml.dll!CFrameworkElement::LeaveImpl(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 2539 C++ Windows.UI.Xaml.dll!CDependencyObject::Leave(CDependencyObject * pNamescopeOwner, LeaveParams params) Line 1122 C++ Windows.UI.Xaml.dll!CDOCollection::ChildLeave(CDependencyObject * pChild, CDependencyObject * pNamescopeOwner, LeaveParams params, unsigned int fCanProcessEnterLeave) Line 401 C++ Windows.UI.Xaml.dll!CDOCollection::Neat(int bBreak) Line 852 C++ Windows.UI.Xaml.dll!CCollection::Destroy() Line 23 C++ Windows.UI.Xaml.dll!CCollection::Clear() Line 63 C++ Windows.UI.Xaml.dll!CUIElementCollection::RemoveAllElements(unsigned int bTryUnloadingElements) Line 1378 C++ Windows.UI.Xaml.dll!CUIElement::~CUIElement() Line 387 C++ Windows.UI.Xaml.dll!CPage::`scalar deleting destructor'(unsigned int) C++ [Inline Frame] Windows.UI.Xaml.dll!CDependencyObject::ReleaseImpl(unsigned int) Line 406 C++ [Inline Frame] Windows.UI.Xaml.dll!CDependencyObject::Release() Line 68 C++ Windows.UI.Xaml.dll!DirectUI::DependencyObject::DisconnectFrameworkPeerCore() Line 508 C++ [Inline Frame] Windows.UI.Xaml.dll!DirectUI::DependencyObject::DisconnectFrameworkPeer(unsigned int) Line 547 C++ Windows.UI.Xaml.dll!DirectUI::DependencyObject::OnFinalRelease() Line 405 C++ Windows.UI.Xaml.dll!ctl::ComBase::ReleaseImpl() Line 299 C++ [Inline Frame] Windows.UI.Xaml.dll!ctl::ComBase::ReleaseDirect() Line 113 C++ [Inline Frame] Windows.UI.Xaml.dll!ctl::release_interface_inner(ctl::WeakReferenceSourceNoThreadId *) Line 62 C++ Windows.UI.Xaml.dll!DirectUI::UIAffinityReleaseQueue::DoCleanup(unsigned char bSync, unsigned char * completed) Line 195 C++ Windows.UI.Xaml.dll!DirectUI::UIAffinityReleaseQueue::BuildTree(unsigned char * returnValue) Line 44 C++ Windows.UI.Xaml.dll!DirectUI::BuildTreeService::BuildTrees(bool * pWorkLeft) Line 111 C++ Windows.UI.Xaml.dll!AgCoreCallbacks::FrameworkCallbacks_PhasedWorkDistributor_PerformWork(unsigned int * pWorkleft) Line 560 C++ [Inline Frame] Windows.UI.Xaml.dll!CFxCallbacks::FrameworkCallbacks_PhasedWorkDistributor_PerformWork(unsigned int *) Line 1131 C++ Windows.UI.Xaml.dll!CCoreServices::NWDrawTree(HWWalk * pHWWalk, CWindowRenderTarget * pRenderTarget, VisualTree * pVisualTree, unsigned int forceRedraw, XRECT_WH * prcDirtyRect) Line 6982 C++ Windows.UI.Xaml.dll!CCoreServices::NWDrawMainTree(CWindowRenderTarget * pIRenderTarget, bool fForceRedraw, XRECT_WH * prcDirtyRect) Line 6723 C++ Windows.UI.Xaml.dll!CWindowRenderTarget::Draw(CCoreServices * fForceRedraw, unsigned int prcDirtyRect, XRECT_WH *) Line 137 C++ Windows.UI.Xaml.dll!CXcpBrowserHost::OnTick() Line 538 C++ Windows.UI.Xaml.dll!CXcpDispatcher::Tick() Line 1446 C++ Windows.UI.Xaml.dll!CXcpDispatcher::OnReentrancyProtectedWindowMessage(HWND__ * msg, unsigned int lParam, unsigned int64) Line 1046 C++ [Inline Frame] Windows.UI.Xaml.dll!CXcpDispatcher::ProcessMessage(HWND *) Line 887 C++ Windows.UI.Xaml.dll!CXcpDispatcher::WindowProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 836 C++ Windows.UI.Xaml.dll!CDeferredInvoke::DispatchQueuedMessage(bool * dispatchedWork, bool * hasMoreWork) Line 299 C++ [Inline Frame] Windows.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallback() Line 1531 C++ Windows.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallbackStatic(void * myUserData) Line 1523 C++ CoreMessaging.dll!00007ff88ec472bc() Unknown CoreMessaging.dll!00007ff88ec6863d() Unknown CoreMessaging.dll!00007ff88ec4c150() Unknown CoreMessaging.dll!00007ff88ec4b270() Unknown CoreMessaging.dll!00007ff88ec4a175() Unknown CoreMessaging.dll!00007ff88ec49fac() Unknown user32.dll!00007ff89301ca66() Unknown user32.dll!00007ff89301c78c() Unknown user32.dll!00007ff89302fa83() Unknown ntdll.dll!00007ff894ee3494() Unknown win32u.dll!00007ff8916610c4() Unknown user32.dll!00007ff89301e4e2() Unknown user32.dll!00007ff89301e3be() Unknown Windows.UI.dll!00007ff888bb5232() Unknown Windows.UI.dll!00007ff888bb502e() Unknown Windows.UI.dll!00007ff888bb4edb() Unknown Windows.UI.Xaml.dll!CJupiterWindow::RunCoreWindowMessageLoop() Line 1246 C++ [Inline Frame] Windows.UI.Xaml.dll!CJupiterControl::RunMessageLoop() Line 1024 C++ Windows.UI.Xaml.dll!DirectUI::DXamlCore::RunMessageLoop() Line 2446 C++ twinapi.appcore.dll!00007ff88f574c2a() Unknown twinapi.appcore.dll!00007ff88f547a66() Unknown SHCore.dll!00007ff8931dc315() Unknown kernel32.dll!00007ff892087974() Unknown ntdll.dll!00007ff894eaa271() Unknown

Please help me.

I removed "{x:Null}" from XAML, changed throwing NotImplementedException to DependencyProperty.UnsetValue in ConvertBack methods of all my IValueConverter's. But it is not solved my problem.

c#
uwp

1 Answer

0

I created some user controls inherited from Control and Page. The template roots in these controls are Grid and Border. I added visual group "CommonStates" with states "Normal" and "PointerOver" to these xaml elements and selected these states in OnPointerEntered and OnPointerExited event handlers. I had to add these states, because there are not default ones in these controls, and i do not know another way to change interface when mouse is over on my user control. After such page is shown, application will able to crash with this stack trace in different places: very often when user swtiched between pages. Solution: rename group to "MyCommonStates" and states to "MyNormal" and "MyPointerOver". After it my app works for 2 or 3 weeks. Xaml of my controls.

<Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="local:StatisticsValue">
                <Border x:Name="Part_Border">

                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="MyCommonStates">
                            <VisualState x:Name="MyNormal"/>
                            <VisualState x:Name="MyPointerOver">
                                <VisualState.Setters>
                                    ...
                                </VisualState.Setters>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>

                    ...
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>

<Grid x:Name="Root" Background="Transparent">

    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="MyCommonStates">
            <VisualState x:Name="MyNormal"/>
            <VisualState x:Name="MyPointerOver">
                <VisualState.Setters>
                    ...
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    ...
    </Grid>

Can anybody explain me why it solved my problem?


User contributions licensed under CC BY-SA 3.0