Skip to content

Conversation

@NanthiniMahalingam
Copy link
Contributor

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

  • Android
  • Windows ,
  • iOS,
  • MacOS

Issues Fixed

Fixes #32932

Output

Android

Before After
Issue32932_before.mov
Issue_32932_after.mov

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 12, 2025
@karthikraja-arumugam karthikraja-arumugam added the community ✨ Community Contribution label Dec 12, 2025
@jianfeng586
Copy link

#33134 the same problem

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.MaxValue to double.PositiveInfinity before 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CollectionView does not show an EmptyView template with an empty collection

4 participants