我的UWP应用程序意外地在调试和发布时崩溃。它不依赖于移动鼠标或按下键盘上的键。在Windows.UI.Xaml.dll中,有时甚至在SharedLibrary.dll中,它可能会工作几分钟或几小时,然后崩溃。有趣的是,它在64 OS Windows上经常崩溃,但在32 Windows上很少崩溃。 我在Windows 10.0.17763和10.0.17134中进行了测试。 在调试配置下的计算机上,它总是在Windows.UI.Xaml.dll!ctl :: ComObject :: AddRef()中崩溃,并且 在Outdoor.UWP.exe中的0x00007FF868934853(Windows.UI.Xaml.dll)处引发的异常:0xC0000005:访问冲突读取位置0x0000000000000008。 堆栈跟踪
Windows.UI.Xaml.dll!ctl :: ComObject :: AddRef()行83 C ++ [内联框架] Windows.UI.Xaml.dll!ctl :: addref_interface(DirectUI :: DependencyObject *)第121行C ++ Windows.UI.Xaml.dll!DirectUI :: DependencyObject :: AddRefForPeerReferenceHelper()行2585 C ++ [嵌入式框架] Windows.UI.Xaml.dll!DirectUI :: DependencyObject :: SetExpectedReferenceOnPeer(CDependencyObject *)第4001行C ++ [内联框架] Windows.UI.Xaml.dll!CFxCallbacks :: FrameworkCallbacks_SetExpectedReferenceOnPeer(CDependencyObject *)第1101行C ++ Windows.UI.Xaml.dll!CDependencyObject :: SetExpectedReferenceOnPeer()行2847 C ++ Windows.UI.Xaml.dll!CDependencyObject :: OnParentChange(CDependencyObject * pOldParent,CDependencyObject * pParent,bool hasAtLeastOneParent)行1623 C ++ Windows.UI.Xaml.dll!CMultiParentShareableDependencyObject :: AddParent(CDependencyObject * pNewParent,bool fPublic,void(*)(CDependencyObject *,DirtyFlags :: Value)pfnNewParentRenderChangedHandler)第53行C ++ [内联框架] Windows.UI.Xaml.dll!CDOCollection :: ChangeParent(CDependencyObject *)行1081 C ++ [嵌入式框架] Windows.UI.Xaml.dll!CDOCollection :: SetChildParent(CDependencyObject * fPublic,CDependencyObject *)第1193行C ++ Windows.UI.Xaml.dll!CDOCollection :: Append(CDependencyObject * pObject,unsigned int * pnIndex)第536行C ++ Windows.UI.Xaml.dll!CStateTriggerCollection :: Append(CDependencyObject *对象,无符号int *索引)第48行C ++ Windows.UI.Xaml.dll!CVisualStateManager2 :: FaultInStateTriggers(CVisualStateGroupCollection * groupCollection,CustomWriterRuntimeObjectCreator&creator)Line 612 C ++ Windows.UI.Xaml.dll!CVisualStateManager2 :: FaultInChildren(CVisualStateGroupCollection * groupCollection)行339 C ++ Windows.UI.Xaml.dll!CVisualStateGroupCollection :: EnsureFaultedIn()第255行C ++ Windows.UI.Xaml.dll!Jupiter :: VisualStateManager :: DeferredNameScopeEntry :: TryGetOrCreateElement(bool * shouldRetryLookup)第36行C ++ Windows.UI.Xaml.dll!Jupiter :: NameScoping :: NameScopeTableEntry :: TryGetElement(bool * shouldRetry)90行C ++ Windows.UI.Xaml.dll!Jupiter :: NameScoping :: StandardNameScopeTable :: TryGetElementImpl(const xstring_ptr_view&name,bool * shouldRetry)第23行C ++ [内联框架] 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)第57行C ++ Windows.UI.Xaml.dll!CCoreServices :: ClearNamedObject(const xstring_ptr_view&strName,const CDependencyObject * pNamescopeOwner,CDependencyObject * originalEntry)第135行C ++ Windows.UI.Xaml.dll!CDependencyObject :: UnregisterName(CDependencyObject * pNamescopeOwner)761行C ++ Windows.UI.Xaml.dll!CDependencyObject :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)行1189 C ++ Windows.UI.Xaml.dll!CVisualStateGroup :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)64行C ++ Windows.UI.Xaml.dll!CDependencyObject :: Leave(CDependencyObject * pNamescopeOwner,LeaveParams参数)行1122 C ++ Windows.UI.Xaml.dll!CDOCollection :: ChildLeave(CDependencyObject * pChild,CDependencyObject * pNamescopeOwner,LeaveParams参数,unsigned int fCanProcessEnterLeave)行401 C ++ Windows.UI.Xaml.dll!CDOCollection :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)第208行C ++ Windows.UI.Xaml.dll!CVisualStateGroupCollection :: LeaveImpl(CDependencyObject * namescopeOwner,LeaveParams参数)行183 C ++ Windows.UI.Xaml.dll!CDependencyObject :: Leave(CDependencyObject * pNamescopeOwner,LeaveParams参数)行1122 C ++ Windows.UI.Xaml.dll!CDependencyObject :: LeaveObjectProperty(CDependencyObject * pDO,CDependencyObject * namescopeOwner,LeaveParams参数)行1415 C ++ Windows.UI.Xaml.dll!CDependencyObject :: LeaveSparseProperties(CDependencyObject * namescopeOwner,LeaveParams参数)行1386 C ++ Windows.UI.Xaml.dll!CDependencyObject :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)1224行C ++ Windows.UI.Xaml.dll!CUIElement :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)行1676 C ++ Windows.UI.Xaml.dll!CFrameworkElement :: LeaveImpl(CDependencyObject * pNamescopeOwner,LeaveParams参数)2539行C ++ Windows.UI.Xaml.dll!CDependencyObject :: Leave(CDependencyObject * pNamescopeOwner,LeaveParams参数)行1122 C ++ Windows.UI.Xaml.dll!CDOCollection :: ChildLeave(CDependencyObject * pChild,CDependencyObject * pNamescopeOwner,LeaveParams参数,unsigned int fCanProcessEnterLeave)行401 C ++ Windows.UI.Xaml.dll!CDOCollection :: Neat(int bBreak)Line 852 C ++ Windows.UI.Xaml.dll!CCollection :: Destroy()第23行C ++ Windows.UI.Xaml.dll!CCollection :: Clear()第63行C ++ Windows.UI.Xaml.dll!CUIElementCollection :: RemoveAllElements(unsigned int bTryUnloadingElements)行1378 C ++ Windows.UI.Xaml.dll!CUIElement ::〜CUIElement()行387 C ++ Windows.UI.Xaml.dll!CPage ::`标量删除析构函数'(unsigned int)C ++ [内联框架] Windows.UI.Xaml.dll!CDependencyObject :: ReleaseImpl(unsigned int)Line 406 C ++ [内联框架] Windows.UI.Xaml.dll!CDependencyObject :: Release()Line 68 C ++ Windows.UI.Xaml.dll!DirectUI :: DependencyObject :: DisconnectFrameworkPeerCore()Line 508 C ++ [内联框架] Windows.UI.Xaml.dll!DirectUI :: DependencyObject :: DisconnectFrameworkPeer(unsigned int)Line 547 C ++ Windows.UI.Xaml.dll!DirectUI :: DependencyObject :: OnFinalRelease()行405 C ++ Windows.UI.Xaml.dll!ctl :: ComBase :: ReleaseImpl()第299行C ++ [内联框架] Windows.UI.Xaml.dll!ctl :: ComBase :: ReleaseDirect()行113 C ++ [嵌入式框架] Windows.UI.Xaml.dll!ctl :: release_interface_inner(ctl :: WeakReferenceSourceNoThreadId *)第62行C ++ Windows.UI.Xaml.dll!DirectUI :: UIAffinityReleaseQueue :: DoCleanup(unsigned char bSync,unsigned char *已完成)行195 C ++ Windows.UI.Xaml.dll!DirectUI :: UIAffinityReleaseQueue :: BuildTree(unsigned char * returnValue)第44行C ++ Windows.UI.Xaml.dll!DirectUI :: BuildTreeService :: BuildTrees(bool * pWorkLeft)第111行C ++ Windows.UI.Xaml.dll!AgCoreCallbacks :: FrameworkCallbacks_PhasedWorkDistributor_PerformWork(unsigned int * pWorkleft)560行C ++ [内联框架] Windows.UI.Xaml.dll!CFxCallbacks :: FrameworkCallbacks_PhasedWorkDistributor_PerformWork(unsigned int *)1131行C ++ Windows.UI.Xaml.dll!CCoreServices :: NWDrawTree(HWWalk * pHWWalk,CWindowRenderTarget * pRenderTarget,VisualTree * pVisualTree,unsigned int forceRedraw,XRECT_WH * prcDirtyRect)第6982行C ++ Windows.UI.Xaml.dll!CCoreServices :: NWDrawMainTree(CWindowRenderTarget * pIRenderTarget,bool fForceRedraw,XRECT_WH * prcDirtyRect)6723行C ++ Windows.UI.Xaml.dll!CWindowRenderTarget :: Draw(CCoreServices * fForceRedraw,unsigned int prcDirtyRect,XRECT_WH *)第137行C ++ Windows.UI.Xaml.dll!CXcpBrowserHost :: OnTick()行538 C ++ Windows.UI.Xaml.dll!CXcpDispatcher :: Tick()行1446 C ++ Windows.UI.Xaml.dll!CXcpDispatcher :: OnReentrancyProtectedWindowMessage(HWND__ * msg,unsigned int lParam,unsigned int64)行1046 C ++ [嵌入式框架] Windows.UI.Xaml.dll!CXcpDispatcher :: ProcessMessage(HWND *)887行C ++ Windows.UI.Xaml.dll!CXcpDispatcher :: WindowProc(HWND__ * hwnd,unsigned int msg,unsigned __int64 wParam,__int64 lParam)836行C ++ Windows.UI.Xaml.dll!CDeferredInvoke :: DispatchQueuedMessage(bool * dispatchedWork,bool * hasMoreWork)第299行C ++ [内联框架] Windows.UI.Xaml.dll!CXcpDispatcher :: MessageTimerCallback()第1531行C ++ Windows.UI.Xaml.dll!CXcpDispatcher :: MessageTimerCallbackStatic(void * myUserData)第1523行C ++ CoreMessaging.dll!00007ff88ec472bc()未知 CoreMessaging.dll!00007ff88ec6863d()未知 CoreMessaging.dll!00007ff88ec4c150()未知 CoreMessaging.dll!00007ff88ec4b270()未知 CoreMessaging.dll!00007ff88ec4a175()未知 CoreMessaging.dll!00007ff88ec49fac()未知 user32.dll!00007ff89301ca66()未知 user32.dll!00007ff89301c78c()未知 user32.dll!00007ff89302fa83()未知 ntdll.dll!00007ff894ee3494()未知 win32u.dll!00007ff8916610c4()未知 user32.dll!00007ff89301e4e2()未知 user32.dll!00007ff89301e3be()未知 Windows.UI.dll!00007ff888bb5232()未知 Windows.UI.dll!00007ff888bb502e()未知 Windows.UI.dll!00007ff888bb4edb()未知 Windows.UI.Xaml.dll!CJupiterWindow :: RunCoreWindowMessageLoop()行1246 C ++ [内联框架] Windows.UI.Xaml.dll!CJupiterControl :: RunMessageLoop()Line 1024 C ++ Windows.UI.Xaml.dll!DirectUI :: DXamlCore :: RunMessageLoop()Line 2446 C ++ twinapi.appcore.dll!00007ff88f574c2a()未知 twinapi.appcore.dll!00007ff88f547a66()未知 SHCore.dll!00007ff8931dc315()未知 kernel32.dll!00007ff892087974()未知 ntdll.dll!00007ff894eaa271()未知
请帮助我。
我从XAML中删除了“ {x:Null}”,并在所有IValueConverter的ConvertBack方法中将NotImplementedException的抛出NotImplementedException更改为DependencyProperty.UnsetValue。但这并不能解决我的问题。
答案 0 :(得分:0)
我创建了一些继承自Control和Page的用户控件。这些控件中的模板根是Grid和Border。我向这些xaml元素添加了具有状态“ Normal”和“ PointerOver”的可视组“ CommonStates”,并在OnPointerEntered和OnPointerExited事件处理程序中选择了这些状态。我必须添加这些状态,因为这些控件中没有默认状态,并且当用户将鼠标悬停在用户控件上时,我不知道另一种更改界面的方法。 显示此类页面后,应用程序将能够在不同位置使用此堆栈跟踪崩溃:在用户在页面之间切换时,这种情况非常常见。 解决方案:将组重命名为“ MyCommonStates”,并将状态重命名为“ MyNormal”和“ MyPointerOver”。之后,我的应用程序可以工作2到3周。 Xaml我的控件。
<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>
有人可以向我解释为什么它可以解决我的问题吗?