- 
                Notifications
    You must be signed in to change notification settings 
- Fork 772
Open
Labels
area-ErrorHandlingIssues related to error reporting and debuggingIssues related to error reporting and debuggingarea-VSMarea-XamlCompilerbugSomething isn't workingSomething isn't workingneeds-winui-3Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)product-winui3WinUI 3 issuesWinUI 3 issuesteam-MarkupIssue for the Markup teamIssue for the Markup teamwct
Description
Describe the bug
Trying to override the NavigationView style is causing a crash in OnApplyTemplate when we move the VisualStateManager to its proper location.
Steps to reproduce the bug
- https://github.com/michael-hawker/UWPCommunityToolkit/tree/onapplytemplate_crash
- Run Toolkit Sample App
- Open on TabbedCommandBar sample
Expected behavior
Not crash or coherent error message.
Version Info
NuGet package version: WinUI 2.6.1
Windows app type:
| UWP | Win32 | 
|---|---|
| Yes | 
| Windows version | Saw the problem? | 
|---|---|
| 21H1 (19043) | Yes | 
| October 2020 Update (19042) | |
| May 2020 Update (19041) | |
| November 2019 Update (18363) | |
| May 2019 Update (18362) | |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | 
| Device form factor | Saw the problem? | 
|---|---|
| Desktop | |
| Xbox | |
| Surface Hub | |
| IoT | 
Additional context
Our template is about 80% the same as the inbox NavigationView, we have another Grid around the whole template, which I realized we hadn't moved our VSM up into (as the VSM wasn't firing). When moving the VSM up into the top-level Grid, it crashes. If you remove the VSM, it doesn't crash (but also doesn't behave as expected).
Stack Trace:
Exception thrown at 0x00007FFDE1D04ED9 in Microsoft.Toolkit.Uwp.SampleApp.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000FF3DAFB2F0.
>	Microsoft.Toolkit.Uwp.UI.Controls.Core.dll!Microsoft.Toolkit.Uwp.UI.Controls.TabbedCommandBar.OnApplyTemplate() Line 49	C#
 	[Native to Managed Transition]	
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElementGenerated::OnApplyTemplateProtected() Line 1096	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElement::OnApplyTemplateFromCore(CFrameworkElement * nativeTarget) Line 191	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CFxCallbacks::FrameworkElement_OnApplyTemplate(CFrameworkElement *) Line 850	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::InvokeApplyTemplate(unsigned char * bAddedVisuals) Line 1289	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::MeasureCore(XSIZEF availableSize, XSIZEF & desiredSize) Line 1561	C++
 	Windows.UI.Xaml.dll!CUIElement::MeasureInternal(XSIZEF availableSize) Line 4121	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 3981	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CGrid::MeasureCell(CUIElement * const rowHeightTypes, const CellUnitTypes columnWidthTypes, const CellUnitTypes) Line 479	C++
 	Windows.UI.Xaml.dll!CGrid::MeasureCellsGroup(unsigned int cellsHead, unsigned int cellCount, const float rowSpacing, const float columnSpacing, const bool ignoreColumnDesiredSize, const bool forceRowToInfinity, Jupiter::stack_vector<CellCache,16> & cellCacheVector) Line 359	C++
 	Windows.UI.Xaml.dll!CGrid::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 1219	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::MeasureCore(XSIZEF availableSize, XSIZEF & desiredSize) Line 1614	C++
 	Windows.UI.Xaml.dll!CUIElement::MeasureInternal(XSIZEF availableSize) Line 4121	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 3981	C++
 	[Inline Frame] Windows.UI.Xaml.dll!UIElement_Measure(CUIElement *) Line 999	C++
 	Windows.UI.Xaml.dll!DirectUI::UIElement::MeasureImpl(Windows::Foundation::Size availableSize) Line 573	C++
 	Windows.UI.Xaml.dll!DirectUI::UIElementGenerated::Measure(Windows::Foundation::Size availableSize) Line 4318	C++
 	Windows.UI.Xaml.dll!DirectUI::Page::MeasureOverride(Windows::Foundation::Size availableSize, Windows::Foundation::Size * pReturnValue) Line 628	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElementGenerated::MeasureOverrideProtected(Windows::Foundation::Size availableSize, Windows::Foundation::Size * pReturnValue) Line 1056	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElement::MeasureOverrideFromCore(CFrameworkElement * nativeTarget, float inWidth, float inHeight, float * outWidth, float * outHeight) Line 255	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CFxCallbacks::FrameworkElement_MeasureOverride(CFrameworkElement *) Line 844	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::MeasureCore(XSIZEF availableSize, XSIZEF & desiredSize) Line 1597	C++
 	Windows.UI.Xaml.dll!CUIElement::MeasureInternal(XSIZEF availableSize) Line 4121	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 3981	C++
 	Windows.UI.Xaml.dll!CContentPresenter::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 845	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::MeasureCore(XSIZEF availableSize, XSIZEF & desiredSize) Line 1614	C++
 	Windows.UI.Xaml.dll!CUIElement::MeasureInternal(XSIZEF availableSize) Line 4121	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 3981	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CUIElement::Measure(XSIZEF availableSize) Line 4031	C++
 	Windows.UI.Xaml.dll!CLayoutManager::UpdateLayout(unsigned int controlWidth, unsigned int controlHeight) Line 279	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CLayoutManager::UpdateLayout() Line 226	C++
 	Windows.UI.Xaml.dll!CUIElement::UpdateLayout() Line 3729	C++
 	Windows.UI.Xaml.dll!CUIElement::BoundsTestEntry<XPOINTF>(const HitTestParams & hitTestParams, const XPOINTF & target, CBoundedHitTestVisitor * pCallback, bool canHitDisabledElements, bool canHitInvisibleElements) Line 15243	C++
 	Windows.UI.Xaml.dll!CUIElement::HitTestEntry(const HitTestParams & hitTestParams, XPOINTF hitPoint, bool canHitMultipleElements, bool canHitDisabledElements, bool canHitInvisibleElements, CHitTestResults * pHitElements) Line 2456	C++
 	Windows.UI.Xaml.dll!CUIElement::HitTestEntry(const HitTestParams & hitTestParams, XPOINTF hitPoint, bool canHitDisabledElements, bool ppHitElement, CUIElement * *) Line 2430	C++
 	Windows.UI.Xaml.dll!CCoreServices::HitTest(XPOINTF ptHit, CDependencyObject * pHitTestRoot, CDependencyObject * * ppVisualHit, bool hitDisabledElement) Line 4646	C++
 	Windows.UI.Xaml.dll!ContentRootInput::PointerInputProcessor::HitTestHelper(XPOINTF ptHit, CDependencyObject * pHitTestRoot, CDependencyObject * * ppVisualHit) Line 1043	C++
 	Windows.UI.Xaml.dll!ContentRootInput::PointerInputProcessor::HitTestWithLightDismissAwareness(xref_ptr<CDependencyObject> & contactDO, XPOINTF contactPoint, MessageMap message, PointerInfo * pointerInfo, CDependencyObject * hitTestRoot) Line 1085	C++
 	Windows.UI.Xaml.dll!ContentRootInput::PointerInputProcessor::ProcessPointerInput(InputMessage * pMsg, int * handled) Line 263	C++
 	Windows.UI.Xaml.dll!CInputServices::ProcessInput(InputMessage * pMsg, CContentRoot * contentRoot, int * handled) Line 888	C++
 	Windows.UI.Xaml.dll!CCoreServices::ProcessInput(InputMessage * pMessage, CContentRoot * contentRoot, int * fHandled) Line 992	C++
 	Windows.UI.Xaml.dll!CXcpBrowserHost::ReplayPreviousPointerUpdate(unsigned int previousPointerUpdateMsgId) Line 1893	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::OnWindowMessage(HWND__ * msg, unsigned int wParam, unsigned __int64 lParam, __int64) Line 1178	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CXcpDispatcher::ProcessMessage(HWND__ *) Line 911	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::WindowProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 842	C++
 	Windows.UI.Xaml.dll!CDeferredInvoke::DispatchQueuedMessage(bool * dispatchedWork, bool * hasMoreWork) Line 301	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallback() Line 1534	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallbackStatic(void * myUserData) Line 1526	C++
 	CoreMessaging.dll!00007ffddf1f53db()	Unknown
 	CoreMessaging.dll!00007ffddf21c85b()	Unknown
 	CoreMessaging.dll!00007ffddf1f996b()	Unknown
 	CoreMessaging.dll!00007ffddf1f8e26()	Unknown
 	CoreMessaging.dll!00007ffddf1f7061()	Unknown
 	CoreMessaging.dll!00007ffddf1f6e83()	Unknown
 	user32.dll!00007ffde2d0e858()	Unknown
 	user32.dll!00007ffde2d0e3dc()	Unknown
 	user32.dll!00007ffde2d20bc3()	Unknown
 	ntdll.dll!00007ffde4630c54()	Unknown
 	win32u.dll!00007ffde2401064()	Unknown
 	user32.dll!00007ffde2d0a5c3()	Unknown
 	user32.dll!00007ffde2d0a523()	Unknown
 	Windows.UI.dll!00007ffdd1cba8ae()	Unknown
 	Windows.UI.dll!00007ffdd1cba680()	Unknown
 	Windows.UI.dll!00007ffdd1cba50b()	Unknown
 	Windows.UI.Xaml.dll!CJupiterWindow::RunCoreWindowMessageLoop() Line 1234	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CJupiterControl::RunMessageLoop() Line 1065	C++
 	Windows.UI.Xaml.dll!DirectUI::DXamlCore::RunMessageLoop() Line 2463	C++
 	twinapi.appcore.dll!00007ffddc8a5eca()	Unknown
 	twinapi.appcore.dll!00007ffddc85e65f()	Unknown
 	SHCore.dll!00007ffde42be449()	Unknown
 	kernel32.dll!00007ffde2eb7034()	Unknown
 	ntdll.dll!00007ffde45e2651()	Unknown
marcelwgn and yoshiask
Metadata
Metadata
Assignees
Labels
area-ErrorHandlingIssues related to error reporting and debuggingIssues related to error reporting and debuggingarea-VSMarea-XamlCompilerbugSomething isn't workingSomething isn't workingneeds-winui-3Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)product-winui3WinUI 3 issuesWinUI 3 issuesteam-MarkupIssue for the Markup teamIssue for the Markup teamwct