Skip to content

[Mac]Fix initial blank page in I6_Vertical_Item_Spacing_Page on iOS 27 - #39246

Merged
kubaflo merged 5 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-38730
Oct 9, 2026
Merged

kubaflo merged 5 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-38730

Conversation

@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor

Issue Details

CollectionView grouped grid page is blank when it first loads on macOS/Mac Catalyst with iOS 27 runtime. The data does not appear until the user manually resizes the application window. This indicates that the initial layout/rendering is not happening correctly.

Root cause

IsEmpty relied on the cached _isEmpty value, which is updated only after UIKit data-source callbacks. On macOS 27, measurement happens before these callbacks, so the CollectionView was incorrectly considered empty and measured as 0 × 0.

Description of Change

Updated IsEmpty to check ItemsSource.ItemCount directly instead of relying on _isEmpty. This ensures the correct empty state during measurement, regardless of UIKit callback timing.

Issues Fixed

Fixes #38730

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Mac
Before-38730.mov
Mac
After-38730.mov

@github-actions

github-actions Bot commented Oct 8, 2026

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 -- 39246

Or

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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@kubaflo

kubaflo commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

/azp run

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

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15610651 is running for ios.

The s/agent-review-in-progress label stays on this PR while the run is active. The final recommendation and outcome labels are posted only after Gate, expert review, and Deep UI tests finish.

@azure-pipelines

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

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-failed AI could not verify tests catch the bug s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Oct 8, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review October 8, 2026 13:29
Copilot AI balanced review requested due to automatic review settings October 8, 2026 13:29
@kubaflo

This comment has been minimized.

@kubaflo

kubaflo commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

/azp run

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

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15628027 is running for ios.

The s/agent-review-in-progress label stays on this PR while the run is active. The final recommendation and outcome labels are posted only after Gate, expert review, and Deep UI tests finish.

@azure-pipelines

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

@kubaflo
kubaflo changed the base branch from main to inflight/current October 9, 2026 11:05
@kubaflo
kubaflo merged commit 4c8d2bf into dotnet:inflight/current Oct 9, 2026
51 of 200 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Oct 9, 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

@devanathan-vaithiyanathan — new AI review results are available based on commit 7c649e6.

Gate Partial Confidence Low Platform iOS


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

Gate Result: ❌ FAILED

Platform: IOS · Base: main · Merge base: 45bab995

🩺 Test does not reproduce the bug — ran the same in both states (PASS without fix, PASS with fix). The repro test is not exercising the issue. Strengthen the test before reviewing the fix.

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue38730 Issue38730 ❌ PASS — 296s ✅ PASS — 92s
🔴 Without fix — 🖥️ Issue38730: PASS ❌ · 296s

(no coded error found; showing last 1200 chars)

ing 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.13)
[xUnit.net 00:00:00.06]   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
>>>>> 10/9/2026 3:28:39 AM FixtureSetup for Issue38730(iOS)
>>>>> 10/9/2026 3:28:43 AM VerifyVerticalItemSpacingPageRendering Start
>>>>> 10/9/2026 3:28:45 AM VerifyVerticalItemSpacingPageRendering Stop
  Passed VerifyVerticalItemSpacingPageRendering [2 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38730.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 21.9617 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38730.trx
🟢 With fix — 🖥️ Issue38730: PASS ✅ · 92s

(no coded error found; showing last 1200 chars)

ing 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.13)
[xUnit.net 00:00:00.04]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.15]   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
>>>>> 10/9/2026 3:33:20 AM FixtureSetup for Issue38730(iOS)
>>>>> 10/9/2026 3:33:24 AM VerifyVerticalItemSpacingPageRendering Start
>>>>> 10/9/2026 3:33:25 AM VerifyVerticalItemSpacingPageRendering Stop
  Passed VerifyVerticalItemSpacingPageRendering [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38730.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 19.8708 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38730.trx

⚠️ Failure Details

  • ❌ Issue38730 PASSED without fix (should fail) — tests don't catch the bug
📁 Fix files reverted (1 files)
  • src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs

📋 Pre-Flight — Context & Validation

Pre-Flight Context

PR and reported problem

  • PR #39246 targets main and links/fixes #38730. Submitted head: 7c649e6f936194ecbb5c4bdb5db1d1ba88bfa284.
  • #38730 reports that a grouped vertical CollectionView using GridItemsLayout.VerticalItemSpacing initially renders blank on Mac Catalyst. Content appears only after resizing the window.
  • Reported reproduction is environment-sensitive: macOS 27 with the iOS 27.0.10715 runtime reproduces; reports say macOS 26.6/26.6.2 or macOS 27 with an iOS 26 runtime do not.
  • The issue is labeled as a regression and assigned to the .NET 10 SR12 milestone. Reported affected MAUI versions vary across the issue text (10.0.0, 10.0.100, 10.0.101, and 10.0.110), so the exact first affected version is unknown.
  • The PR description records only Mac as manually tested; iOS, Android, and Windows remain unchecked there. It supplies Mac before/after recordings, whose contents were not independently inspected here.

Changed mechanism

The functional change is in src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs:

  • _isEmpty starts as true and is updated by CheckForEmptySource(), which is called from the UIKit GetItemsCount data-source callback.
  • During measurement, ItemsViewHandler2.iOS.cs obtains the native content size. If that size is zero and Controller.IsEmpty is true, it returns the zero size immediately rather than forcing layout or using the expansive-size fallback.
  • The submitted change makes IsEmpty query (ItemsSource?.ItemCount ?? 0) == 0 directly on Mac Catalyst 27 or later, while preserving _isEmpty on iOS, earlier Mac Catalyst versions, and other targets.
  • The stated rationale is that Mac Catalyst 27 may defer UIKit data-source callbacks until usable bounds exist. Before those callbacks, the initial _isEmpty == true can incorrectly collapse a populated collection to zero, preventing the layout pass needed to realize its content.
  • _emptyViewDisplayed remains part of both branches, so a displayed EmptyView is not treated as a zero-sized collection by this property.

Submitted files

The immutable diff contains seven files:

File Purpose
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs Mac Catalyst 27-specific empty-state lookup
src/Controls/tests/TestCases.HostApp/Issues/Issue38730.cs Grouped vertical grid reproduction with three groups and VerticalItemSpacing = 10
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38730.cs Navigates to the reproduction and performs screenshot verification
src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyVerticalItemSpacingPageRendering.png Android baseline
src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyVerticalItemSpacingPageRendering.png Mac baseline
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyVerticalItemSpacingPageRendering.png Windows baseline
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyVerticalItemSpacingPageRendering.png iOS 26 baseline

The UI test waits for the navigation button, opens the target page, waits for the instruction label, and then compares a screenshot. The binary baselines cannot be evaluated from the textual diff.

Platform-sensitive paths

  • Although the implementation file is under Items2/iOS, that source surface is shared by iOS and Mac Catalyst.
  • The new behavior is guarded by OperatingSystem.IsMacCatalystVersionAtLeast(27, 0). A test executed with -Platform ios will exercise the unchanged _isEmpty branch, not the newly added Mac Catalyst 27 branch.
  • The issue and HostApp scenario identify Mac/macOS as affected, while the PR title refers to “iOS 27” because the reported Mac environment uses an iOS 27 runtime. The exact relationship between the reported runtime build and the version returned by the Mac Catalyst OS API remains to be confirmed.
  • The new iOS screenshot is specifically under ios-26; no submitted ios-27 baseline is present. Whether the Mac baseline was captured on the affected macOS 27/iOS 27 runtime is unknown.
  • Android and Windows receive only screenshot baselines; the functional handler change does not target those platforms.

Required validation context

  • Later candidate validation is constrained to iOS.

  • The supplied gate result is Gate ❌ FAILED — tests did not behave as expected. It must not be rerun. The specific failing test, observed output, and failure diagnostics are unknown from the supplied gate summary.

  • After a candidate’s primary test succeeds, the mandatory regression test is:

    BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue37361"

  • Any failure of that regression test makes the candidate a failure, even if its primary test passes.

  • #38296 touched the same controller while fixing #37361. That prior regression concerns RefreshView pull-to-refresh when a CollectionView is empty. Its scenario checks both an initially empty collection and an add-then-clear transition, making empty-state and EmptyView lifecycle behavior the relevant cross-reference.

  • No commands or tests were executed during this context-gathering pass.

Remaining uncertainties

  • The proposed callback-timing root cause is reported by the PR and is consistent with the surrounding measurement flow, but it was not independently observed at runtime here.
  • The reason for the recorded gate failure is unknown.
  • Direct ItemsSource.ItemCount behavior across grouped sources, source replacement, collection mutation, null sources, and empty-view transitions still requires validation on the affected runtime.
  • The screenshot test’s instruction text describes “no extra space,” whereas #38730 describes an initially blank page requiring resize; whether the screenshot oracle precisely detects the reported failure is not established here.
  • Validation evidence for the actual Mac Catalyst 27 branch, broader CI status, and visual correctness of the binary snapshots is unavailable or unknown.
  • This is scoped pre-flight context, not an exhaustive code review or a candidate comparison.

🔬 Code Review — Deep Analysis

Code Review — PR #39246

Independent Assessment

What this changes: On Mac Catalyst 27 or later, ItemsViewController2.IsEmpty derives the current empty state from ItemsSource.ItemCount instead of the callback-populated _isEmpty cache. The iOS and earlier Mac Catalyst paths retain the existing cached behavior. The PR also adds a grouped-grid UI scenario and screenshot baselines.

Inferred motivation: Initial measurement on the affected Mac Catalyst runtime can occur before UIKit invokes the data-source callbacks that update _isEmpty. A populated collection can therefore be treated as empty and measured at zero size until a window resize triggers another layout.

Expert Findings

The single maui-expert-reviewer pass completed and wrote inline-findings.json. It reported no concrete file-and-line findings ([]).

Blast Radius Assessment

  • Runs for all Items2 CollectionView instances on Mac Catalyst 27 or later when IsEmpty is queried; iOS and older Mac Catalyst behavior is unchanged.
  • Affects initial and subsequent measurement decisions for populated, empty, grouped, and source-replaced collections on the guarded runtime.
  • Adds no static/shared state and does not alter handler connection or disposal behavior.

Failure-Mode Probing

  • Null source: The guarded branch treats a null ItemsSource as empty and still excludes a displayed EmptyView, matching the property's stated contract.
  • Grouped source: The guarded branch queries the aggregate ItemCount; no concrete inconsistency with the existing grouped count paths was identified.
  • Empty-to-populated transitions: The existing callbacks still update _isEmpty and EmptyView visibility. The new branch changes only the measurement-time read on Mac Catalyst 27 or later.
  • Other platforms: The runtime guard leaves iOS behavior unchanged, so an iOS-only run cannot exercise the submitted functional branch.

Validation Evidence

The trusted Gate failed definitively: Issue38730 passed both without and with the fix on iOS. The submitted test therefore did not demonstrate the reported regression, and the affected Mac Catalyst 27 branch remains unvalidated by Gate evidence.

Refinement Decision

No pr-plus-reviewer refinement was generated. The expert review identified no concrete actionable source defect or unresolved behavioral mechanism meeting the evidence-first refinement threshold; a patch was not created merely to compensate for missing validation evidence.

External Output Contract

Not applicable.

Verdict: NEEDS_DISCUSSION

Confidence: low

Summary: The implementation is localized and no concrete code defect was found, but the supplied regression test passed without the fix and did not execute the Mac Catalyst 27-specific branch. The submitted fix cannot be considered validated until the test reliably fails without the fix and passes with it on the affected path.


🛠️ Try-Fix — Analysis & Comparison

Alternative generation: not requested

Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.


📝 PR Finalize — Recommended Title & Description

Assessment: ✏️ Recommend updating — the title uses a scenario name and conflates the affected Mac Catalyst environment with iOS, while the description overstates the direct ItemCount lookup as applying to every platform rather than only Mac Catalyst 27 or later.

Recommended title

[Mac Catalyst] CollectionView: Fix initial blank grouped grid on macOS 27

Recommended description

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! 
-->

### Issue Details

A grouped grid CollectionView with `GridItemsLayout.VerticalItemSpacing` is blank when it first loads on macOS 27 with the Mac Catalyst iOS 27 runtime. The data appears only after the user manually resizes the application window, indicating that the initial measurement occurs before the collection is laid out.

### Root cause

`ItemsViewController2.IsEmpty` relied on the cached `_isEmpty` value, which is initialized to `true` and updated by UIKit data-source callbacks. On Mac Catalyst 27, initial measurement can occur before those callbacks, so a populated CollectionView can be treated as empty and measured at 0 × 0.

### Description of Change

On Mac Catalyst 27 and later, `ItemsViewController2.IsEmpty` now reads `ItemsSource.ItemCount` directly while continuing to account for a displayed `EmptyView`. iOS and earlier Mac Catalyst versions retain the existing `_isEmpty` behavior.

The change also adds an `Issue38730` UI scenario for a grouped vertical grid with `VerticalItemSpacing = 10` and screenshot baselines for Android, Mac Catalyst, Windows, and iOS 26.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730

<!--
Are you targeting main? All PRs should target the main branch unless otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Mac**<br> <video src="https://github.com/user-attachments/assets/9e554768-9749-4ffc-92d8-762bc1eaab99" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/c19b09a4-699c-47c6-8bcf-c6933f2c5e72" width="600" height="300"> |

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE Trusted evidence-first context consumed
Code Review NEEDS_DISCUSSION (low) Single expert pass completed; 0 inline findings, but affected behavior remains unvalidated
Gate ❌ FAILED Issue38730 passed both without and with the fix on iOS
Try-Fix Not requested Evidence-first mode intentionally omitted alternative generation
Refinement Not generated No expert finding met the evidence-backed refinement threshold
Report ✅ COMPLETE

Code Review and Candidate Comparison

The raw pr is the only real candidate. The expert review found no concrete actionable code defect, so no pr-plus-reviewer patch was implemented; no try-fix-* candidates exist because alternative generation was not requested. The submitted PR is selected by default, but it is not demonstrated merge-ready: Gate failed because the regression test passed without the fix, and its iOS execution did not exercise the Mac Catalyst 27-specific branch.

Summary

Request changes to make the regression test reproduce the reported failure on the affected Mac Catalyst 27 path. The test must fail without the fix and pass with it before the submitted implementation can support approval. The mandatory Issue37361 regression cannot elevate this candidate because the primary bug demonstration was not established.

Root Cause

The submitted fix addresses a plausible timing cycle: _isEmpty initially remains true until UIKit data-source callbacks run, while Mac Catalyst 27 can measure before those callbacks. The zero-content-size path then treats a populated CollectionView as empty and returns zero size, preventing the layout that would populate it until a later resize.

Fix Quality

The runtime-gated ItemCount lookup is localized, preserves _emptyViewDisplayed, and leaves iOS and earlier Mac Catalyst behavior unchanged. However, the only trusted primary validation passed in both broken and fixed states on an unaffected iOS path. With Gate failed and no affected-runtime evidence, the candidate cannot be approved despite the absence of inline expert findings.


🔗 Regression Cross-Reference

🔍 Regression Cross-Reference

⚠ Overlaps with prior bug-fix PRs — same files modified, but no exact line revert detected.

File Fix PR Fixed issue(s)
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs #38296 #37361
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs #35234 #7580, #9095, #11402, #12916, #13243, #13801, #15806, #19560, #19690, #19866, #20028, #26103, #26366, #27554, #29529, #29772, #30192, #30199, #30254, #31658, #31799, #32971, #33065, #33241, #33334, #33373, #33500, #33615, #33767, #33783, #34101, #34257, #34266, #34402, #34504, #34551, #34611, #34662, #34671, #34716, #34755, #34759, #34771, #34772, #34842, #34846, #34848, #34861, #34889, #34892, #34897, #34898, #34900, #34917, #34925, #34953, #34975, #35005, #35018, #35063, #35116, #35119, #35125, #35127

🧪 Regression Tests to Verify

These tests were added by the overlapping fix PRs. Running them to verify no side-effect regressions:

Fix PR Type Test Filter
#38296 UITest Issue37361 Issue37361

🧪 Regression Test Results

✅ PASSED — 1 passed, 0 failed, 0 skipped

Fix PR Test Type Result
#38296 Issue37361 UITest ✅ PASSED

📱 UI Tests — CollectionView

Detected UI test categories: CollectionView

✅ Deep UI tests — 432 passed, 0 failed, 5 skipped across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
CollectionView 432/437 (5 skipped) ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🧭 Next Steps — review latest findings

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

@kubaflo

kubaflo commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

/backport to inflight/candidate

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to inflight/candidate (link to workflow run)

kubaflo added a commit that referenced this pull request Oct 12, 2026
…Spacing_Page on iOS 27 (#39319)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Backport of #39246 to `inflight/candidate` for SR12 Apple compatibility.
This intentionally targets Candidate rather than `main`.

Computes CollectionView empty state from the current
`ItemsSource.ItemCount` instead of the delayed cached state, preventing
the initially blank grouped-grid page on the Apple 27 runtime. Includes
the original Issue38730 reproduction page, regression test, and platform
snapshots unchanged.

Source commit: `4c8d2bf20e2f7940fa3b324c2086750da4a7877e`. Automation
replayed the original commit series; its final complete seven-file patch
exactly matches the merged source change, including binary snapshots.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 (backport).

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

### Validation

- `git diff --check
origin/inflight/candidate...origin/backport/pr-39246-to-inflight/candidate`
— passed.
- Source and backport binary-inclusive diffs have the same `git patch-id
--stable`: `84a0d347e0c3a620bb65e0389a5d73eacb70a2fb`.
- Candidate baseline: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`;
backport head: `fb9e99559abcc11e620f0309fd5c12f49728e4f5`.
- `maui-pr` [build
1631864](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1631864)
is running for this exact PR head; its result is not yet available.
- Device/UI runtime tests were not rerun locally. No simulator, Appium,
or XCTest was launched.

/cc @kubaflo @devanathan-vaithiyanathan

---------

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Oct 12, 2026
…r orientation change (#39322)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Manual SR12 backport of #39271, using only the parent diff of the final
merged source commit `6c215aef9240fe062ed0faee429e6e17ca70c02d` (parent
`e0eb61af616187a56f2b0df0f7ea65826420747e`). **Explicit exception to the
template's generic main-only guidance: this requested servicing backport
targets `inflight/candidate`.**

Restore layout invalidation when the Items2 CollectionView's bounds size
changes during rotation or resizing. Keep the existing
`IsCloseTo(_currentSize)` guard and `PrepareLayout` tracking unchanged,
preserving scroll position for unchanged sizes. Carry the source
regression page, rotation test, and all three binary snapshots
unchanged: exactly six files, one focused fix.

The automated backport failed because its historical patch-series
fallback started with an unrelated dependency-bump commit. This PR
applies the clean merged fix directly; it does not retry automation,
replay dependency commits, or include any of the other SR12 backports
(#38947, #39047, #39246, #39264).

**Patch identity:** both binary-inclusive source and backport diffs
produce stable patch ID `c9363ac3e2a9cb0e5643de4a02af0be2b9ac9b84` via
`git patch-id --stable`.

**Build-only validation performed in this worktree:**

The default `dotnet --version` resolves SDK
`11.0.100-preview.6.26359.118`; Candidate pins
`10.0.113-servicing.26454.107`. Commands below explicitly use the
already-installed SDK `10.0.100`, without changing tracked
SDK/package/workload pins.

- `git diff --cached --check` — passed before commit.
- `git diff --binary 6c215ae^ 6c215ae | git patch-id --stable` and
`git diff --cached --binary | git patch-id --stable` — passed, identical
patch IDs including the PNG snapshots; six-file scope confirmed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format
whitespace Microsoft.Maui.sln --no-restore --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs
src/Controls/tests/TestCases.HostApp/Issues/Issue39270.cs
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39270.cs
--verify-no-changes --verbosity quiet` — passed, no formatting changes
needed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors. Initial `--no-restore` attempt failed due to missing
assets/reference assemblies; the normal restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors; compiles the carried shared rotation test under the iOS
test constants. Initial `--no-restore` attempt failed for missing
assets; restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — blocked by local
toolchain mismatch: installed .NET iOS `26.1.10494` requires Xcode 26.1,
but installed Xcode is 26.6. An earlier `-f net10.0-ios26.0` attempt
failed because HostApp's sample TFM is `net10.0-ios`; the corrected
documented TFM reached the Xcode compatibility check.

**Limitations:** HostApp full build and runtime rotation/screenshot
validation remain unverified locally. No XCTest, Appium execution,
device/simulator boot or launch, MacCatalyst execution, or GUI actions
were performed, as requested. CI must provide the pinned-toolchain and
runtime validation; successful local compilation is not a
merge-readiness claim.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39270

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This is the explicitly requested `inflight/candidate` SR12 backport, not
a new main-branch fix.

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Oct 13, 2026
#39246)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
CollectionView grouped grid page is blank when it first loads on
macOS/Mac Catalyst with iOS 27 runtime. The data does not appear until
the user manually resizes the application window. This indicates that
the initial layout/rendering is not happening correctly.

### Root cause

IsEmpty relied on the cached _isEmpty value, which is updated only after
UIKit data-source callbacks. On macOS 27, measurement happens before
these callbacks, so the CollectionView was incorrectly considered empty
and measured as 0 × 0.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated IsEmpty to check ItemsSource.ItemCount directly instead of
relying on _isEmpty. This ensures the correct empty state during
measurement, regardless of UIKit callback timing.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/9e554768-9749-4ffc-92d8-762bc1eaab99"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/c19b09a4-699c-47c6-8bcf-c6933f2c5e72"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 13, 2026
…Spacing_Page on iOS 27 (#39319)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Backport of #39246 to `inflight/candidate` for SR12 Apple compatibility.
This intentionally targets Candidate rather than `main`.

Computes CollectionView empty state from the current
`ItemsSource.ItemCount` instead of the delayed cached state, preventing
the initially blank grouped-grid page on the Apple 27 runtime. Includes
the original Issue38730 reproduction page, regression test, and platform
snapshots unchanged.

Source commit: `4c8d2bf20e2f7940fa3b324c2086750da4a7877e`. Automation
replayed the original commit series; its final complete seven-file patch
exactly matches the merged source change, including binary snapshots.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 (backport).

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

### Validation

- `git diff --check
origin/inflight/candidate...origin/backport/pr-39246-to-inflight/candidate`
— passed.
- Source and backport binary-inclusive diffs have the same `git patch-id
--stable`: `84a0d347e0c3a620bb65e0389a5d73eacb70a2fb`.
- Candidate baseline: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`;
backport head: `fb9e99559abcc11e620f0309fd5c12f49728e4f5`.
- `maui-pr` [build
1631864](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1631864)
is running for this exact PR head; its result is not yet available.
- Device/UI runtime tests were not rerun locally. No simulator, Appium,
or XCTest was launched.

/cc @kubaflo @devanathan-vaithiyanathan

---------

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Oct 13, 2026
…r orientation change (#39322)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Manual SR12 backport of #39271, using only the parent diff of the final
merged source commit `6c215aef9240fe062ed0faee429e6e17ca70c02d` (parent
`e0eb61af616187a56f2b0df0f7ea65826420747e`). **Explicit exception to the
template's generic main-only guidance: this requested servicing backport
targets `inflight/candidate`.**

Restore layout invalidation when the Items2 CollectionView's bounds size
changes during rotation or resizing. Keep the existing
`IsCloseTo(_currentSize)` guard and `PrepareLayout` tracking unchanged,
preserving scroll position for unchanged sizes. Carry the source
regression page, rotation test, and all three binary snapshots
unchanged: exactly six files, one focused fix.

The automated backport failed because its historical patch-series
fallback started with an unrelated dependency-bump commit. This PR
applies the clean merged fix directly; it does not retry automation,
replay dependency commits, or include any of the other SR12 backports
(#38947, #39047, #39246, #39264).

**Patch identity:** both binary-inclusive source and backport diffs
produce stable patch ID `c9363ac3e2a9cb0e5643de4a02af0be2b9ac9b84` via
`git patch-id --stable`.

**Build-only validation performed in this worktree:**

The default `dotnet --version` resolves SDK
`11.0.100-preview.6.26359.118`; Candidate pins
`10.0.113-servicing.26454.107`. Commands below explicitly use the
already-installed SDK `10.0.100`, without changing tracked
SDK/package/workload pins.

- `git diff --cached --check` — passed before commit.
- `git diff --binary 6c215ae^ 6c215ae | git patch-id --stable` and
`git diff --cached --binary | git patch-id --stable` — passed, identical
patch IDs including the PNG snapshots; six-file scope confirmed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format
whitespace Microsoft.Maui.sln --no-restore --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs
src/Controls/tests/TestCases.HostApp/Issues/Issue39270.cs
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39270.cs
--verify-no-changes --verbosity quiet` — passed, no formatting changes
needed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors. Initial `--no-restore` attempt failed due to missing
assets/reference assemblies; the normal restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors; compiles the carried shared rotation test under the iOS
test constants. Initial `--no-restore` attempt failed for missing
assets; restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — blocked by local
toolchain mismatch: installed .NET iOS `26.1.10494` requires Xcode 26.1,
but installed Xcode is 26.6. An earlier `-f net10.0-ios26.0` attempt
failed because HostApp's sample TFM is `net10.0-ios`; the corrected
documented TFM reached the Xcode compatibility check.

**Limitations:** HostApp full build and runtime rotation/screenshot
validation remain unverified locally. No XCTest, Appium execution,
device/simulator boot or launch, MacCatalyst execution, or GUI actions
were performed, as requested. CI must provide the pinned-toolchain and
runtime validation; successful local compilation is not a
merge-readiness claim.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39270

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This is the explicitly requested `inflight/candidate` SR12 backport, not
a new main-branch fix.

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Oct 14, 2026
#39246)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
CollectionView grouped grid page is blank when it first loads on
macOS/Mac Catalyst with iOS 27 runtime. The data does not appear until
the user manually resizes the application window. This indicates that
the initial layout/rendering is not happening correctly.

### Root cause

IsEmpty relied on the cached _isEmpty value, which is updated only after
UIKit data-source callbacks. On macOS 27, measurement happens before
these callbacks, so the CollectionView was incorrectly considered empty
and measured as 0 × 0.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated IsEmpty to check ItemsSource.ItemCount directly instead of
relying on _isEmpty. This ensures the correct empty state during
measurement, regardless of UIKit callback timing.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/9e554768-9749-4ffc-92d8-762bc1eaab99"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/c19b09a4-699c-47c6-8bcf-c6933f2c5e72"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 14, 2026
…Spacing_Page on iOS 27 (#39319)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Backport of #39246 to `inflight/candidate` for SR12 Apple compatibility.
This intentionally targets Candidate rather than `main`.

Computes CollectionView empty state from the current
`ItemsSource.ItemCount` instead of the delayed cached state, preventing
the initially blank grouped-grid page on the Apple 27 runtime. Includes
the original Issue38730 reproduction page, regression test, and platform
snapshots unchanged.

Source commit: `4c8d2bf20e2f7940fa3b324c2086750da4a7877e`. Automation
replayed the original commit series; its final complete seven-file patch
exactly matches the merged source change, including binary snapshots.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 (backport).

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

### Validation

- `git diff --check
origin/inflight/candidate...origin/backport/pr-39246-to-inflight/candidate`
— passed.
- Source and backport binary-inclusive diffs have the same `git patch-id
--stable`: `84a0d347e0c3a620bb65e0389a5d73eacb70a2fb`.
- Candidate baseline: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`;
backport head: `fb9e99559abcc11e620f0309fd5c12f49728e4f5`.
- `maui-pr` [build
1631864](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1631864)
is running for this exact PR head; its result is not yet available.
- Device/UI runtime tests were not rerun locally. No simulator, Appium,
or XCTest was launched.

/cc @kubaflo @devanathan-vaithiyanathan

---------

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Oct 14, 2026
…r orientation change (#39322)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Manual SR12 backport of #39271, using only the parent diff of the final
merged source commit `6c215aef9240fe062ed0faee429e6e17ca70c02d` (parent
`e0eb61af616187a56f2b0df0f7ea65826420747e`). **Explicit exception to the
template's generic main-only guidance: this requested servicing backport
targets `inflight/candidate`.**

Restore layout invalidation when the Items2 CollectionView's bounds size
changes during rotation or resizing. Keep the existing
`IsCloseTo(_currentSize)` guard and `PrepareLayout` tracking unchanged,
preserving scroll position for unchanged sizes. Carry the source
regression page, rotation test, and all three binary snapshots
unchanged: exactly six files, one focused fix.

The automated backport failed because its historical patch-series
fallback started with an unrelated dependency-bump commit. This PR
applies the clean merged fix directly; it does not retry automation,
replay dependency commits, or include any of the other SR12 backports
(#38947, #39047, #39246, #39264).

**Patch identity:** both binary-inclusive source and backport diffs
produce stable patch ID `c9363ac3e2a9cb0e5643de4a02af0be2b9ac9b84` via
`git patch-id --stable`.

**Build-only validation performed in this worktree:**

The default `dotnet --version` resolves SDK
`11.0.100-preview.6.26359.118`; Candidate pins
`10.0.113-servicing.26454.107`. Commands below explicitly use the
already-installed SDK `10.0.100`, without changing tracked
SDK/package/workload pins.

- `git diff --cached --check` — passed before commit.
- `git diff --binary 6c215ae^ 6c215ae | git patch-id --stable` and
`git diff --cached --binary | git patch-id --stable` — passed, identical
patch IDs including the PNG snapshots; six-file scope confirmed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format
whitespace Microsoft.Maui.sln --no-restore --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs
src/Controls/tests/TestCases.HostApp/Issues/Issue39270.cs
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39270.cs
--verify-no-changes --verbosity quiet` — passed, no formatting changes
needed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors. Initial `--no-restore` attempt failed due to missing
assets/reference assemblies; the normal restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors; compiles the carried shared rotation test under the iOS
test constants. Initial `--no-restore` attempt failed for missing
assets; restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — blocked by local
toolchain mismatch: installed .NET iOS `26.1.10494` requires Xcode 26.1,
but installed Xcode is 26.6. An earlier `-f net10.0-ios26.0` attempt
failed because HostApp's sample TFM is `net10.0-ios`; the corrected
documented TFM reached the Xcode compatibility check.

**Limitations:** HostApp full build and runtime rotation/screenshot
validation remain unverified locally. No XCTest, Appium execution,
device/simulator boot or launch, MacCatalyst execution, or GUI actions
were performed, as requested. CI must provide the pinned-toolchain and
runtime validation; successful local compilation is not a
merge-readiness claim.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39270

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This is the explicitly requested `inflight/candidate` SR12 backport, not
a new main-branch fix.

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Oct 18, 2026
#39246)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
CollectionView grouped grid page is blank when it first loads on
macOS/Mac Catalyst with iOS 27 runtime. The data does not appear until
the user manually resizes the application window. This indicates that
the initial layout/rendering is not happening correctly.

### Root cause

IsEmpty relied on the cached _isEmpty value, which is updated only after
UIKit data-source callbacks. On macOS 27, measurement happens before
these callbacks, so the CollectionView was incorrectly considered empty
and measured as 0 × 0.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated IsEmpty to check ItemsSource.ItemCount directly instead of
relying on _isEmpty. This ensures the correct empty state during
measurement, regardless of UIKit callback timing.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/9e554768-9749-4ffc-92d8-762bc1eaab99"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/c19b09a4-699c-47c6-8bcf-c6933f2c5e72"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 18, 2026
…Spacing_Page on iOS 27 (#39319)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Backport of #39246 to `inflight/candidate` for SR12 Apple compatibility.
This intentionally targets Candidate rather than `main`.

Computes CollectionView empty state from the current
`ItemsSource.ItemCount` instead of the delayed cached state, preventing
the initially blank grouped-grid page on the Apple 27 runtime. Includes
the original Issue38730 reproduction page, regression test, and platform
snapshots unchanged.

Source commit: `4c8d2bf20e2f7940fa3b324c2086750da4a7877e`. Automation
replayed the original commit series; its final complete seven-file patch
exactly matches the merged source change, including binary snapshots.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38730 (backport).

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

### Validation

- `git diff --check
origin/inflight/candidate...origin/backport/pr-39246-to-inflight/candidate`
— passed.
- Source and backport binary-inclusive diffs have the same `git patch-id
--stable`: `84a0d347e0c3a620bb65e0389a5d73eacb70a2fb`.
- Candidate baseline: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`;
backport head: `fb9e99559abcc11e620f0309fd5c12f49728e4f5`.
- `maui-pr` [build
1631864](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1631864)
is running for this exact PR head; its result is not yet available.
- Device/UI runtime tests were not rerun locally. No simulator, Appium,
or XCTest was launched.

/cc @kubaflo @devanathan-vaithiyanathan

---------

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Oct 18, 2026
…r orientation change (#39322)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Manual SR12 backport of #39271, using only the parent diff of the final
merged source commit `6c215aef9240fe062ed0faee429e6e17ca70c02d` (parent
`e0eb61af616187a56f2b0df0f7ea65826420747e`). **Explicit exception to the
template's generic main-only guidance: this requested servicing backport
targets `inflight/candidate`.**

Restore layout invalidation when the Items2 CollectionView's bounds size
changes during rotation or resizing. Keep the existing
`IsCloseTo(_currentSize)` guard and `PrepareLayout` tracking unchanged,
preserving scroll position for unchanged sizes. Carry the source
regression page, rotation test, and all three binary snapshots
unchanged: exactly six files, one focused fix.

The automated backport failed because its historical patch-series
fallback started with an unrelated dependency-bump commit. This PR
applies the clean merged fix directly; it does not retry automation,
replay dependency commits, or include any of the other SR12 backports
(#38947, #39047, #39246, #39264).

**Patch identity:** both binary-inclusive source and backport diffs
produce stable patch ID `c9363ac3e2a9cb0e5643de4a02af0be2b9ac9b84` via
`git patch-id --stable`.

**Build-only validation performed in this worktree:**

The default `dotnet --version` resolves SDK
`11.0.100-preview.6.26359.118`; Candidate pins
`10.0.113-servicing.26454.107`. Commands below explicitly use the
already-installed SDK `10.0.100`, without changing tracked
SDK/package/workload pins.

- `git diff --cached --check` — passed before commit.
- `git diff --binary 6c215ae^ 6c215ae | git patch-id --stable` and
`git diff --cached --binary | git patch-id --stable` — passed, identical
patch IDs including the PNG snapshots; six-file scope confirmed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format
whitespace Microsoft.Maui.sln --no-restore --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs
src/Controls/tests/TestCases.HostApp/Issues/Issue39270.cs
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39270.cs
--verify-no-changes --verbosity quiet` — passed, no formatting changes
needed.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors. Initial `--no-restore` attempt failed due to missing
assets/reference assemblies; the normal restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeIosTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0
warnings/errors; compiles the carried shared rotation test under the iOS
test constants. Initial `--no-restore` attempt failed for missing
assets; restore-enabled build succeeded.
- `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64
-p:IncludeAndroidTargetFrameworks=false
-p:IncludeMacCatalystTargetFrameworks=false
-p:IncludeMacOSTargetFrameworks=false
-p:IncludeTizenTargetFrameworks=false
-p:IncludeWindowsTargetFrameworks=false -v:q` — blocked by local
toolchain mismatch: installed .NET iOS `26.1.10494` requires Xcode 26.1,
but installed Xcode is 26.6. An earlier `-f net10.0-ios26.0` attempt
failed because HostApp's sample TFM is `net10.0-ios`; the corrected
documented TFM reached the Xcode compatibility check.

**Limitations:** HostApp full build and runtime rotation/screenshot
validation remain unverified locally. No XCTest, Appium execution,
device/simulator boot or launch, MacCatalyst execution, or GUI actions
were performed, as requested. CI must provide the pinned-toolchain and
runtime validation; successful local compilation is not a
merge-readiness claim.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39270

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This is the explicitly requested `inflight/candidate` SR12 backport, not
a new main-branch fix.

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Co-authored-by: Copilot App <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 Nov 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-failed AI could not verify tests catch the bug 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.

[MAUI] I6_Vertical_Item_Spacing_Page - Using iOS 27.0.10715, the page is initially blank and would require resizing window for the text to show up.

5 participants