Skip to content

[iOS/MacCatalyst] Fix CollectionView (CV2) expanding to fill available space when no items are present - #36127

Merged
kubaflo merged 6 commits into
dotnet:inflight/currentfrom
SyedAbdulAzeemSF4852:fix-35889
Jul 8, 2026
Merged

kubaflo merged 6 commits into
dotnet:inflight/currentfrom
SyedAbdulAzeemSF4852:fix-35889

Conversation

@SyedAbdulAzeemSF4852

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

  • On iOS/MacCatalyst, a CollectionView with no items incorrectly expands to fill the entire screen height instead of collapsing to zero height, pushing all sibling views off screen. Android behaves correctly.

Root Cause

Description of Change

  • Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive fallback size when the CollectionView is empty (no items, no EmptyView). Both the IsEmpty guard and the zero-frame check are scoped to CollectionView only. Also handles the case where the CollectionView's frame is zero in the scroll direction after transitioning from empty to non-empty.
  • Added the IsEmpty property to ItemsViewController2.cs using the _isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly handle a null ItemsSource and expose empty-state to the handler.

Issues Fixed

Fixes #35889

Validated the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

Before After

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36127

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36127"

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jun 25, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@SyedAbdulAzeemSF4852! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 25, 2026
@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 changed the title [WIP][iOS/MacCatalyst] Fix CollectionView (CV2) expanding to fill available space when no items are present [iOS/MacCatalyst] Fix CollectionView (CV2) expanding to fill available space when no items are present Jun 30, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review July 1, 2026 10:17
Copilot AI review requested due to automatic review settings July 1, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes CV2 (Items2) iOS/MacCatalyst measurement so an empty CollectionView no longer expands to an “expansive fallback” size when ContentSize is zero, and adds a UI test to validate empty→non-empty sizing behavior.

Changes:

  • Adjusts CV2 iOS handler sizing logic to avoid applying the expansive fallback when the CollectionView is empty, while still forcing a layout pass in scenarios where bounds are temporarily zero.
  • Exposes an “empty (no items, no EmptyView)” state from ItemsViewController2 to support the handler sizing decision.
  • Adds HostApp repro page + Appium UI test for Issue #35889 to validate collapse when empty and expansion when items are added.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs Adds an Appium UI test asserting the empty CollectionView collapses and expands after items are added.
src/Controls/tests/TestCases.HostApp/Issues/Issue35889.cs Adds a HostApp repro page with a CollectionView and a button to populate items.
src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs Updates CV2 sizing fallback behavior for ContentSize == 0, adding an empty-CollectionView guard and a zero-frame follow-up case.
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs Adds an IsEmpty property to communicate empty-state to the handler.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Jul 5, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 1 findings

See inline comments for details.

@MauiBot MauiBot added s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jul 5, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@SyedAbdulAzeemSF4852 — new AI review results are available based on this last commit: 670769d. To request a fresh review after new comments or commits, comment /review rerun.

Gate Passed Confidence Low Platform iOS


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: IOS · Base: main · Merge base: 89a4e02d

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue35889 Issue35889 ✅ FAIL — 263s ✅ PASS — 104s
🔴 Without fix — 🖥️ Issue35889: FAIL ✅ · 263s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 543 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 597 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 4.82 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 5.08 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 5.09 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 5.09 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 5.1 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 5.1 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/maps/src/Maps.csproj (in 5.11 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 5.11 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 5.1 sec).
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:02:24.17
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 499 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 499 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 501 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 560 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 1.09 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 1.11 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.22 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 1.23 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 1.26 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 1.56 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 2.07 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 2.67 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj (in 3.22 sec).
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.05]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.17]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 7/5/2026 1:25:15 PM FixtureSetup for Issue35889(iOS)
>>>>> 7/5/2026 1:25:20 PM EmptyCollectionViewCollapsesAndExpandsWithItems Start
>>>>> 7/5/2026 1:25:20 PM EmptyCollectionViewCollapsesAndExpandsWithItems Stop
>>>>> 7/5/2026 1:25:20 PM Log types: syslog, crashlog, performance, safariConsole, safariNetwork, server
  Failed EmptyCollectionViewCollapsesAndExpandsWithItems [709 ms]
  Error Message:
     Empty CollectionView should have zero height — gap between labels should be ~0.
Assert.That(emptyGap, Is.EqualTo(0).Within(2))
  Expected: 0 +/- 2
  But was:  812
  Off by:   -812.0d

  Stack Trace:
     at Microsoft.Maui.TestCases.Tests.Issues.Issue35889.EmptyCollectionViewCollapsesAndExpandsWithItems() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs:line 26

1)    at Microsoft.Maui.TestCases.Tests.Issues.Issue35889.EmptyCollectionViewCollapsesAndExpandsWithItems() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue35889.cs:line 26


NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35889.trx

Total tests: 1
Test Run Failed.
     Failed: 1
 Total time: 1.2170 Minutes
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35889.trx

🟢 With fix — 🖥️ Issue35889: PASS ✅ · 104s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 354 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 386 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 387 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 428 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 442 ms).
  6 of 11 projects are up-to-date for restore.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:52.44
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 392 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 409 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 410 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 438 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 448 ms).
  8 of 13 projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.90-ci+azdo.14572645
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.04]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.16]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 7/5/2026 1:27:00 PM FixtureSetup for Issue35889(iOS)
>>>>> 7/5/2026 1:27:04 PM EmptyCollectionViewCollapsesAndExpandsWithItems Start
>>>>> 7/5/2026 1:27:05 PM EmptyCollectionViewCollapsesAndExpandsWithItems Stop
  Passed EmptyCollectionViewCollapsesAndExpandsWithItems [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35889.trx

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 22.1189 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35889.trx

📁 Fix files reverted (2 files)
  • src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs
  • src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs

📱 UI Tests — CollectionView

Detected UI test categories: CollectionView

❌ Deep UI tests — 332 passed, 86 failed across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
CollectionView 332/421 (86 ❌) 168 diff PNGs
❌ CollectionView — 86 failed tests
CollectionViewHeaderShouldNotScroll
Assert.That(actual, Is.EqualTo(expected))
  Expected: {X=0,Y=50,Width=402,Height=34}
  But was:  {X=0,Y=56,Width=402,Height=35}
at NUnit.Framework.Legacy.ClassicAssert.AreEqual(Object expected, Object actual)
   at Microsoft.Maui.TestCases.Tests.Issues.Issue10947.CollectionViewHeaderShouldNotScroll() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs:line 30

1)    at NUnit.Framework.Legacy.ClassicAssert.AreEqual(Object expected, Object actual)
   at Microsoft.Maui.TestCases.Tests.Issues.Issue10947.CollectionViewHeaderShouldNotScroll() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs:line 30
BottomSheetDetentHeightIsCorrectWhenCollectionViewIsMeasuredBeforeMount
System.InvalidOperationException : 
Snapshot different than baseline: BottomSheetDetentHeightIsCorrectWhenCollectionViewIsMeasuredBeforeMount.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: BottomSheetDetentHeightIsCorrectWhenCollectionViewIsMeasuredBeforeMount.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baselin
...
VerticalGridCollectionViewLTRToRTLToggleShouldWork
System.InvalidOperationException : 
Snapshot different than baseline: VerticalGridCollectionViewLTRToRTLToggleShouldWork.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerticalGridCollectionViewLTRToRTLToggleShouldWork.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then u
...
VerifyFlowDirectionRTLAndMeasureAllItemsWithGroupedList
System.InvalidOperationException : 
Snapshot different than baseline: VerifyFlowDirectionRTLAndMeasureAllItemsWithGroupedList.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyFlowDirectionRTLAndMeasureAllItemsWithGroupedList.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bu
...
CollectionViewGroupFooterTemplateShouldNotCrash
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewGroupFooterTemplateShouldNotCrash.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewGroupFooterTemplateShouldNotCrash.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update 
...
VerifyCustomSizedEmptyViewDisplaysCorrectly_WithRightToLeftFlowDirection
System.InvalidOperationException : 
Snapshot different than baseline: VerifyCustomSizedEmptyViewDisplaysCorrectly_WithRightToLeftFlowDirection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyCustomSizedEmptyViewDisplaysCorrectly_WithRightToLeftFlowDirection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct basel
...
FooterShouldDisplayAtBottomOfEmptyView
System.InvalidOperationException : 
Snapshot different than baseline: FooterShouldDisplayAtBottomOfEmptyView.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: FooterShouldDisplayAtBottomOfEmptyView.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image
...
VerifyMeasureAllItemsWithObservableCollection
System.InvalidOperationException : Unable to extract difference percentage from exception message.
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 296
   at Microsoft.Maui.TestCases.Tests.CollectionView_ScrollingFeatureTests.VerifyMeasureAllItemsWithObservableCollection() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ScrollingFeatureTests.cs:line 53
   at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
   at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Met
...
RightToLeftFlowDirectionShouldWork
System.InvalidOperationException : 
Snapshot different than baseline: RightToLeftFlowDirectionShouldWork.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: RightToLeftFlowDirectionShouldWork.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See te
...
RemoveEmptyViewAtRuntime
System.InvalidOperationException : 
Snapshot different than baseline: RemoveEmptyViewAtRuntime.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: RemoveEmptyViewAtRuntime.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or dow
...
CollectionViewSingleItemAlignmentWithFooter
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewSingleItemAlignmentWithFooter.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewSingleItemAlignmentWithFooter.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the base
...
Issue18751Test
System.InvalidOperationException : 
Snapshot different than baseline: Issue18751Test.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: Issue18751Test.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build arti
...
CollectionViewWithFallbackVauleShouldUpdateAtRunTime
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewWithFallbackVauleShouldUpdateAtRunTime.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewWithFallbackVauleShouldUpdateAtRunTime.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), th
...
ShouldIgnoreBottomContentInsetForCollectionViewItems
System.InvalidOperationException : 
Snapshot different than baseline: ShouldIgnoreBottomContentInsetForCollectionViewItems.png (size differs - baseline is 1124x1126 pixels, actual is 1206x1312 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: ShouldIgnoreBottomContentInsetForCollectionViewItems.png (size differs - baseline is 1124x1126 pixels, actual is 1206x1312 pixels)
If the correct baseline has changed (this isn't a a bug), th
...
CollectionViewSelectedItemBackgroundShouldPersistAfterModalNavigation
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewSelectedItemBackgroundShouldPersistAfterModalNavigation.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewSelectedItemBackgroundShouldPersistAfterModalNavigation.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline ha
...
CollectionViewDuplicateViewsWhenAddItemToGroup
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewDuplicateViewsWhenAddItemToGroup.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewDuplicateViewsWhenAddItemToGroup.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update th
...
VerifyCollectionViewItemsAfterScrolling
System.InvalidOperationException : 
Snapshot different than baseline: VerifyCollectionViewItemsAfterScrolling.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyCollectionViewItemsAfterScrolling.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline ima
...
VerifyScrollToByIndexWithCenterPositionAndVerticalList_Carrot
System.InvalidOperationException : 
Snapshot different than baseline: VerifyScrollToByIndexWithCenterPositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyScrollToByIndexWithCenterPositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this 
...
SingleItemAlignmentInCollectionViewHorizontalGridLayout
System.InvalidOperationException : 
Snapshot different than baseline: SingleItemAlignmentInCollectionViewHorizontalGridLayout.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: SingleItemAlignmentInCollectionViewHorizontalGridLayout.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bu
...
VerifyCustomSizedEmptyViewDisplaysCorrectly_WithLeftToRightFlowDirection
System.InvalidOperationException : 
Snapshot different than baseline: VerifyCustomSizedEmptyViewDisplaysCorrectly_WithLeftToRightFlowDirection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyCustomSizedEmptyViewDisplaysCorrectly_WithLeftToRightFlowDirection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct basel
...
HeaderShouldNotCollapseWithItems
System.InvalidOperationException : 
Snapshot different than baseline: HeaderShouldNotCollapseWithItems.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: HeaderShouldNotCollapseWithItems.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test a
...
VerifyScrollToByIndexWithMakeVisiblePositionAndVerticalList_Carrot
System.InvalidOperationException : 
Snapshot different than baseline: VerifyScrollToByIndexWithMakeVisiblePositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyScrollToByIndexWithMakeVisiblePositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has chan
...
VerifyModelItemsObservableCollectionWhenMultipleModePreSelection
System.InvalidOperationException : Unable to extract difference percentage from exception message.
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 296
   at Microsoft.Maui.TestCases.Tests.CollectionView_ItemsSourceFeatureTests.VerifyModelItemsObservableCollectionWhenMultipleModePreSelection() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CollectionView_ItemsSourceFeatureTests.cs:line 674
   at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
   at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
   at System.Reflection.MethodBaseInvok
...
VerifyFlowDirectionLTRAndMeasureAllItemsWithObservableCollection
System.InvalidOperationException : 
Snapshot different than baseline: VerifyFlowDirectionLTRAndMeasureAllItemsWithObservableCollection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyFlowDirectionLTRAndMeasureAllItemsWithObservableCollection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed 
...
RefreshShouldNotChangeSize
System.InvalidOperationException : 
Snapshot different than baseline: RefreshShouldNotChangeSize.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: RefreshShouldNotChangeSize.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or
...
VerifyFlowDirectionRTLAndMeasureAllItemsWithObservableCollection
System.InvalidOperationException : 
Snapshot different than baseline: VerifyFlowDirectionRTLAndMeasureAllItemsWithObservableCollection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyFlowDirectionRTLAndMeasureAllItemsWithObservableCollection.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed 
...
HeaderFooterGridWorks
System.InvalidOperationException : 
Snapshot different than baseline: HeaderFooterGridWorks.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: HeaderFooterGridWorks.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download 
...
CollectionViewSelectionModeOnDarkTheme
System.InvalidOperationException : 
Snapshot different than baseline: CollectionViewSelectionModeOnDarkTheme.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: CollectionViewSelectionModeOnDarkTheme.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image
...
VerifyScrollToByItemWithCenterPositionAndVerticalList_Carrot
System.InvalidOperationException : 
Snapshot different than baseline: VerifyScrollToByItemWithCenterPositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyScrollToByItemWithCenterPositionAndVerticalList_Carrot.png (size differs - baseline is 1124x2286 pixels, actual is 1206x2472 pixels)
If the correct baseline has changed (this is
...
CellLayoutUpdatesCorrectlyAfterDeviceOrientationChanges
System.InvalidOperationException : 
Snapshot different than baseline: Issue28657_Landscape.png (size differs - baseline is 2436x974 pixels, actual is 2622x1056 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow


iOS 26 visual tests require an iPhone 11 Pro simulator for correct screen resolution.
To create the simulator, run:
  xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-0

Then run the tests targeting the new simulator.
  ----> VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: Issue28657_Landscape.png (size differs - baseline is 2436x974 pixels, actual is 2622x1056 pixels)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the 
...

(+56 more — see TRX in artifact)

📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)


📋 Pre-Flight — Context & Validation

Issue: #35889 - Empty CollectionView (CV2) expands to fill available space on iOS instead of collapsing to zero height
PR: #36127 - Local PR branch pr-review-36127 (title unavailable: gh unauthenticated)
Platforms Affected: iOS / MacCatalyst Items2 handler path; testing platform iOS
Files Changed: 2 implementation, 2 test

Key Findings

  • PR targets the active iOS/MacCatalyst Items2/ CollectionView handler path, not deprecated Items/ iOS code.
  • Gate already passed: Issue35889 fails without the fix (emptyGap 812 instead of 0) and passes with the PR fix.
  • The PR fix collapses empty CollectionView without an EmptyView by returning zero content size, then handles empty-to-populated transition by forcing layout when the mounted collection frame remains zero in the scroll direction.
  • GitHub PR narrative, comments, prior reviews, and required checks could not be fetched because gh is unauthenticated; local branch diff and existing gate artifacts were used.

Code Review Summary

Verdict: NEEDS_DISCUSSION
Confidence: low
Errors: 0 | Warnings: 0 | Suggestions: 0

Key code review findings:

  • ℹ No substantive code issues found in the independent review; verdict is capped because CI/PR metadata were unavailable due GitHub authentication.
  • ℹ Blast radius is limited to iOS/MacCatalyst Items2 CollectionView measurement; no static/shared state added.
  • ℹ Failure-mode probes covered empty CollectionView, EmptyView, CarouselView/other ItemsView subclasses, and empty-to-populated transition.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #36127 Add Controller.IsEmpty and skip expansive measurement fallback for empty CollectionView; force a temporary layout pass when a collapsed mounted CollectionView later needs item sizing. ✅ PASSED (Gate) ItemsViewHandler2.iOS.cs, ItemsViewController2.cs Original PR; gate already verified fail-without/pass-with-fix.

🔬 Code Review — Deep Analysis

Code Review — PR #36127

Independent Assessment

What this changes: Fixes iOS/MacCatalyst CV2 CollectionView sizing so an empty CollectionView without an EmptyView collapses to zero instead of using the expansive fallback size. It also forces a temporary layout pass when a previously-collapsed mounted collection has a zero frame and adds a UI regression test.

Inferred motivation: Address issue #35889: empty CV2 expands to fill available space on iOS instead of collapsing, and must expand again after items are added.

Reconciliation with PR Narrative

Author claims: Unavailable — gh is unauthenticated in this environment.
Agreement/disagreement: Could not verify PR description, linked issue, or comments. Review is based on local branch pr-review-36127 vs origin/main.

Prior Review Reconciliation

Prior reviews unavailable due to GitHub CLI authentication failure. Top-level reviews, inline comments, and PR issue comments could not be queried.

Blast Radius Assessment

  • Runs for all instances: No — new collapse/zero-frame logic is gated to VirtualView is CollectionView.
  • Startup impact: Limited — affects iOS/MacCatalyst Items2 measurement for CollectionView.
  • Static/shared state: No new static/shared state.

CI Status

  • Required-check result: unavailable
  • Classification: undetermined
  • Action taken: gh pr checks --required failed due missing authentication; confidence capped at low and verdict cannot be LGTM.

Findings

No substantive ❌ Error or ⚠️ Warning findings found. Expert reviewer also found no high-confidence inline findings.

Failure-Mode Probing

  • Empty CollectionView without EmptyView: returns zero content size, matching intended collapse.
  • EmptyView displayed: _emptyViewDisplayed makes Controller.IsEmpty false, preserving existing EmptyView sizing.
  • CarouselView/other ItemsView subclasses: unaffected by new VirtualView is CollectionView guards.
  • Empty-to-populated transition: zero-frame layout path is intended to allow compositional layout to compute item size after collapse; added UI test covers this path.

Verdict: NEEDS_DISCUSSION

Confidence: low
Summary: Code approach looks sound and narrowly scoped, but GitHub PR narrative, prior reviews, and required CI checks were unavailable due authentication. Per workflow rules, CI-undetermined reviews cannot be LGTM.


🛠️ Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix / claude-opus-4.6 Post-layout UIKit data-source verification plus layout invalidation on empty-to-non-empty transition. ✅ PASS 2 files Queries native item counts after forced layout; passed but is more complex than PR fix and duplicates native data-source inspection on a hot measurement path.
2 try-fix / claude-opus-4.7 Controller-owned authoritative size reporting via GetSize(width,height,out isAuthoritative). ✅ PASS 2 files Architecturally clean separation of size authority, but changes controller/handler sizing contract and is broader than the PR fix.
3 try-fix / gpt-5.3-codex Lifecycle empty-to-non-empty transition flag plus layout/measure invalidation. ✅ PASS 2 files Confirms the expansion recovery needs a source-transition signal; passed after iterations, but adds stateful transition plumbing.
4 try-fix / gpt-5.5 Native/source item-count gate before expansive fallback. ❌ FAIL 1 file Empty state collapsed, but after adding items the CollectionView stayed collapsed (filledGap == 0); gate-only approaches lack expansion recovery.
5 cross-pollination / claude-opus-4.6 Native ContentSize KVO observation plus UIKit data-source gate and zero-frame force layout. ✅ PASS 2 files Reactive native observation passed, but the final working version still needed data-source gating and zero-frame force layout, making it more complex than the PR fix.
6 cross-pollination / claude-opus-4.7 Bounds/window transition recovery with layout-has-run geometric gate. ❌ FAIL 2 files Empty state collapsed, but bounds transitions are downstream of parent remeasurement and cannot detect items appearing inside a zero-height CollectionView.
PR PR #36127 Add controller IsEmpty, return zero for empty CollectionView, and force layout when a previously collapsed mounted frame is zero in the scroll direction. ✅ PASSED (Gate) 2 files Original PR; simplest passing solution found.

Cross-Pollination

Model Round New Ideas? Details
claude-opus-4.6 2 Yes Proposed native UICollectionView.ContentSize observation and upward invalidation. Tested as candidate 5: ✅ PASS after adding native data-source gate and zero-frame layout recovery.
claude-opus-4.7 2 No Reported no materially new ideas after candidates 1-4.
gpt-5.3-codex 2 No Reported remaining options were recombinations of authoritative empty sizing, transition invalidation, and native item-count gating.
gpt-5.5 2 Yes Proposed KVO-observing contentSize and invalidating parent layout. Covered by candidate 5.
claude-opus-4.6 3 No After candidate 5, reported the meaningful solution space covered.
claude-opus-4.7 3 Yes Proposed one-shot bounds/window transition recovery. Tested as candidate 6: ❌ FAIL.
gpt-5.3-codex 3 No Reported alternatives exhausted after candidate 5.
gpt-5.5 3 No Reported remaining ideas were implementation variants of size reporting or invalidation.
claude-opus-4.6 4 No Final exhaustion check: no new ideas.
claude-opus-4.7 4 No Final exhaustion check: no new ideas.
gpt-5.3-codex 4 No* Suggested explicit upstream remeasure on data-source mutation; classified as already covered by candidates 1 and 3 because both use source/data transition invalidation to break the zero-height cycle.
gpt-5.5 4 No Final exhaustion check: no structurally distinct approach remains.

Exhausted: Yes
Selected Fix: PR #36127 — It is the simplest passing fix. Passing alternatives either broaden the controller/handler sizing contract (candidate 2), add extra native data-source/KVO machinery (candidates 1 and 5), or introduce transition state (candidate 3). Failed candidates 4 and 6 show that suppressing the expansive fallback without an explicit expansion-recovery signal is insufficient. No alternative was demonstrably better than the PR fix.

Per-Candidate Artifacts

Candidate Narrative Full Attempt Artifacts
1 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-1/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-1/
2 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-2/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-2/
3 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-3/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-3/
4 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-4/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-4/
5 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-5/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-5/
6 CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix-6/content.md CustomAgentLogsTmp/PRState/36127/PRAgent/try-fix/attempt-6/

📝 Recommended PR Title & Description

Assessment: ✏️ Recommend updating — the current description accurately explains the PR fix, but the winning pr-plus-reviewer fix should also document that the horizontal CollectionView height reset is preserved on the new zero-frame retry path.

Recommended title

[iOS/MacCatalyst] CollectionView: Collapse empty CV2 when no items are present

Recommended description

### Issue Details
- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands to fill the entire screen height instead of collapsing to zero height, pushing all sibling views off screen. Android behaves correctly.

### Root Cause
- PR #30978 introduced an unconditional expansive fallback in GetDesiredSize — when ContentSize == 0, it returned base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this into EnsureContentSizeForScrollDirection but preserved the same flawed logic, as did subsequent refactors. On iOS/MacCatalyst, EnsureContentSizeForScrollDirection cannot distinguish between a genuinely empty CollectionView (0 items) and one whose items haven't been laid out yet by UICollectionViewCompositionalLayout — both report ContentSize == 0 — so it always applies the expansive fallback size, causing an empty CV to expand to fill the screen instead of collapsing to zero height.

### Description of Change
- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive fallback size when the CollectionView is empty (no items, no EmptyView). Both the IsEmpty guard and the zero-frame check are scoped to CollectionView only.
- Handles the case where the CollectionView's frame is zero in the scroll direction after transitioning from empty to non-empty by forcing a temporary layout pass so UICollectionViewCompositionalLayout can compute item content size.
- Preserves the existing horizontal CollectionView auto-height safeguard by resetting contentSize.Height to 0 before returning from the temporary-layout branch when the scroll direction is horizontal.
- Added the IsEmpty property to ItemsViewController2.cs using the _isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly handle a null ItemsSource and expose empty-state to the handler.

### Issues Fixed
Fixes #35889

### Validated the behaviour in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] MacCatalyst

### Output
| Before | After |
|----------|----------|
| <img src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa"> | <img src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc"> |

🏁 Report — Final Recommendation

Comparative Fix Report — PR #36127

Ranking

Rank Candidate Regression result Assessment
1 pr-plus-reviewer Inherits PR gate pass; reviewer patch not independently rerun Best candidate. It is the submitted PR fix plus a narrowly scoped preservation of the horizontal CollectionView height reset identified by expert review.
2 pr PASS Simplest tested passing solution, but expert review found a major horizontal-layout regression risk in the new mounted zero-frame retry early-return path.
3 try-fix-1 PASS Works, but adds native data-source verification after forced layout plus controller layout invalidation on empty-to-non-empty transition. More complex than the PR path and duplicates native item-count inspection in a hot measurement path.
4 try-fix-2 PASS Architecturally clean controller-owned authoritative size reporting, but broadens the controller/handler sizing contract more than necessary.
5 try-fix-3 PASS Correctly models empty-to-non-empty expansion with explicit transition state, but adds stateful transition plumbing that the PR fix avoids.
6 try-fix-5 PASS Works via native ContentSize KVO plus UIKit data-source gate and zero-frame force layout, but is the most complex passing candidate and adds observer lifecycle surface.
7 try-fix-4 FAIL Collapses empty state but fails to expand after items are added (filledGap == 0). Ranked below all passing candidates.
8 try-fix-6 FAIL Collapses empty state but pure bounds/window transition recovery cannot detect items appearing inside a zero-height CollectionView. Ranked below all passing candidates.

Comparative Analysis

The raw PR fix is the strongest tested base: it changes only the active iOS/MacCatalyst Items2/ path, uses existing controller empty-state tracking, scopes collapse behavior to CollectionView, preserves EmptyView, and the gate already proved the regression test fails without the fix and passes with the fix.

The expert reviewer identified a real edge case in the PR's new mounted-frame retry branch: horizontal layouts can now return from the temporary-layout path before the existing horizontal contentSize.Height = 0 reset runs. The pr-plus-reviewer sandbox patch fixes that by applying the same reset before returning from that branch. This preserves the PR's simplicity while removing a plausible horizontal auto-height regression.

The passing try-fix candidates all confirm the same core requirement: suppress the expansive fallback for genuinely empty CollectionView, but provide an explicit recovery path when items appear after a zero-size collapse. However, each passing try-fix is broader than pr-plus-reviewer: candidates 1 and 5 query native data-source state and/or add observer machinery, candidate 2 changes the sizing contract, and candidate 3 introduces transition state.

Failed candidates 4 and 6 are useful negative evidence. Both show that collapse-only or geometry-only gates are insufficient because a child measured to zero needs a data/source-aware or frame-zero recovery signal to break the empty-to-populated cycle.

Winner

Winner: pr-plus-reviewer

pr-plus-reviewer wins because it keeps the simplest passing fix from the PR, addresses the expert reviewer's actionable horizontal-layout regression risk with a minimal local change, and avoids the broader state, contract, KVO, or native data-source complexity introduced by the alternate passing try-fix candidates.


🧭 Next Steps — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 5, 2026
@kubaflo

kubaflo commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please check the failing tests?

PureWeen and others added 6 commits July 7, 2026 12:40
…scoped event triggers (dotnet#36409)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Why
The `[Release Readiness]` tracker issues (SR9 dotnet#35867, preview7 dotnet#36138,
preview6 dotnet#35866) were refreshed once per weekday morning, so they
drifted stale as the day progressed. This keeps them fresher without
spamming watchers, and surfaces staleness explicitly when a body is
frozen by the idempotent no-op.

## What
**1. Cadence + freshness banner** (`release-readiness.yml`,
`NightlyFeed.ps1`, both engines)
- Schedule `30 8 * * 1-5` → `30 8-20/3 * * *` (every 3h, 08:30–20:30
UTC, all 7 days).
- New pure helper `Format-ReportFreshnessBanner -GeneratedAt -Now
[-StaleHours 4]` renders `🕐 Report generated N ago` and appends `⏳ …data
may be stale (older than 4h)` past threshold. Fail-open on
null/unparseable; clamps clock skew. Wired into both the SR and preview
reports. **Derived at render time from the generation timestamp and
deliberately excluded from `Get-ReportSemanticHash`** so it never churns
the idempotent no-op.

**2. Same-tracker writer serialization** (`release-readiness.yml`)
- Added a JOB-level `concurrency: group: release-readiness-tracker-${{
matrix.canonicalKey }}` (`cancel-in-progress: false`) on
`per-tracker-report`. Same-tracker writers now serialize across ALL
event kinds — the old top-level group keyed on `event_name` let two
different-event runs race the same `gh issue edit` and clobber Release
Captain Notes. Different trackers still run in parallel.
- Top-level `cancel-in-progress` → `${{ github.event_name ==
'pull_request' }}` (only PR validation cancels; writer runs are never
cancelled mid-edit). The existing re-read-live-body-before-edit +
malformed-marker skip guards are preserved as defense-in-depth.

**3. Scoped base-repo event triggers** (`release-readiness.yml`)
- Added `issues` (labeled, closed), `milestone` (created, closed), and
`push` (main, net11.0, release/**). **No `pull_request_target`.**
- Detect step maps each event to a scope filter (reusing existing
BRANCH_FILTER plumbing + new MAJOR_FILTER): push→pushed branch,
issues→majors from `regressed-in-<major>*` labels, milestone→major in
title, dispatch/schedule unchanged. Untrusted text (label names,
milestone/issue titles) flows ONLY via `env:` and is parsed with jq/grep
— never interpolated into a `run:` block. Org gate `github.repository ==
'dotnet/maui'` prevents fork activation. `issues: write` stays on the
writer job only.

## Tests
- New hash-stability test: renders the report twice with different
`fetchedAt`, asserts the banner text differs but the
`release-readiness-hash` marker is identical (proves the banner is not
hashed).
- 12 new `Format-ReportFreshnessBanner` unit tests
(fresh/stale/singular/plural/ISO-string/null/unparseable/clock-skew/custom-threshold).
- Full suite green (838/0 in a networked env).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
…otnet#36410)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Why
The release-readiness regression classifier could report a **CLOSED**
issue as an active `open-on-main` regression (Tier 2 — "wait for main
merge, then backport"). That's contradictory: an unmerged OPEN PR cannot
have closed a completed issue. It happens when a giant still-open
"Candidate" changelog PR `Fixes`-lists dozens of issues — its OPEN state
gets attributed to an already-completed issue. Real-world: issue dotnet#35615
(CLOSED/COMPLETED) surfaced under `open-on-main` in the SR9 tracker
while candidate PR dotnet#35716 was still open.

## What
`Classify-RegressionCandidate` now enforces: **never emit `open-on-main`
for a CLOSED issue.** When the aggregated best verdict is exactly
`open-on-main` and the issue is CLOSED:
1. First try the same comment-prose recovery the empty-candidate path
uses — a merged fix verifiably present on the SR wins →
`closed-fix-unlinked` (Tier 3, "no ship risk; add a closing reference
for traceability").
2. Otherwise fall to the honest `no-fix-yet` (Tier 3 for a CLOSED issue
via the existing `Get-OverallVerdict` downgrade) — the automation can't
pin a verified fix on this SR and the open candidate hasn't merged.

The shared recovery logic is extracted into a new
`Resolve-ClosedFixUnlinked` helper, called from both the
empty-`strongPrs` CLOSED path and the new guard, preserving the
fix-phrase gate, merged-on-SR gate, revert guards, and tooling-only
skips exactly.

**Strictly scoped:** only `open-on-main` + CLOSED is contradictory.
Every other verdict (`merged-on-main-no-backport`,
`backport-in-progress`, `rejected-from-sr`, `in-sr-*`,
`needs-human-review`) is unchanged even for CLOSED issues — those remain
legitimately actionable (the SR may still need the backport).
Genuinely-OPEN issues still get `open-on-main`.

## Tests
Three new unit tests in `Test-ReleaseReadiness.ps1`:
1. CLOSED issue + OPEN candidate on main + no comment fix →
`no-fix-yet`, proven non-blocking (🟢) via `Get-OverallVerdict`.
2. CLOSED issue + OPEN candidate + comment-cited merged fix on SR →
`closed-fix-unlinked` (recovery wins).
3. Regression guard: OPEN issue + OPEN candidate → stays `open-on-main`.

Full suite green (829/0).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

> [!NOTE]
> 🤖 **AI-generated PR.** These workflows, and this description, were
produced with AI assistance. Please review carefully before merging.

## Summary

Adds two [gh-aw](https://github.com/github/gh-aw) agentic workflows that
proactively **find** and **fix** managed, cross-platform memory leaks in
MAUI — turning the AI-driven leak-hunting flow several contributors
already run by hand (scan → repro → measure → file → fix) into a
repeatable, reviewable pipeline.

**Design principle: only empirically-proven leaks.** The scanner files
an issue **only** when a plain `dotnet test` demonstrates the leak; the
fixer opens a PR **only** with a red→green regression test proving the
fix. There is no "you're missing a test" / coverage-gap mode — every
artifact is backed by a passing/failing test.

**Key property:** neither workflow needs an emulator/simulator or a MAUI
source build to *detect* a leak — the leak signature is proven by a
`dotnet test` against the **shipped `Microsoft.Maui.Controls` NuGet
package** on the plain library TFM, so detection runs on a standard
GitHub-hosted runner.

Only 4 files are added — the workflow source (`.md`) and its compiled
artifact (`.lock.yml`) for each:

```
.github/workflows/daily-leak-hunter.md   + .lock.yml
.github/workflows/leak-fixer.md          + .lock.yml
```

---

## 1. `daily-leak-hunter` — the scanner (files `[leak-scan]` issues)

**Trigger:** `schedule: every 12h` + manual (`workflow_dispatch`). Files
**only empirically-proven `[leak-scan]` issues** — up to **8 per run**.

1. **Sweeps every focus area** of the managed surface (`src/Core/src`,
`src/Controls/src/Core`, `src/Essentials/src`) in one run — it does not
stop after the first find.
2. Each focus area is **seeded with proven MAUI leak signatures** (from
the community's known-leak catalog) so the hunt targets where leaks
actually live: shared publisher → strong
`CollectionChanged`/`PropertyChanged` (e.g. `Picker.ItemsSource`,
`TableRoot`, `SelectedItems`, `GradientStops`), shared `ICommand` →
`CanExecuteChanged` (`ListView.RefreshCommand`, `SwipeItemView.Command`,
`BackButtonBehavior.Command`), VSM state triggers →
`DeviceDisplay.MainDisplayInfoChanged`, and static/`ResourceDictionary`
roots.
3. For each candidate it writes a standalone control / leaky /
mitigation xUnit repro (referencing the shipped package, no source
build) and measures retention with `WeakReference` + a forced GC. All
candidates go in **one test project** (one `[Fact]` each, one
restore/run).
4. It files a `[leak-scan]` issue **only for each leak the test
confirms** — the leaky scenario retains while **both** the control and
the mitigation release. A false positive is treated as worse than a
quiet run; unconfirmed candidates are dropped. **If a run proves
nothing, it files nothing** (no fallback mode).

**De-dup & safety:** skips a leak already covered by one of *its own*
open `[leak-scan]` issues; never touches product or test code (read-only
+ `create-issue`); `noop: report-as-issue: false`.

---

## 2. `leak-fixer` — the fixer (opens draft `[leak-fix]` PRs)

**Trigger:** `schedule: every 12h` + manual (`workflow_dispatch`). At
most **one action per run**, with de-dup + a 3-attempt cap. It picks the
**higher-priority** of two tracks:

### Track C — respond to review feedback (checked first)
Before doing new work, it checks whether one of *its own* open
`[leak-fix]` PRs (**hosted on this repo** — fork-hosted heads it can't
push to are left for a human) has an **unaddressed `CHANGES_REQUESTED`
review**. If so it works on that PR: **applies** the valid requested
changes (pushes a commit, re-validated so the PR's own test still holds)
and/or **posts a comment pushing back** on any request that is wrong,
would regress behaviour, or asks for a mute. A loop-guard (act only on a
review newer than the PR's last commit *and* the workflow's last
comment) prevents re-processing the same review.

### Track A — `[leak-scan]` runtime leak → `[leak-fix]` PR
For the selected proven leak it:
1. Writes a focused regression test in `Controls.Core.UnitTests`.
2. Builds MAUI **from source** and confirms the test **FAILS on `main`**
— proving it catches the leak.
3. Implements the minimal, idiomatic managed fix — a weak subscription /
teardown mirroring the existing `WeakEventManager` / `WeakNotify*Proxy`
patterns.
4. Rebuilds and confirms the **same test now PASSES**, no neighbouring
regressions.
5. Opens a **draft `[leak-fix]` PR** with `Fixes #N` and the red→green
evidence.

### Safety
- Enforces red→green **in both directions** — a fix without a
demonstrated failing-then-passing test is rejected.
- **Never** mutes / skips / disables a test; rejects its own attempt if
the only thing that goes green is a mute — **including when a review
asks for one** (it pushes back with a comment instead).
- **One action per run** — Track C review-response *or* one new Track A
`[leak-fix]` PR, never both.
- Writes only via scoped safe-outputs (agent job is read-only); PR
branches are limited to `leak-fix/**`, changes to managed `src/**` (+
`PublicAPI.Unshipped.txt`).
- Skips cleanly if already fixed on `main`, out of scope (needs a device
fix), or attempt-capped.

---

## Validated end-to-end on **dotnet/maui itself** (pre-merge)

Both workflows were executed on this repo's own Actions infrastructure
(via short-lived `push`-triggered test branches, since
`workflow_dispatch` only lights up once a workflow is on `main`). Real
outputs, all on **dotnet/maui**:

- **Multi-leak in one run** — a single hunter run filed **5** distinct
proven `[leak-scan]` issues via the catalog-seeded sweep: dotnet#36343
`SwipeItemView.Command`, dotnet#36344 `ListView.RefreshCommand`, dotnet#36345 `Shell
BackButtonBehavior.Command` (all `ICommand.CanExecuteChanged`), dotnet#36346
`Picker.ItemsSource`, dotnet#36347 `IndicatorView.ItemsSource`
(`CollectionChanged`). dotnet#36344 and dotnet#36345 are leaks not previously
tracked upstream.
- **Proven-only** — a later run filed `[leak-scan]` dotnet#36350
`CollectionView.SelectedItems` and (correctly) **nothing else**, having
de-duped the already-filed leaks.
- **Track A fix** — dotnet#36309 `[leak-fix] Fix ResourceDictionary
MergedDictionaries memory leak` (regression test red→green + managed
fix).
- **Track C review-response** — on dotnet#36253 the fixer independently
re-read the code, agreed with the reviewer's findings, validated the
reviewer's `WeakEventManager` approach (24/24, red→green), and posted
the concrete fix.

---

## Notes for reviewers

- Everything the workflows file/open is **AI-generated** and clearly
labelled as such; treat them as high-quality drafts for human review.
- The workflows are self-contained (`.md` source + compiled
`.lock.yml`); merging them enables the `schedule` triggers on `main`.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SyedAbdulAzeemSF4852

Copy link
Copy Markdown
Contributor Author

Could you please check the failing tests?

@kubaflo, Reviewed all failing test cases — failures are not related to this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

@kubaflo
kubaflo changed the base branch from main to inflight/current July 8, 2026 11:27
@kubaflo
kubaflo merged commit 1fd219f into dotnet:inflight/current Jul 8, 2026
25 of 34 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR9 milestone Jul 8, 2026
kubaflo added a commit that referenced this pull request Jul 10, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 15, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 22, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 28, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 29, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Aug 7, 2026
…e space when no items are present (#36127)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

- On iOS/MacCatalyst, a CollectionView with no items incorrectly expands
to fill the entire screen height instead of collapsing to zero height,
pushing all sibling views off screen. Android behaves correctly.

- PR #30978 introduced an unconditional expansive fallback in
GetDesiredSize — when ContentSize == 0, it returned
base.GetDesiredSize() with no empty-CV guard. PR #31902 refactored this
into EnsureContentSizeForScrollDirection but preserved the same flawed
logic, as did subsequent refactors. On iOS/MacCatalyst,
EnsureContentSizeForScrollDirection cannot distinguish between a
genuinely empty CollectionView (0 items) and one whose items haven't
been laid out yet by UICollectionViewCompositionalLayout — both report
ContentSize == 0 — so it always applies the expansive fallback size,
causing an empty CV to expand to fill the screen instead of collapsing
to zero height.

- Updated ItemsViewHandler2.iOS.cs to avoid applying an expansive
fallback size when the CollectionView is empty (no items, no EmptyView).
Both the IsEmpty guard and the zero-frame check are scoped to
CollectionView only. Also handles the case where the CollectionView's
frame is zero in the scroll direction after transitioning from empty to
non-empty.
- Added the IsEmpty property to ItemsViewController2.cs using the
_isEmpty field (instead of ItemsSource?.ItemCount == 0) to correctly
handle a null ItemsSource and expose empty-state to the handler.

Fixes #35889

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before | After |
|----------|----------|
| <img
src="https://github.com/user-attachments/assets/2bb16dd8-3c4a-471b-b117-a9588c1467aa">
| <img
src="https://github.com/user-attachments/assets/df0dbf6c-6dd6-4145-9089-277cebd0cfbc">
|

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 2026
@github-actions github-actions Bot modified the milestones: .NET 10 SR9, .NET 10 SR11 Sep 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-collectionview community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Empty CollectionView Incorrect Height

6 participants