[regression/8.0.0-preview.6.8686] [WinUI] CollectionView throws an exception after adding a second item #16320
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
fixed-in-8.0.0-rc.1.9171
Look for this fix in 8.0.0-rc.1.9171
i/regression
This issue described a confirmed regression on a currently supported version
layout-grid
partner
Issue or Request from a partner team
platform/windows 🪟
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
(repro project is in link)
I have a CollectionView in a Grid with row definition auto.
The CollectionView is initially displayed properly, but after I add a second item into it, via click of a button - an exception is thrown:
message:
Exception = {"Value does not fall within the expected range."}
stack trace:
at WinRT.ExceptionHelpers.g__Throw|20_0(Int32 hr)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.ArrangeOverride(IObjectReference _obj, Size finalSize)
at Microsoft.UI.Xaml.FrameworkElement.ArrangeOverride(Size finalSize)
at Microsoft.Maui.Controls.Platform.FormsGridView.ArrangeOverride(Size finalSize)
at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.g__Throw|20_0(Int32 hr)
at ABI.Microsoft.UI.Xaml.IUIElementMethods.Arrange(IObjectReference _obj, Rect finalRect)
at Microsoft.UI.Xaml.UIElement.Arrange(Rect finalRect)
at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at Microsoft.Maui.Handlers.ViewHandler`2.PlatformArrange(Rect rect)
at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Layouts.GridLayoutManager.ArrangeChildren(Rect bounds)
at Microsoft.Maui.Controls.Layout.CrossPlatformArrange(Rect bounds)
at Microsoft.Maui.Platform.MauiPanel.CrossPlatformArrange(Rect bounds)
at Microsoft.Maui.Platform.MauiPanel.ArrangeOverride(Size finalSize)
at Microsoft.Maui.Platform.LayoutPanel.ArrangeOverride(Size finalSize)
at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
Interestingly we tested this on two different machies with the same maui versions and one of the does not throw an exception, but results in an invalid layout:
I placed this code inside the button click handler:
double collectionViewHeight = this.cv1.DesiredSize.Height;
And I can see that the size of the CollectionView is very very large:
collectionViewHeight = 954437184
Steps to Reproduce
Expected: Two items should be displayed in the CollectionView.
Actual: An exception is thrown.
Link to public reproduction project repository
https://github.com/telerik/ms-samples/tree/main/Maui/CollectionViewThrowsAnException
Version with bug
Unknown/Other
Last version that worked well
7.0.86
Affected platforms
Windows
Affected platform versions
8.0.0-preview.6.8686
Did you find any workaround?
N/A
Relevant log output
No response
The text was updated successfully, but these errors were encountered: