Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting Segmented #157

Merged
merged 6 commits into from
Aug 3, 2023
Merged

Porting Segmented #157

merged 6 commits into from
Aug 3, 2023

Conversation

niels9001
Copy link
Collaborator

No description provided.

@niels9001 niels9001 marked this pull request as draft July 22, 2023 19:01
@niels9001 niels9001 marked this pull request as ready for review July 24, 2023 16:31
@niels9001
Copy link
Collaborator Author

niels9001 commented Jul 24, 2023

Getting an error when running the sample on UWP. Working fine for WASDK and WASM!

System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. at Windows.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)

@michael-hawker
Copy link
Member

The Segmented control tests are also causing issues over on the Labs-Windows repo, so we need to resolve/understand that issue before we bring them over here, though maybe they won't have an issue as we build Extensions from source here vs. as a package in Labs? 🤔 (Still there's a dependency conflict we don't understand happening over there.)

@michael-hawker
Copy link
Member

@Arlodotexe interestingly the original PR passed the build, updating the tooling and will see if these tests fail again the same way.

If they don't, then I may suspect it has something to do with the package reference vs. project reference?

@michael-hawker
Copy link
Member

Grabbed the full callstack with mixed debugging:

>	[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!CStackPanel::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 50	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 1052	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 866	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!CControl::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 420	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++
 	[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++
 	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++
 	Windows.UI.Xaml.dll!CCoreServices::NWDrawTree(HWWalk * pHWWalk, CWindowRenderTarget * pRenderTarget, VisualTree * pVisualTree, unsigned int forceRedraw, XRECT_WH * prcDirtyRect) Line 6294	C++
 	Windows.UI.Xaml.dll!CCoreServices::NWDrawMainTree(CWindowRenderTarget * pIRenderTarget, bool fForceRedraw, XRECT_WH * prcDirtyRect) Line 6084	C++
 	Windows.UI.Xaml.dll!CWindowRenderTarget::Draw(CCoreServices * fForceRedraw, unsigned int prcDirtyRect, XRECT_WH *) Line 136	C++
 	Windows.UI.Xaml.dll!CXcpBrowserHost::OnTick() Line 545	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::Tick() Line 1449	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::OnReentrancyProtectedWindowMessage(HWND__ * msg, unsigned int lParam, unsigned __int64) Line 1041	C++

I don't even see the segmented control here...

With some breakpoints, I see the Segmented control constructor, the OnApplyTemplate called as well. I see EqualPanel getting initialized, but I don't see it's MeasureOverride called...


Saw some other weird exceptions about uri lookups, but think unrelated:

image
Along with Colors, ItemTemplates, TitleBar...

@michael-hawker
Copy link
Member

michael-hawker commented Jul 28, 2023

Tried putting a MaxWidth on the sample stack panel, but that didn't do anything...

I then commented out the first 'Basics' sample, and was able to see the PivotSegmentedStyle and ButtonSegmentedStyle working... That would seem to indicate still an issue with the panel maybe.

@michael-hawker
Copy link
Member

I removed the binding to the HorizontalAlignment of the EqualPanel:

            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <local:EqualPanel Spacing="{ThemeResource SegmentedItemSpacing}" />
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>

And that then loaded... so that leads back to the Framework Ancestor Extension which is what's jamming up our tests for this same control in the Labs repo... which seems a bit too coincidental... but we didn't have this problem before either...

@michael-hawker
Copy link
Member

Not sure if needed but turned on https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.debugsettings.failfastonerrors (same exists on UWP) and removed the usage of the Ancestor, and got this stack:

Exception thrown at 0x00007FFA43CCF98D (Windows.UI.Xaml.dll) in SegmentedExperiment.Samples.Uwp.exe: 0xC0000005: Access violation reading location 0x0000000000000010.
>	Windows.UI.Xaml.dll!ObjectWriterRuntime::TypeConvertValueImpl(const XamlLineInfo & lineInfo, std::shared_ptr<XamlServiceProviderContext> spContext, const std::shared_ptr<XamlType> & spType, const std::shared_ptr<XamlTextSyntax> & spTextSyntaxConverter, const std::shared_ptr<XamlQualifiedObject> & spValue, bool fIsPropertyAssignment, std::shared_ptr<XamlQualifiedObject> & spInstance) Line 164	C++
 	[Inline Frame] Windows.UI.Xaml.dll!ObjectWriterCommonRuntime::TypeConvertValue(const XamlLineInfo &) Line 152	C++
 	Windows.UI.Xaml.dll!BinaryFormatObjectWriter::TypeConvertValue(const ObjectWriterNode & node, const std::shared_ptr<XamlType> & spType, const std::shared_ptr<XamlTextSyntax> & spConverter, const bool createValueTypeAsObject, std::shared_ptr<XamlQualifiedObject> & spConvertedInstance) Line 734	C++
 	Windows.UI.Xaml.dll!BinaryFormatObjectWriter::WriteNode(const ObjectWriterNode & inNode) Line 196	C++
 	Windows.UI.Xaml.dll!CTemplateContent::LoadXbfVersion2(const ObjectWriterSettings & objectWriterSettings, bool bTryOptimizeContent, std::shared_ptr<XamlQualifiedObject> & spRootInstance) Line 699	C++
 	Windows.UI.Xaml.dll!CTemplateContent::Load(const ObjectWriterSettings & objectWriterSettings, bool bTryOptimizeContent, CDependencyObject * * ppDependencyObject) Line 488	C++
 	Windows.UI.Xaml.dll!CFrameworkTemplate::LoadContent(CDependencyObject * * ppResult, CDependencyObject * pTemplatedParent, unsigned int bRegisterNamesInTemplateNamescope, bool skipRegistrationEntirely, const std::shared_ptr<XamlQualifiedObject> & xBindConnector) Line 197	C++
 	Windows.UI.Xaml.dll!CItemsPanelTemplate::LoadContent(CDependencyObject * * ppResult, CDependencyObject * pTemplatedParent) Line 277	C++
 	Windows.UI.Xaml.dll!CItemsPresenter::AddItemsHost(CItemsControl * pItemsControl) Line 189	C++
 	Windows.UI.Xaml.dll!CItemsPresenter::ApplyTemplate(bool & fAddedVisuals) Line 156	C++
 	Windows.UI.Xaml.dll!CFrameworkElement::InvokeApplyTemplate(unsigned char * bAddedVisuals) Line 1265	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++
 	Windows.UI.Xaml.dll!CGrid::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 1021	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!CControl::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 420	C++
 	Windows.UI.Xaml.dll!CItemsControl::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 352	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CFrameworkElement::MeasureOverrideForPInvoke(XSIZEF) Line 1487	C++
 	[Inline Frame] Windows.UI.Xaml.dll!FrameworkElement_MeasureOverride(CFrameworkElement *) Line 763	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElement::MeasureOverrideImpl(Windows::Foundation::Size availableSize, Windows::Foundation::Size * returnValue) Line 210	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElementGenerated::MeasureOverride(Windows::Foundation::Size availableSize, Windows::Foundation::Size * pReturnValue) Line 1035	C++
 	Windows.UI.Xaml.dll!DirectUI::FrameworkElementGenerated::MeasureOverrideProtected(Windows::Foundation::Size availableSize, Windows::Foundation::Size * pReturnValue) Line 1052	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!CStackPanel::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 50	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 1052	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 866	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!CControl::MeasureOverride(XSIZEF availableSize, XSIZEF & desiredSize) Line 420	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++
 	[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++
 	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++
 	[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 1251	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!CLayoutManager::UpdateLayout(unsigned int controlWidth, unsigned int controlHeight) Line 279	C++
 	Windows.UI.Xaml.dll!CCoreServices::NWDrawTree(HWWalk * pHWWalk, CWindowRenderTarget * pRenderTarget, VisualTree * pVisualTree, unsigned int forceRedraw, XRECT_WH * prcDirtyRect) Line 6294	C++
 	Windows.UI.Xaml.dll!CCoreServices::NWDrawMainTree(CWindowRenderTarget * pIRenderTarget, bool fForceRedraw, XRECT_WH * prcDirtyRect) Line 6084	C++
 	Windows.UI.Xaml.dll!CWindowRenderTarget::Draw(CCoreServices * fForceRedraw, unsigned int prcDirtyRect, XRECT_WH *) Line 136	C++
 	Windows.UI.Xaml.dll!CXcpBrowserHost::OnTick() Line 545	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::Tick() Line 1449	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::OnReentrancyProtectedWindowMessage(HWND__ * msg, unsigned int lParam, unsigned __int64) Line 1041	C++
 	[Inline Frame] Windows.UI.Xaml.dll!CXcpDispatcher::ProcessMessage(HWND__ *) Line 890	C++
 	Windows.UI.Xaml.dll!CXcpDispatcher::WindowProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 839	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!00007ffa52ed529b()	Unknown
 	CoreMessaging.dll!00007ffa52efc39b()	Unknown
 	CoreMessaging.dll!00007ffa52ed9d84()	Unknown
 	CoreMessaging.dll!00007ffa52ed8d36()	Unknown
 	CoreMessaging.dll!00007ffa52ed6f71()	Unknown
 	CoreMessaging.dll!00007ffa52ed6d2a()	Unknown
 	user32.dll!00007ffa5783e858()	Unknown
 	user32.dll!00007ffa5783e299()	Unknown
 	Windows.UI.dll!00007ffa4525a98b()	Unknown
 	Windows.UI.dll!00007ffa4525a680()	Unknown
 	Windows.UI.dll!00007ffa4525a50b()	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!00007ffa50535dca()	Unknown
 	twinapi.appcore.dll!00007ffa504ee65f()	Unknown
 	SHCore.dll!00007ffa5810bf69()	Unknown
 	kernel32.dll!00007ffa57ce7614()	Unknown
 	ntdll.dll!00007ffa58a026b1()	Unknown

Had also tried to use ListViewBase as the binding type to eliminate the namesapce, but that didn't work either.

@Arlodotexe
Copy link
Member

Arlodotexe commented Jul 29, 2023

I managed to get this stack trace out of a FastFail (mixed debugging enabled)

Exception thrown at 0x00007FFD66534B2C in CommunityToolkit.Tests.Uwp.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000002FC2788B0.
Exception thrown at 0x00007FFD66534B2C in CommunityToolkit.Tests.Uwp.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown: 'System.MissingMethodException' in Unknown Module.
Exception thrown at 0x00007FFD66534B2C (KernelBase.dll) in CommunityToolkit.Tests.Uwp.exe: WinRT originate error - 0x80131513 : 'System.MissingMethodException: Method not found: 'Void CommunityToolkit.WinUI.FrameworkElementExtensions.SetAncestorType(Windows.UI.Xaml.DependencyObject, System.Type)'.
   at CommunityToolkit.Labs.WinUI.SegmentedControlRns.CommunityToolkit_Labs_WinUI_SegmentedControl_XamlTypeInfo.XamlTypeInfoProvider.set_5_FrameworkElementExtensions_AncestorType(Object instance, Object Value)'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD67EAC07A: (caller: 00007FFD67EB15EF) ReturnHr(6) tid(f054) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFD66534B2C (KernelBase.dll) in CommunityToolkit.Tests.Uwp.exe: WinRT originate error - 0x802B000A : 'Failed to assign to property 'CommunityToolkit.WinUI.FrameworkElementExtensions.AncestorType'. [Line: 0 Position: 0]'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD67EAC07A: (caller: 00007FFD67EB15EF) ReturnHr(7) tid(f054) 8007007E The specified module could not be found.
Exception thrown: 'System.Runtime.InteropServices.COMException' in Unknown Module.
Exception thrown at 0x00007FFD66534B2C (KernelBase.dll) in CommunityToolkit.Tests.Uwp.exe: WinRT originate error - 0x80004005 : 'System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Windows.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD67EAC07A: (caller: 00007FFD67EB15EF) ReturnHr(8) tid(f054) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD67EAC07A: (caller: 00007FFD6804CC72) ReturnHr(9) tid(f054) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD67EAC07A: (caller: 00007FFD6804C64E) ReturnHr(10) tid(f054) 8007007E The specified module could not be found.
Unhandled exception at 0x00007FFD37E82360 (Windows.UI.Xaml.dll) in CommunityToolkit.Tests.Uwp.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x00000145A829C0F0, 0x0000000000000006).

In this trace, it appears the method SetAncestorType is just entirely missing.

In @michael-hawker's trace, it looks like it's failing to convert the XAML type provided to AncestorType when the template is loaded in. I've seen this before, if i can get the same trace locally I'll try the workaround: https://stackoverflow.com/a/63151909/5953220

It's still confusing why this only happens in the test app and not the sample app when they share the same codebase. Maybe something about the Sample app compiling with .NET Native?

@michael-hawker
Copy link
Member

Thanks @Arlodotexe, that makes it seem like the same root issues we're facing with the tests. Was that from the Labs environment or this specific PR in the sample app?

Which I think may be due to a mismatch of versioning between the Extensions NuGet package? As the API changed slightly here with this commit: 0a7b623

Though theoretically in the main repo here everything should work as it should all be source code references...

@michael-hawker michael-hawker self-assigned this Aug 2, 2023
@michael-hawker
Copy link
Member

Will try updating this branch once we get the converters fixes in, while working on Labs fixing that build I did test the Segmented control there on UWP and it was perfectly fine (believe I tested both Debug and Release). So will be confusing if still not working here... would mean something is different between Labs environment and our environment here... which wouldn't make much sense.

@michael-hawker michael-hawker marked this pull request as draft August 3, 2023 17:08
@michael-hawker
Copy link
Member

michael-hawker commented Aug 3, 2023

Good to see a clean build. Converted back to draft until I validate locally if UWP is working again... if it's not, it's very odd as it was fine in Labs... but could have been due to assembly mismatch we had with extensions still somehow, maybe?

@michael-hawker
Copy link
Member

As far as I can tell, besides the namespace changes, the only difference to the code is that in Labs there was a package reference to the 'Helpers' and in this repo it's just a ProjectReference to the Extensions (was helpers before in either case didn't change anything)...

It's really weird that having the direct code reference should make a difference here...

@michael-hawker
Copy link
Member

Wonder if it has something to do with built vs. source reference, going to test by building NuGets locally and then trying the segmented package directly in another UWP test app.

@michael-hawker
Copy link
Member

image

I've manually validated with locally built Release mode NuGet packages that when running as a UWP app from a NuGet package that the Segmented control is working fine... Which would explain a bit why it's working in Labs as that's referencing the Extensions package via a NuGet package and not source... Just a very odd issue.

Checked in Release mode of the app too (and fine), but this really just feels like some sort of UWP/Compiler/WinUI type bug that we'll want to file... Not sure the best approach for that. Something we can look into later. @niels9001 maybe we can take the WinUI 2+3 template and copy the segmented control and the Framework Extension into there and see if we can get an isolated repo. Though considering this works on WASDK fine without issue then it's probably not something we can expect a fix for. We may just need to make a note somewhere for local development of this control that it has to be done on WASDK or WASM and then checked on UWP as part of a NuGet package build?

It does mean that the sample may crash when building the sample app all-up locally as well, but I think we'll be ok...?

@michael-hawker michael-hawker marked this pull request as ready for review August 3, 2023 20:03
@michael-hawker michael-hawker enabled auto-merge (squash) August 3, 2023 20:08
@michael-hawker michael-hawker merged commit 0aed035 into main Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants