[Android] Fixed EmptyView doesn’t display when CollectionView is placed inside a VerticalStackLayout#33134
Conversation
|
#33134 the same problem |
There was a problem hiding this comment.
Pull request overview
This PR fixes an Android-specific issue where the EmptyView in CollectionView fails to display when the CollectionView is placed inside a VerticalStackLayout. The root cause was an integer overflow during pixel conversion when the RecyclerView received infinite height constraints (represented as int.MaxValue).
Key Changes:
- Added dimension normalization to convert
int.MaxValuetodouble.PositiveInfinitybefore pixel conversion - Added comprehensive UI test coverage with screenshot verification for Android and iOS platforms
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/src/Core/Handlers/Items/Android/SizedItemContentView.cs | Implements the core fix by adding NormalizeDimension method that converts int.MaxValue to double.PositiveInfinity, preventing pixel conversion issues when measuring EmptyView with infinite constraints |
| src/Controls/tests/TestCases.HostApp/Issues/Issue32932.cs | Provides the test page reproducing the issue with CollectionView containing EmptyView inside VerticalStackLayout, using CollectionView2 for testing |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32932.cs | Implements the UI test that verifies EmptyView displays correctly using screenshot verification |
| src/Controls/tests/TestCases.Android.Tests/snapshots/android/EmptyViewShouldDisplayWhenCollectionViewIsInsideVerticalStackLayout.png | Baseline screenshot for Android test verification |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EmptyViewShouldDisplayWhenCollectionViewIsInsideVerticalStackLayout.png | Baseline screenshot for iOS test verification |
The implementation is solid and follows established patterns. The fix correctly addresses the root cause by normalizing dimension values before pixel conversion, ensuring infinite constraints are properly represented as double.PositiveInfinity rather than int.MaxValue. The test coverage is appropriate with both the reproduction case and automated verification through screenshots.
7b70566 to
4195ff3
Compare
|
/rebase |
12d20ee to
396f12b
Compare
|
/rebase |
Phase 2 (Tests): Verified test files exist, compile, follow conventions Phase 3 (Gate): Verified tests FAIL without fix, PASS with fix Phase 4 (Fix): Selected PR's fix after comparing 6 alternatives Phase 5 (Report): Final recommendation APPROVE Test verification: - WITH fix: EmptyView found immediately (PASS) - WITHOUT fix: 25+ retries, timeout (FAIL as expected)
dc0e038 to
df3711d
Compare
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ced inside a VerticalStackLayout (#33134) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause - When the RecyclerView height is infinite, the EmptyView also receives an infinite height constraint. During measurement, Int.MAX_VALUE is assigned to represent this infinite height. - However, while converting the RecyclerView’s infinite height to an integer value, a pixel conversion issue occurs. As a result, the EmptyView fails to render correctly and does not appear on the screen. ### Description of Change - When the EmptyView height is infinite, the EmptyView is measured to the exact infinite height when its height is set to Int.MAX_VALUE Validated the behaviour in the following platforms - [x] Android - [x] Windows , - [x] iOS, - [x] MacOS ### Issues Fixed Fixes #32932 ### Output **Android** |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/e1bc87a9-cb07-4e08-86aa-f64159cdcd15" >| <video src="https://github.com/user-attachments/assets/1b89e70d-b93d-4c1f-9e0d-af9db32dbd7b">| --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
## What's Coming .NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 16 commits with various improvements, bug fixes, and enhancements. ## Checkbox - [Android] Implement material3 support for CheckBox by @HarishwaranVijayakumar in #33339 <details> <summary>🔧 Fixes</summary> - [Implement Material3 Support for CheckBox](#33338) </details> ## CollectionView - [Android] Fixed EmptyView doesn’t display when CollectionView is placed inside a VerticalStackLayout by @NanthiniMahalingam in #33134 <details> <summary>🔧 Fixes</summary> - [CollectionView does not show an EmptyView template with an empty collection](#32932) </details> ## Essentials - [Windows]Fix NullReferenceException in OpenReadAsync for FileResult created with full path by @devanathan-vaithiyanathan in #28238 <details> <summary>🔧 Fixes</summary> - [[Windows] FileResult(string fullPath) not initialized properly](#26858) </details> ## Image - Fix Glide IllegalArgumentException in MauiCustomTarget.clear() for destroyed activities by @jfversluis via @Copilot in #29780 <details> <summary>🔧 Fixes</summary> - [java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide](#29699) </details> ## Label - [Android] Fix for Label WordWrap width issue causing HorizontalOptions misalignment by @praveenkumarkarunanithi in #33281 <details> <summary>🔧 Fixes</summary> - [[Android] Unexpected Line Breaks in Android, Label with WordWrap Mode Due to Trailing Space.](#31782) - [Label not sized correctly on Android](#27614) </details> - Fix to Improve Flyout Accessibility by Adjusting UITableViewController Labels by @SuthiYuvaraj in #31619 <details> <summary>🔧 Fixes</summary> - [Navigation section present under hamburger are programmatically define as table :A11y_.NET maui_User can get all the insights of Dashboard_Devtools](#30894) </details> ## Mediapicker - [Regression][iOS] Fix MediaPicker PickPhotosAsync getting file name in contentType property by @devanathan-vaithiyanathan in #33390 <details> <summary>🔧 Fixes</summary> - [[iOS] MediaPicker PickPhotosAsync getting file name in contentType property](#33348) </details> ## Navigation - Fix handler not disconnected when removing non visible pages using RemovePage() by @Vignesh-SF3580 in #32289 <details> <summary>🔧 Fixes</summary> - [NavigationPage.Navigation.RemovePage() fails to disconnect handlers when removing pages, unlike ContentPage.Navigation.RemovePage()](#32239) </details> ## Picker - [Android] Fix Picker IsOpen not reset when picker is dismissed by @devanathan-vaithiyanathan in #33332 <details> <summary>🔧 Fixes</summary> - [[Android] Picker IsOpen not reset when picker is dismissed](#33331) </details> ## Shell - [iOS & Catalyst ] Fixed IsEnabled property should work on Tabs by @SubhikshaSf4851 in #33369 <details> <summary>🔧 Fixes</summary> - [[Catalyst] TabBarBackgroundColor, TabBarUnselectedColor, and IsEnabled Not Working as Expected in Shell](#33158) </details> - [iOS,Windows] Fix navigation bar colors not resetting when switching ShellContent by @Vignesh-SF3580 in #33228 <details> <summary>🔧 Fixes</summary> - [[iOS, Windows] Shell Navigation bar colors are not updated correctly when switching ShellContent](#33227) </details> - [iOS] Fixed Shell navigation on search handler suggestion selection by @SubhikshaSf4851 in #33406 <details> <summary>🔧 Fixes</summary> - [[iOS] Clicking on search suggestions fails to navigate to detail page correctly](#33356) </details> ## Templates - Fix VoiceOver doesnot announces the State of the ComboBox by @SuthiYuvaraj in #32286 ## Xaml - [XSG][BindingSourceGen] Add support for CommunityToolkit.Mvvm ObservablePropertyAttribute by @simonrozsival via @Copilot in #33028 <details> <summary>🔧 Fixes</summary> - [[XSG] Add heuristic to support bindable properties generated by other source generators](#32597) </details> <details> <summary>📦 Other (2)</summary> - [XSG] Improve diagnostic reporting during binding compilation by @simonrozsival via @Copilot in #32905 - [Testing] Fixed Test case failure in PR 33574 - [01/19/2026] Candidate - 1 by @TamilarasanSF4853 in #33602 </details> **Full Changelog**: main...inflight/candidate
…ions from analysis New agent: .github/agents/scrape-and-improve.md Applied findings: Common Fix Patterns section in copilot-instructions.md - NavigationPage handler disconnection (from PR #32289 - 6 attempts) - CollectionView EmptyView Android (from PR #33134 - 8 attempts) - Shell navigation iOS tests (from PR #33380 - 4 attempts) - Device test isolation (from PR #33406 - 3 attempts) Scrape results: 5 sessions, 21 fix attempts, 47.6% success rate, 7 recommendations Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Root Cause
Description of Change
Validated the behaviour in the following platforms
Issues Fixed
Fixes #32932
Output
Android
Issue32932_before.mov
Issue_32932_after.mov