2016-02-03 116 views
1

在我們的Windows 10 UWP應用程序中,我們在隨機頁面導航期間遭受堆損壞。時序和位置總是不同,但結果相同,當Native調試打開時堆損壞,關閉時立即崩潰。堆腐敗窗口10

以下是堆損壞時的調用堆棧,其中包含儘可能多的信息,因爲我們可以從Visual Studio收集這些信息。

[email protected]() 
[email protected]() 
[email protected]() 
ntdll.dll!RtlSizeHeap() 
Windows.UI.Xaml.dll!XcpAllocation::OSMemoryFree(void * pAddress=0x0b4164f0) 
Windows.UI.Xaml.dll!ctl::SupportErrorInfo::`scalar deleting destructor'(unsigned int) 
Windows.UI.Xaml.dll!ctl::ComBase::OnFinalRelease() 
Windows.UI.Xaml.dll!ctl::ComBase::ReleaseImpl() 
Windows.UI.Xaml.dll!DirectUI::UIAffinityReleaseQueue::DoCleanup(unsigned char bSync='\0', unsigned char * pbCompleted=0x058ff5af) 
Windows.UI.Xaml.dll!DirectUI::UIAffinityReleaseQueue::BuildTree(unsigned char * returnValue=0x058ff5f2) 
Windows.UI.Xaml.dll!DirectUI::BuildTreeService::BuildTrees(bool * pWorkLeft=0x058ff62b) 
Windows.UI.Xaml.dll!AgCoreCallbacks::FrameworkCallbacks_PhasedWorkDistributor_PerformWork(unsigned int * pWorkleft=0x058ff6a4) 
Windows.UI.Xaml.dll!CCoreServices::NWDrawTree(HWWalk * pHWWalk=0x0082cab8, ICoreRenderTarget * pIRenderTarget=0x008fb444, VisualTree * pVisualTree=0x00886668, unsigned int forceRedraw=0, XRECT_WH * prcDirtyRect=0x058ff7f8) 
Windows.UI.Xaml.dll!CCoreServices::NWDrawMainTree(ICoreRenderTarget * pIRenderTarget=0x008fb444, bool fForceRedraw=false, XRECT_WH * prcDirtyRect=0x058ff7f8) 
Windows.UI.Xaml.dll!CWindowRenderTarget::Draw(CCoreServices * pCore=0x008f2ea0, unsigned int fForceRedraw=0, XRECT_WH * prcDirtyRect=0x058ff7f8) 
Windows.UI.Xaml.dll!CXcpBrowserHost::OnTick() 
Windows.UI.Xaml.dll!CXcpDispatcher::Tick() 
Windows.UI.Xaml.dll!CXcpDispatcher::OnReentrancyProtectedWindowMessage(HWND__ * msg=1026, unsigned int lParam=0, unsigned int hr=0x058ff41c, long reentrancyGuard) 
Windows.UI.Xaml.dll!CXcpDispatcher::WindowProc(HWND__ * hwnd=0x001906aa, unsigned int msg=1026, unsigned int wParam=0, long lParam=0) 
[email protected]() 
user32.dll!UserCallWinProcCheckWow() 
user32.dll!DispatchMessageWorker() 
[email protected]() 
Windows.UI.dll!Windows::UI::Core::CDispatcher::ProcessMessage(int bDrainQueue=1, int * pbAnyMessages=0x00000000) 
Windows.UI.dll!Windows::UI::Core::CDispatcher::WaitAndProcessMessages(void * hEventWait=0x00000000) 
Windows.UI.dll!Windows::UI::Core::CDispatcher::ProcessEvents(Windows::UI::Core::CoreProcessEventsOption options=CoreProcessEventsOption_ProcessUntilQuit) 
Windows.UI.Xaml.dll!CJupiterWindow::RunCoreWindowMessageLoop() 
Windows.UI.Xaml.dll!CJupiterControl::RunMessageLoop() 
Windows.UI.Xaml.dll!DirectUI::DXamlCore::RunMessageLoop() 
Windows.UI.Xaml.dll!DirectUI::FrameworkView::Run() 
twinapi.appcore.dll!Windows::ApplicationModel::Core::CoreApplicationView::Run(void) 
twinapi.appcore.dll!Microsoft::WRL::Details::Make<struct Microsoft::WRL::Details::InvokeHelper<struct Windows::Foundation::IAsyncActionCompletedHandler,class <lambda_e4b1934750ab38adfb74f12296e81f29>,2>,class <lambda_e4b1934750ab38adfb74f12296e81f29> &>(class <lambda_e4b1934750ab38adfb74f12296e81f29> &) 
SHCore.dll!CallerIdentity::GetCallingProcessHandle(unsigned long,enum RUNTIMEBROKER_CALLERIDENTITY_CHECK,void * *) 
[email protected]@12() 
ntdll.dll!__RtlUserThreadStart() 
[email protected]() 

任何人都有機會遇到這個問題,或者接近問題並設法解決它?提前致謝。

編輯! 有一些新的信息!可悲的是沒有鎖定,但尚未取得進展... :)

原來,問題是由用於創建自適應接口VisualStateGroups造成如下所示:

<Style TargetType="controls:CollectionView"> 
    <Setter Property="RelativePanel.AlignLeftWithPanel" Value="True"/> 
    <Setter Property="RelativePanel.AlignRightWithPanel" Value="True"/> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="controls:CollectionView"> 
       <Grid> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="Auto"/> 
         <RowDefinition Height="*"/> 
        </Grid.RowDefinitions> 

        <GridView x:Name="List" 
           Grid.Row="1" 
           BorderBrush="Black" 
           ItemsSource="{TemplateBinding ItemsSource}" 
           ItemTemplate="{TemplateBinding ItemTemplate}" 
           SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem, Mode=TwoWay}" 
           ShowsScrollingPlaceholders="False" 
           Background="Transparent" 
           RelativePanel.AlignLeftWithPanel="True" 
           RelativePanel.AlignRightWithPanel="True"> 
        </GridView> 

        <VisualStateManager.VisualStateGroups> 
         <VisualStateGroup> 
          <VisualState x:Name="UnSelectable"> 
           <VisualState.StateTriggers> 
            **<StateTrigger IsActive="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsNotSelectable}"/>** 
           </VisualState.StateTriggers> 

           <VisualState.Setters> 
            <Setter Target="List.Background" Value="#AAAAAA"/> 
            <Setter Target="List.IsHitTestVisible" Value="False"/> 
           </VisualState.Setters> 
          </VisualState> 
         </VisualStateGroup> 
        </VisualStateManager.VisualStateGroups> 
       </Grid> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 

如果我停用上述statetrigger的應用程序不會崩潰,可悲的是我需要這種狀態內的邏輯......任何可能的工作或解釋我做錯了什麼?

+0

通常我們不會使用這種樣式。你認爲你想達到什麼目的? –

+0

我想調整GridView的背景顏色,基於頁面中控件上添加的IsSelectable屬性的設置。 大部分我想知道爲什麼使用綁定來設置StateTrigger的值會導致堆損壞。我使用的設置不應該是那麼奇怪,如果你問我... 任何反饋或工作將受到歡迎:) –

+0

@ GraceFeng-MSFT所以沒有辦法提供一個StateTrigger的值使用綁定在MVVM結構化應用? –

回答