In my MAUI app, using .NET 9.0, I use a CollectionView to display a collection of items each comprised of an Image within a Border. On iOS, at runtime, I get the error message:
The behavior of the UICollectionViewFlowLayout is not defined because:
2025-01-12 09:41:31.160276-0600 ... the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2025-01-12 09:41:31.160489-0600 ... Please check the values returned by the delegate.
2025-01-12 09:41:31.160885-0600 ... The relevant UICollectionViewFlowLayout instance is , and it is attached to ; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = ; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: ; dataSource: >.
2025-01-12 09:41:31.161159-0600 ... Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
Even though the error is generated, the UI looks fine. Nonetheless, I’m concerned this will come back to bite me if it doesn’t get fixed. I found several posts regarding this error, but none are MAUI related, and the solutions don’t seem applicable to a MAUI app.
Here is the CollectionView…
Here is custom_components:SnowConditionInputButton:
I tried changing the Border HeightRequest to 10 (very small), I tried commenting out the Image within the Border, I tried expanding the HeightRequest of the CollectionView to 100. Nothing I do seems to eliminate the error.
One behavior that’s strange is that when the CollectionView contains more than 2 items, the error only appears twice.
I tried to “Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.” per the runtime suggestion but Visual Studio doesn’t appear to have the capability to do this.
Any suggestions for fixes would be greatly appreciated. Perhaps this is a MAUI bug?
Thank you.
Discover more from TrendyShopToBuy
Subscribe to get the latest posts sent to your email.