Skip to content

[iOS] Fix Label truncation after item text updates in CollectionView - #39558

Merged
kubaflo merged 4 commits into
dotnet:inflight/candidatefrom
devanathan-vaithiyanathan:fix-39534
Oct 26, 2026
Merged

kubaflo merged 4 commits into
dotnet:inflight/candidatefrom
devanathan-vaithiyanathan:fix-39534

Conversation

@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor

Issue Details

Issue #35859 was related to MeasureFirstItem measuring all items in CV2, so a fix was added in PR #36159. However, the changes in PR #36159 caused a regression in Issue #38275, which was addressed in PR #38338. The current issue was also regressed by the changes in PR #36159.

Description of Change

Gerald's PR resolves Issues 35859, 38275, and current issue(39534). Therefore, PR #36159 and PR #38338 are being reverted to avoid duplicate fixes and regressions.

Issues Fixed

Fixes #39534

Tested the behavior in the following platforms.

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

@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 -- 39558

Or

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

@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [iOS] Fix Label truncation after item text updates in CollectionView [WIP][iOS] Fix Label truncation after item text updates in CollectionView Oct 22, 2026
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 22, 2026
@azure-pipelines

This comment has been minimized.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [WIP][iOS] Fix Label truncation after item text updates in CollectionView [iOS] Fix Label truncation after item text updates in CollectionView Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions github-actions Bot added s/agent-review-in-progress AI review is currently running for this PR and removed s/agent-review-in-progress AI review is currently running for this PR labels Oct 23, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Review Summary

@devanathan-vaithiyanathan — performance review for commit 119f9f49995c.

Scope Static review Result Device measurement required Commit 119f9f49995c


Performance Results

Verdict: 🟡 Partial/inconclusive — device measurement required

The pinned diff restores an unconditional Measure call when a MeasureFirstItem cached size is reused in TemplatedCell2. No managed suites were selected, and no run manifest or comparison results were supplied; neither managed performance nor native execution is established by this evidence. Device measurement required: the supplied evidence does not cover the changed native handler path, so the whole PR cannot receive a clean performance verdict.

Coverage

Product files: 1; directly managed-measured: 0; device-required: 1; static-reviewed: 0. Sampled subsets: managed 0, device 0.

Device measurement required: the supplied evidence does not cover the changed native handler path, so the whole PR cannot receive a clean performance verdict.

  • collectionview-scroll-ios on iOS, MacCatalyst: direct coverage; required-not-yet-automated.
    Operation: Reset to the top and repeat ScrollTo(MakeVisible, animated) to item 2 in section 1 at least ten times. Wait for animation and layout to settle after every operation. Verify the target item is visible and record its viewport position spread against the first measured result.
    Correctness: UICollectionView measurement, compositional-layout invalidation, and ScrollTo behavior require UIKit.

Findings & Follow-up

Static hot-path review

At src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs:143, removing the _cachedConstraints != constraints guard causes virtualView.Measure to run whenever this cached-size branch is reached, including unchanged constraints. This cell-fitting path participates in CollectionView layout and recycling on iOS and MacCatalyst, so repeated measurement is a concrete unmeasured work concern; its frequency, actual child-measure work, allocations, and latency are unknown. The diff also removes item-source tracking and its constraint reset, but any savings there do not establish that the repeated-measure cost is offset. No new repeated-work concern is attributed to the reproduction page setup or its button-driven sorting.

Recommended next action

needs_human_discussion

Human discussion is appropriate because the changed UIKit cell-fitting path requires iOS and MacCatalyst execution, while the selected native scenario is not automated by this workflow. There is no directly measured or sampled managed coverage to substitute for that missing evidence; static inspection alone cannot establish native timing, correctness, or accessibility. Retrying managed benchmarks would not close this native gap, and the supplied test source is not execution evidence.

Maintainers: comment /review performance to refresh this report.

Automated analysis by the perf-analysis skill.

@kubaflo

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Tests Failure Analysis

@devanathan-vaithiyanathan — test-failure analysis for commit 119f9f4.

Scope CI failures Commit 119f9f4


🧪 CI Analysis — click to expand
📊 maui-pr
  • 🟢 Likely unrelated — iOS ARM64 integration checkout exhausted 45 minutes before PR code ran; missing Gradle input, logs and TRX are downstream failures.

🧪 maui-pr-devicetests

No failures found.


🧪 maui-pr-uitests

🧭 Follow-up — actions and refresh

Next action: Restore Layout/target evidence; compare unresolved cases with identical setup.

Maintainers: comment /review tests to refresh this report.

@sheiksyedm
sheiksyedm marked this pull request as ready for review October 26, 2026 06:40
Copilot AI balanced review requested due to automatic review settings October 26, 2026 06:40
@sheiksyedm sheiksyedm added this to the .NET 10 SR13 milestone Oct 26, 2026
@sheiksyedm
sheiksyedm requested a review from kubaflo October 26, 2026 06:40

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.

🟡 Changes recommended

The reversion restores repeated measurement during cell recycling, so the truncation fix must preserve the scrolling optimization.

1 open issue
What changed in this PR

This PR addresses CollectionView label truncation after bound item text changes on iOS and MacCatalyst by reverting earlier measurement guards in the Items2 handler.

Changes:

  • Restores measurement when a cached first-item size is used and removes ItemsSource-change tracking.
  • Adds a reproduction page that updates existing items without replacing the collection.
  • Adds a screenshot test after repeated item-property swaps.
File Description
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​Issues/​Issue39534.cs Adds repeated-swap screenshot validation.
src/​Controls/​tests/​TestCases.HostApp/​Issues/​Issue39534.cs Adds the bound-date-label reproduction page.
src/​Controls/​src/​Core/​Handlers/​Items2/​iOS/​TemplatedCell2.cs Removes the cached-constraint measurement guard and ItemsSource tracking.

Review effort: Balanced

{
virtualView.Measure(constraints.Width, constraints.Height);
}
virtualView.Measure(constraints.Width, constraints.Height);
@kubaflo
kubaflo changed the base branch from main to inflight/candidate October 26, 2026 09:58
@kubaflo
kubaflo merged commit 01fda31 into dotnet:inflight/candidate Oct 26, 2026
184 of 203 checks passed
kubaflo pushed a commit that referenced this pull request Oct 26, 2026
…39558)

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

### Issue Details
Issue #[35859](#35859) was related
to MeasureFirstItem measuring all items in CV2, so a fix was added in PR
#36159. However, the changes in PR #36159 caused a regression in Issue
#[38275](#38275), which was
addressed in PR #38338. The current issue was also regressed by the
changes in PR #36159.

### Description of Change

<!-- Enter description of the fix in this section -->
Gerald's PR resolves Issues 35859, 38275, and current
issue([39534](#39534)). Therefore,
PR #36159 and PR #38338 are being reverted to avoid duplicate fixes and
regressions.

### 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 #39534 

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

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


| Before  | After  |
|---------|--------|
| **iOS**<br> <video
src="https://github.com/user-attachments/assets/a1d93984-d61c-41f2-b83c-bea4e960faee"
width="300" height="600"> | **iOS**<br> <video
src="https://github.com/user-attachments/assets/0f1ddc1b-c479-44a4-9530-d5065da11747"
width="300" height="600"> |
github-actions Bot pushed a commit that referenced this pull request Oct 28, 2026
…39558)

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

### Issue Details
Issue #[35859](#35859) was related
to MeasureFirstItem measuring all items in CV2, so a fix was added in PR
#36159. However, the changes in PR #36159 caused a regression in Issue
#[38275](#38275), which was
addressed in PR #38338. The current issue was also regressed by the
changes in PR #36159.

### Description of Change

<!-- Enter description of the fix in this section -->
Gerald's PR resolves Issues 35859, 38275, and current
issue([39534](#39534)). Therefore,
PR #36159 and PR #38338 are being reverted to avoid duplicate fixes and
regressions.

### 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 #39534 

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

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


| Before  | After  |
|---------|--------|
| **iOS**<br> <video
src="https://github.com/user-attachments/assets/a1d93984-d61c-41f2-b83c-bea4e960faee"
width="300" height="600"> | **iOS**<br> <video
src="https://github.com/user-attachments/assets/0f1ddc1b-c479-44a4-9530-d5065da11747"
width="300" height="600"> |
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 26, 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-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] CollectionView Label renders truncated after Text updated with ItemSizingStrategy="MeasureFirstItem" (regression in 10.0.100, 10.0.110 & 10.0.120)

6 participants