Repository navigation
[iOS] Fix CarouselView template selector crash during cell reconfigur… - #39228
Conversation
…#39190) <!-- 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 --> Regenerate only `issue-triage.lock.yml` using gh-aw v0.86.2 against deployed main `8c974ad7037c6e171e951883c752bbcea1514cc3`, following dotnet#39065. Shared `pat_pool.md` frontmatter changed before merge, leaving the triage lock stale. Actual production runs [37503999448](https://github.com/dotnet/maui/actions/runs/37503999448) and [37503998307](https://github.com/dotnet/maui/actions/runs/37503998307) failed before inference/publication with `E009 CONFIG_HASH_MISMATCH`. The compiler changes only `frontmatter_hash` in the first metadata line: - Previous: `d2c371bf924eb254532ec722f31d817ebdb42fd4e5565b4952a40e09e465e0d1` - Regenerated: `eb116514f337eb247c8767becceaefdd9cfb69da65044098b5cdc510e7c2d153` The new value matches the actual activation runtime recomputation in run 37503999448. All bytes after that metadata line are unchanged: authorization, GPT-only inference, permission boundaries, publication, hash checks, action/container pins and job conditions are preserved. Add a deployment note requiring dependent lock recompilation after shared import frontmatter changes. No workflow source, shared import, script or C# changes. Configuration validation: - `git merge-base --is-ancestor 8c974ad HEAD` — passed before editing; initial HEAD was exactly that deployed squash merge. - `gh aw compile issue-triage --strict --no-check-update` — passed; 1 workflow succeeded, 0 warnings, compiler v0.86.2. - `gh aw hash-frontmatter .github/workflows/issue-triage.md` — passed; output equals regenerated metadata and actual runtime hash above. - `test "$(gh aw hash-frontmatter .github/workflows/issue-triage.md)" = "$(head -n 1 .github/workflows/issue-triage.lock.yml | sed 's/^# gh-aw-metadata: //' | jq -r .frontmatter_hash)"` — passed. - `cmp <(git show HEAD:.github/workflows/issue-triage.lock.yml | tail -n +2) <(tail -n +2 .github/workflows/issue-triage.lock.yml)` — passed before committing; compiled lock excluding metadata is byte-identical to deployed main. - `actionlint -ignore 'unexpected key "queue" for "concurrency" section' .github/workflows/issue-triage.lock.yml` — passed with actionlint 1.7.12; only the existing narrow compiler-generated queue exception. - `git diff --check` — passed. No pipeline/Pester/snapshot/synthetic fixture tests or product builds were added or run. No production commands, dispatches or issue-label mutations were performed for this correction. Post-merge production outcome audit remains separate; local validation does not claim hosted end-to-end success. ### 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. --> Follow-up to dotnet#39065. No issue is closed: the reproduced defect is the activation failure in the linked actual production runs, not the underlying product reports used as smoke-test targets. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…dotnet#39188) <!-- 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 --> Fix a confirmed startup-deadline regression in the CI-fix Azure DevOps dispatcher introduced by dotnet#39147, and correct a separate, pre-existing producer prompt contradiction that blocks mandatory safe-output registration. **Production evidence:** [run 37477952193](https://github.com/dotnet/maui/actions/runs/37477952193) spent approximately 533 seconds between starting the 420-second deadline and completing trusted checkout; [run 37485076087](https://github.com/dotnet/maui/actions/runs/37485076087) spent approximately 494 seconds. Both then failed with `The variable cannot be validated because the value 0 is not a valid value for the DispatcherBudgetSeconds variable.` **Root cause:** The script parameter `[ValidateRange(1, 540)][int]$DispatcherBudgetSeconds` and top-level `$script:DispatcherBudgetSeconds` are the same validated PowerShell variable. Clamping valid caller input `420` against an already-expired absolute deadline assigns `0` to that variable, triggering validation before explicit budget-exhaustion reporting can run. Extracted helper tests did not exercise this entrypoint initialization. **Correction:** - Store the clamped runtime allowance in the distinct `EffectiveDispatcherBudgetSeconds` variable and update remaining-budget helpers and their extracted-test state consistently. Caller budget `0` remains invalid. - Fail startup explicitly with `[dispatcher-budget-exhausted]` when preparation has consumed the deadline, before PR discovery, authentication, HTTP, or sleep. Write a failed preparation/deadline job summary and state `No queue POST was attempted.` This also fails rather than claiming successful no-work reconciliation when the deadline is expired. - Limit trusted checkout to the standalone `/.github/scripts/Queue-CiFixAzdoValidation.ps1` using non-cone sparse checkout. The existing SHA-pinned checkout v7.0.1 supports exact patterns and automatically uses `blob:none` for sparse fetches. Preserve `github.sha`, `fetch-depth: 1`, and `persist-credentials: false`; never fetch or execute PR code. - Document preparation behavior and limitations. Keep the absolute pre-checkout 420-second deadline and ten-minute hard job timeout unchanged; do not restart or extend either allowance. **Validation:** Baseline dispatcher suite: 73 passed. Before the script correction, the six new actual-entrypoint cases produced four expected expired-deadline failures with the original validation exception and two passing caller-validation/future-deadline cases. After correction, all **79 tests passed**, including existing helper/queue regressions. Expired cases assert the preparation summary, explicit prefix, no-POST message, and zero HTTP/sleep calls; a native PowerShell process asserts nonzero exit. The valid future deadline still produces the three verified offline pipeline payloads. Exact final commands and results: ```powershell pwsh -NoProfile -Command '$env:PSModulePath = "/Users/shneuvil/.copilot/session-state/237fbb01-6532-4170-9f5e-6af14fa3a5e0/files/powershell-modules" + [IO.Path]::PathSeparator + $env:PSModulePath; Import-Module Pester -ErrorAction Stop; Invoke-Pester -Path .github/scripts/Queue-CiFixAzdoValidation.Tests.ps1 -Output Normal -CI' # Passed: 79; failed/skipped: 0. Reused existing Pester; no dependency installation. pwsh -NoProfile -Command '$files = @(".github/scripts/Queue-CiFixAzdoValidation.ps1", ".github/scripts/Queue-CiFixAzdoValidation.Tests.ps1"); foreach ($file in $files) { $tokens = $null; $errors = $null; [void][System.Management.Automation.Language.Parser]::ParseFile((Join-Path $PWD $file), [ref]$tokens, [ref]$errors); if ($errors.Count) { $errors | ForEach-Object { Write-Error $_ }; exit 1 }; Write-Output "Parse passed: $file" }' # Passed: both PowerShell files parsed without errors. ``` ```bash actionlint .github/workflows/ci-fix-azdo-validation.yml # Passed. git diff --check # Passed. ``` **Limits:** The sparse-checkout assertion is a static configuration/trust regression, not a hosted checkout timing measurement. Production checkout performance remains unproven; checkout or PowerShell startup exceeding the ten-minute hard guard can still cancel the job before a summary is written. No live Azure queue requests, manual workflow dispatches/reruns, `/azp` requests, or credential/permission/model-policy changes were performed. There is still no successful eligible-PR Azure canary evidence here; this PR does not establish Azure permissions or exact-head check linkage for any of the three pipelines. **Related producer blocker (pre-existing, not introduced by dotnet#39147):** [main producer run 37464881821](https://github.com/dotnet/maui/actions/runs/37464881821) and [net11 producer run 37465231994](https://github.com/dotnet/maui/actions/runs/37465231994) concluded success but emitted `missing_tool` / `report_incomplete`. The net11 diagnostic explicitly says mandatory expectation registration requires PowerShell but the run instructions exclude it. The main diagnostic likewise reports the prompt-specific `no-pwsh` restriction, alongside separate unavailable cited Azure timeline evidence. This is an upstream producer blocker: a compliant PR cannot reach dispatcher validation if required registration is prohibited by its own prompt. Both producers already allow `pwsh` in `tools.bash`, and Hard Rule 11 requires `Register-CiFixSafeOutputExpectation.ps1` or atomic validation/registration via `Test-CiFixTransport.ps1`. Their bottom Environment constraints sections nevertheless said `no pwsh`. The mirrored correction changes only that prose: explicitly identify `pwsh` availability for those deterministic helpers, retain `no gh` / `no python` and `curl` + `jq` API guidance, and reiterate existing fail-closed registration/transport requirements. No tool allowlists, network, permissions, credentials, trust, model policy, or output gates change. Added two assertions in the existing registration test suite protecting both producer twins. Both failed on the old contradictory guidance and pass after correction. Regenerated both locks with retained **gh-aw v0.86.2**, without manual edits or compiler upgrade; **only `body_hash` changes**. Frontmatter and all generated lock runtime content remain identical. Additional exact validation commands and results: ```powershell pwsh -NoProfile -Command '$env:PSModulePath = "/Users/shneuvil/.copilot/session-state/237fbb01-6532-4170-9f5e-6af14fa3a5e0/files/powershell-modules" + [IO.Path]::PathSeparator + $env:PSModulePath; Import-Module Pester -ErrorAction Stop; $config = New-PesterConfiguration; $config.Run.Path = @(".github/scripts/Register-CiFixSafeOutputExpectation.Tests.ps1", ".github/scripts/Test-CiFixTransport.Tests.ps1", ".github/scripts/Queue-CiFixAzdoValidation.Tests.ps1"); $config.Run.Exit = $true; $config.Output.Verbosity = "Normal"; $config.TestResult.Enabled = $true; $config.TestResult.OutputPath = "/Users/shneuvil/.copilot/session-state/1e0cc90a-a521-4055-9e7a-9565cdaf5504/files/producer-and-dispatcher-pester-results.xml"; Invoke-Pester -Configuration $config' # Passed after lock regeneration: 116 tests (6 registration, 31 transport, 79 dispatcher); 0 failed/skipped. pwsh -NoProfile -Command '$file = Join-Path $PWD ".github/scripts/Register-CiFixSafeOutputExpectation.Tests.ps1"; $tokens = $null; $errors = $null; [void][System.Management.Automation.Language.Parser]::ParseFile($file, [ref]$tokens, [ref]$errors); if ($errors.Count) { $errors | ForEach-Object { Write-Error $_ }; exit 1 }; Write-Output "PowerShell parse passed"' # Passed. ``` ```bash /Users/shneuvil/.copilot/session-state/237fbb01-6532-4170-9f5e-6af14fa3a5e0/files/tools/gh-aw-0.86.2/darwin-arm64 compile ci-status-fix ci-status-fix-net11 --strict --no-emit --no-check-update # Passed: 2 workflows, 0 warnings. /Users/shneuvil/.copilot/session-state/237fbb01-6532-4170-9f5e-6af14fa3a5e0/files/tools/gh-aw-0.86.2/darwin-arm64 compile ci-status-fix ci-status-fix-net11 --strict --no-check-update # Passed: 2 workflows, 0 warnings; emitted body-hash-only changes. actionlint .github/workflows/ci-status-fix.lock.yml .github/workflows/ci-status-fix-net11.lock.yml # Nonzero both before and after regeneration: identical six baseline diagnostics. # Each twin: concurrency.queue not recognized, ShellCheck SC2129 style, github.aw expression not recognized. # No new lint findings; baseline/after outputs compared byte-identical. ``` **Producer limits:** These are static prompt/configuration assertions and offline helper tests, not a hosted agent behavior evaluation. Removing the contradiction does not guarantee that an agent will register correctly, find a viable product fix, create a PR, or attach Azure checks. Separate cited-timeline failures and other producer blockers are not fixed here. No live workflow or network validation tests were run. ### 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. --> Follow-up to dotnet#39147 for the production startup regression evidenced by the two linked dispatcher runs, plus the separate pre-existing producer helper-guidance contradiction evidenced by the two producer runs. No separate tracking issue is closed by this PR. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> --------- Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e0cc90a-a521-4055-9e7a-9565cdaf5504
Updated [Microsoft.AspNetCore.Authentication.Facebook](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Facebook's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.Google](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.Google's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.AspNetCore.Authentication.MicrosoftAccount](https://github.com/dotnet/dotnet) from 10.0.0 to 10.0.13. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Authentication.MicrosoftAccount's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…ation Preserve the existing cell reuse identifier during measurement reconfiguration when a template selector returns a new DataTemplate instance. Keep normal template selection and the existing sizing workaround unchanged. Add regression coverage for cached and fresh templates with looping enabled and disabled. Fixes dotnet#39211.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39228Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39228" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The implementation appears sound, but CI remains in progress for platform-specific handler behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes an iOS CarouselView crash when reconfiguring cells whose template selector creates fresh templates.
Changes:
- Reuses the existing cell identifier during reconfiguration.
- Restores reconfiguration state safely with
finally. - Adds four looping/template-caching regression cases.
Finalization note: Expand the truncated title ending reconfigur… to reconfiguration.
| File | Description |
|---|---|
ItemsViewController2.cs |
Preserves the existing reuse identifier during cell reconfiguration. |
CarouselViewTests.iOS.cs |
Tests cached/fresh templates with looping enabled and disabled. |
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Note 🔍
|
AI Review Summary
🗂️ Review Sessions — click to expand🚦 Gate — Test Before & After FixGate Result:
|
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 CarouselViewTests (TemplateSelectorPreservesCellWhenMeasureIsInvalidated) Category=CarouselView |
🔴 Without fix — 📱 CarouselViewTests (TemplateSelectorPreservesCellWhenMeasureIsInvalidated): ⚠️ ENV ERROR · 128s
No log file found
🟢 With fix — 📱 CarouselViewTests (TemplateSelectorPreservesCellWhenMeasureIsInvalidated): ⚠️ ENV ERROR · 67s
No log file found
⚠️ Failure Details
⚠️ CarouselViewTests (TemplateSelectorPreservesCellWhenMeasureIsInvalidated) without fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CarouselViewTests' (the target tests did not run).⚠️ CarouselViewTests (TemplateSelectorPreservesCellWhenMeasureIsInvalidated) with fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CarouselViewTests' (the target tests did not run).
📁 Fix files reverted (1 files)
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs
📋 Pre-Flight — Context & Validation
The Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase.
Next step: re-comment /review to retry on a fresh agent. If this repeats across runs, a maintainer should inspect the reviewer token and Task 3 logs.
🔬 Code Review — Deep Analysis
The Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase.
Next step: re-comment /review to retry on a fresh agent. If this repeats across runs, a maintainer should inspect the reviewer token and Task 3 logs.
🛠️ Try-Fix — Analysis & Comparison
The Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase.
Next step: re-comment /review to retry on a fresh agent. If this repeats across runs, a maintainer should inspect the reviewer token and Task 3 logs.
🏁 Report — Final Recommendation
The Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase.
Next step: re-comment /review to retry on a fresh agent. If this repeats across runs, a maintainer should inspect the reviewer token and Task 3 logs.
🔗 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 |
🧪 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 — 431 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 |
431/436 (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.
Preserve the existing-cell reuse ID during reconfiguration alongside upstream empty-view and rotation lifecycle changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Resolved and pushed the conflict with The only conflict was in Validation: |
…uring cell reconfiguration (#39254) <!-- 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 [#39228](#39228) from `inflight/current` to `inflight/candidate`, cherry-picking source commit [`0a504feccf`](0a504fe) without conflicts or code changes. This PR intentionally targets `inflight/candidate` rather than `main`. Preserve the existing UIKit cell reuse identifier during item size-change reconfiguration, preventing `NSInternalInconsistencyException` when a CarouselView template selector returns a fresh `DataTemplate`. The reconfiguration flag is restored in `finally`, and normal cell creation outside reconfiguration remains unchanged. Includes the original four iOS device-test cases covering cached/fresh templates with looping disabled/enabled. Only the shared Items2 iOS controller and its CarouselView device tests are changed; there are no public API changes. #### Validation - `dotnet build Microsoft.Maui.BuildTasks.slnf -c Release /p:TreatWarningsAsErrors=false -v minimal` — passed; three existing Gradle Java source/target warnings. - `pwsh -NoProfile .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -BuildOnly` — passed with zero warnings and zero errors after building the required MSBuild tasks. The iOS simulator app and regression tests compile successfully. - `git diff --cached --check` — passed before commit. The backport's stable patch ID matches the merged source commit exactly. Device tests were not executed locally for this backport; validation was build-only, with no simulator launch or XCTest. The original PR documents its before/after runtime evidence. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Sheik Syed <sheiksyedm@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#39228) <!-- 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 --> Prevent the iOS CarouselView template-selector crash during cell measurement reconfiguration. #### Regression origin The introducing source change is traced to [#32874](#32874), **[iOS][CV2] Fix CollectionView2 on iOS iPad jumps/scrolls randomly when item size changes**. That PR added `UICollectionView.ReconfigureItems` to `ItemsViewController2.InvalidateLayoutIfItemsMeasureChanged` to prevent scroll-position jumps when cell sizes change. Although motivated by CollectionView, this controller is shared with CarouselView's Items2 handler. The shipped equivalent is commit [`3777f809ce`](3777f80), integrated through [#36411](#36411). Comparing release sources confirms the reconfiguration addition is absent in **10.0.90** and present in **10.0.100**, matching the issue's reported good/bad versions. This is source/history-backed attribution, not a runtime bisect of the introducing commit and its parent. #### Why the regression occurs 1. An item measurement change triggers `ReconfigureItems` for an existing visible cell. 2. UIKit calls `GetCell` again. Previously, MAUI recalculated the reuse identifier through `DetermineCellReuseId`, which incorporates the selected `DataTemplate` instance's ID. 3. If the selector returns a fresh `DataTemplate` instance, the recalculated identifier differs from the existing cell's identifier. UIKit requires reconfiguration to dequeue using the existing identifier, so the mismatch causes `NSInternalInconsistencyException`. For example, the baseline device test attempted to dequeue identifier `.112` while reconfiguring a cell originally registered with identifier `.110`. #### How this fix resolves it - Scope `_isReconfiguringItems` around the `ReconfigureItems` call. Save the previous value and restore it in `finally`, including nested calls or exceptions. - During that scope, `GetCell` uses `CellForItem(indexPath)?.ReuseIdentifier` when available instead of recalculating the dequeue identifier from a newly selected template. This satisfies UIKit's same-identifier requirement and preserves the existing native cell. - Outside reconfiguration, or when no existing identifier is available, retain the normal `DetermineCellReuseId` path. Keep the existing size-change reconfiguration and layout invalidation rather than reverting the earlier scroll-position fix. No public API changes. The fix is in the shared Items2 iOS controller; it does not change the legacy handler. #### Regression coverage and validation Add four iOS device-test cases covering **cached/fresh templates × looping disabled/enabled**. The tests invalidate item measurement, verify the same native cell and reuse identifier are retained with the updated label content and binding context, then verify the second carousel item displays correctly after scrolling. Sandbox reproduction changes are excluded from this PR. Environment: iPhone 17 Pro simulator, iOS 26.5, Xcode 26.6. - **Without fix:** the device app crashed inside `TemplateSelectorPreservesCellWhenMeasureIsInvalidated` with the reported `NSInternalInconsistencyException`. - **With fix:** actual xUnit results confirm all four new cases passed, with 11 total tests passed and no failures. - **Gate limitation:** the automated before/after gate reported `VERIFICATION FAILED` because it incorrectly classified the baseline crash as PASS after recovery. The raw crash log and fixed-run xUnit results demonstrate crash-before/pass-after behavior; the automated gate is not claimed green. - **Sandbox:** the same local sample crashed on explicit measure invalidation before the fix and survived invalidation and four swipes afterward. The issue author's immediate-launch failure timing was not reproduced. MacCatalyst, other iOS versions, Android, and Windows were not validated for this change. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…uring cell reconfiguration (#39254) <!-- 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 [#39228](#39228) from `inflight/current` to `inflight/candidate`, cherry-picking source commit [`0a504feccf`](0a504fe) without conflicts or code changes. This PR intentionally targets `inflight/candidate` rather than `main`. Preserve the existing UIKit cell reuse identifier during item size-change reconfiguration, preventing `NSInternalInconsistencyException` when a CarouselView template selector returns a fresh `DataTemplate`. The reconfiguration flag is restored in `finally`, and normal cell creation outside reconfiguration remains unchanged. Includes the original four iOS device-test cases covering cached/fresh templates with looping disabled/enabled. Only the shared Items2 iOS controller and its CarouselView device tests are changed; there are no public API changes. #### Validation - `dotnet build Microsoft.Maui.BuildTasks.slnf -c Release /p:TreatWarningsAsErrors=false -v minimal` — passed; three existing Gradle Java source/target warnings. - `pwsh -NoProfile .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -BuildOnly` — passed with zero warnings and zero errors after building the required MSBuild tasks. The iOS simulator app and regression tests compile successfully. - `git diff --cached --check` — passed before commit. The backport's stable patch ID matches the merged source commit exactly. Device tests were not executed locally for this backport; validation was build-only, with no simulator launch or XCTest. The original PR documents its before/after runtime evidence. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Sheik Syed <sheiksyedm@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#39228) <!-- 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 --> Prevent the iOS CarouselView template-selector crash during cell measurement reconfiguration. #### Regression origin The introducing source change is traced to [#32874](#32874), **[iOS][CV2] Fix CollectionView2 on iOS iPad jumps/scrolls randomly when item size changes**. That PR added `UICollectionView.ReconfigureItems` to `ItemsViewController2.InvalidateLayoutIfItemsMeasureChanged` to prevent scroll-position jumps when cell sizes change. Although motivated by CollectionView, this controller is shared with CarouselView's Items2 handler. The shipped equivalent is commit [`3777f809ce`](3777f80), integrated through [#36411](#36411). Comparing release sources confirms the reconfiguration addition is absent in **10.0.90** and present in **10.0.100**, matching the issue's reported good/bad versions. This is source/history-backed attribution, not a runtime bisect of the introducing commit and its parent. #### Why the regression occurs 1. An item measurement change triggers `ReconfigureItems` for an existing visible cell. 2. UIKit calls `GetCell` again. Previously, MAUI recalculated the reuse identifier through `DetermineCellReuseId`, which incorporates the selected `DataTemplate` instance's ID. 3. If the selector returns a fresh `DataTemplate` instance, the recalculated identifier differs from the existing cell's identifier. UIKit requires reconfiguration to dequeue using the existing identifier, so the mismatch causes `NSInternalInconsistencyException`. For example, the baseline device test attempted to dequeue identifier `.112` while reconfiguring a cell originally registered with identifier `.110`. #### How this fix resolves it - Scope `_isReconfiguringItems` around the `ReconfigureItems` call. Save the previous value and restore it in `finally`, including nested calls or exceptions. - During that scope, `GetCell` uses `CellForItem(indexPath)?.ReuseIdentifier` when available instead of recalculating the dequeue identifier from a newly selected template. This satisfies UIKit's same-identifier requirement and preserves the existing native cell. - Outside reconfiguration, or when no existing identifier is available, retain the normal `DetermineCellReuseId` path. Keep the existing size-change reconfiguration and layout invalidation rather than reverting the earlier scroll-position fix. No public API changes. The fix is in the shared Items2 iOS controller; it does not change the legacy handler. #### Regression coverage and validation Add four iOS device-test cases covering **cached/fresh templates × looping disabled/enabled**. The tests invalidate item measurement, verify the same native cell and reuse identifier are retained with the updated label content and binding context, then verify the second carousel item displays correctly after scrolling. Sandbox reproduction changes are excluded from this PR. Environment: iPhone 17 Pro simulator, iOS 26.5, Xcode 26.6. - **Without fix:** the device app crashed inside `TemplateSelectorPreservesCellWhenMeasureIsInvalidated` with the reported `NSInternalInconsistencyException`. - **With fix:** actual xUnit results confirm all four new cases passed, with 11 total tests passed and no failures. - **Gate limitation:** the automated before/after gate reported `VERIFICATION FAILED` because it incorrectly classified the baseline crash as PASS after recovery. The raw crash log and fixed-run xUnit results demonstrate crash-before/pass-after behavior; the automated gate is not claimed green. - **Sandbox:** the same local sample crashed on explicit measure invalidation before the fix and survived invalidation and four swipes afterward. The issue author's immediate-launch failure timing was not reproduced. MacCatalyst, other iOS versions, Android, and Windows were not validated for this change. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…uring cell reconfiguration (#39254) <!-- 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 [#39228](#39228) from `inflight/current` to `inflight/candidate`, cherry-picking source commit [`0a504feccf`](0a504fe) without conflicts or code changes. This PR intentionally targets `inflight/candidate` rather than `main`. Preserve the existing UIKit cell reuse identifier during item size-change reconfiguration, preventing `NSInternalInconsistencyException` when a CarouselView template selector returns a fresh `DataTemplate`. The reconfiguration flag is restored in `finally`, and normal cell creation outside reconfiguration remains unchanged. Includes the original four iOS device-test cases covering cached/fresh templates with looping disabled/enabled. Only the shared Items2 iOS controller and its CarouselView device tests are changed; there are no public API changes. #### Validation - `dotnet build Microsoft.Maui.BuildTasks.slnf -c Release /p:TreatWarningsAsErrors=false -v minimal` — passed; three existing Gradle Java source/target warnings. - `pwsh -NoProfile .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -BuildOnly` — passed with zero warnings and zero errors after building the required MSBuild tasks. The iOS simulator app and regression tests compile successfully. - `git diff --cached --check` — passed before commit. The backport's stable patch ID matches the merged source commit exactly. Device tests were not executed locally for this backport; validation was build-only, with no simulator launch or XCTest. The original PR documents its before/after runtime evidence. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Sheik Syed <sheiksyedm@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#39228) <!-- 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 --> Prevent the iOS CarouselView template-selector crash during cell measurement reconfiguration. #### Regression origin The introducing source change is traced to [#32874](#32874), **[iOS][CV2] Fix CollectionView2 on iOS iPad jumps/scrolls randomly when item size changes**. That PR added `UICollectionView.ReconfigureItems` to `ItemsViewController2.InvalidateLayoutIfItemsMeasureChanged` to prevent scroll-position jumps when cell sizes change. Although motivated by CollectionView, this controller is shared with CarouselView's Items2 handler. The shipped equivalent is commit [`3777f809ce`](3777f80), integrated through [#36411](#36411). Comparing release sources confirms the reconfiguration addition is absent in **10.0.90** and present in **10.0.100**, matching the issue's reported good/bad versions. This is source/history-backed attribution, not a runtime bisect of the introducing commit and its parent. #### Why the regression occurs 1. An item measurement change triggers `ReconfigureItems` for an existing visible cell. 2. UIKit calls `GetCell` again. Previously, MAUI recalculated the reuse identifier through `DetermineCellReuseId`, which incorporates the selected `DataTemplate` instance's ID. 3. If the selector returns a fresh `DataTemplate` instance, the recalculated identifier differs from the existing cell's identifier. UIKit requires reconfiguration to dequeue using the existing identifier, so the mismatch causes `NSInternalInconsistencyException`. For example, the baseline device test attempted to dequeue identifier `.112` while reconfiguring a cell originally registered with identifier `.110`. #### How this fix resolves it - Scope `_isReconfiguringItems` around the `ReconfigureItems` call. Save the previous value and restore it in `finally`, including nested calls or exceptions. - During that scope, `GetCell` uses `CellForItem(indexPath)?.ReuseIdentifier` when available instead of recalculating the dequeue identifier from a newly selected template. This satisfies UIKit's same-identifier requirement and preserves the existing native cell. - Outside reconfiguration, or when no existing identifier is available, retain the normal `DetermineCellReuseId` path. Keep the existing size-change reconfiguration and layout invalidation rather than reverting the earlier scroll-position fix. No public API changes. The fix is in the shared Items2 iOS controller; it does not change the legacy handler. #### Regression coverage and validation Add four iOS device-test cases covering **cached/fresh templates × looping disabled/enabled**. The tests invalidate item measurement, verify the same native cell and reuse identifier are retained with the updated label content and binding context, then verify the second carousel item displays correctly after scrolling. Sandbox reproduction changes are excluded from this PR. Environment: iPhone 17 Pro simulator, iOS 26.5, Xcode 26.6. - **Without fix:** the device app crashed inside `TemplateSelectorPreservesCellWhenMeasureIsInvalidated` with the reported `NSInternalInconsistencyException`. - **With fix:** actual xUnit results confirm all four new cases passed, with 11 total tests passed and no failures. - **Gate limitation:** the automated before/after gate reported `VERIFICATION FAILED` because it incorrectly classified the baseline crash as PASS after recovery. The raw crash log and fixed-run xUnit results demonstrate crash-before/pass-after behavior; the automated gate is not claimed green. - **Sandbox:** the same local sample crashed on explicit measure invalidation before the fix and survived invalidation and four swipes afterward. The issue author's immediate-launch failure timing was not reproduced. MacCatalyst, other iOS versions, Android, and Windows were not validated for this change. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…uring cell reconfiguration (#39254) <!-- 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 [#39228](#39228) from `inflight/current` to `inflight/candidate`, cherry-picking source commit [`0a504feccf`](0a504fe) without conflicts or code changes. This PR intentionally targets `inflight/candidate` rather than `main`. Preserve the existing UIKit cell reuse identifier during item size-change reconfiguration, preventing `NSInternalInconsistencyException` when a CarouselView template selector returns a fresh `DataTemplate`. The reconfiguration flag is restored in `finally`, and normal cell creation outside reconfiguration remains unchanged. Includes the original four iOS device-test cases covering cached/fresh templates with looping disabled/enabled. Only the shared Items2 iOS controller and its CarouselView device tests are changed; there are no public API changes. #### Validation - `dotnet build Microsoft.Maui.BuildTasks.slnf -c Release /p:TreatWarningsAsErrors=false -v minimal` — passed; three existing Gradle Java source/target warnings. - `pwsh -NoProfile .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -BuildOnly` — passed with zero warnings and zero errors after building the required MSBuild tasks. The iOS simulator app and regression tests compile successfully. - `git diff --cached --check` — passed before commit. The backport's stable patch ID matches the merged source commit exactly. Device tests were not executed locally for this backport; validation was build-only, with no simulator launch or XCTest. The original PR documents its before/after runtime evidence. ### 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 #39211 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Sheik Syed <sheiksyedm@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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!
Description of Change
Prevent the iOS CarouselView template-selector crash during cell measurement reconfiguration.
Regression origin
The introducing source change is traced to dotnet/maui#32874, [iOS][CV2] Fix CollectionView2 on iOS iPad jumps/scrolls randomly when item size changes. That PR added
UICollectionView.ReconfigureItemstoItemsViewController2.InvalidateLayoutIfItemsMeasureChangedto prevent scroll-position jumps when cell sizes change. Although motivated by CollectionView, this controller is shared with CarouselView's Items2 handler.The shipped equivalent is commit
3777f809ce, integrated through dotnet/maui#36411. Comparing release sources confirms the reconfiguration addition is absent in 10.0.90 and present in 10.0.100, matching the issue's reported good/bad versions. This is source/history-backed attribution, not a runtime bisect of the introducing commit and its parent.Why the regression occurs
ReconfigureItemsfor an existing visible cell.GetCellagain. Previously, MAUI recalculated the reuse identifier throughDetermineCellReuseId, which incorporates the selectedDataTemplateinstance's ID.DataTemplateinstance, the recalculated identifier differs from the existing cell's identifier. UIKit requires reconfiguration to dequeue using the existing identifier, so the mismatch causesNSInternalInconsistencyException.For example, the baseline device test attempted to dequeue identifier
.112while reconfiguring a cell originally registered with identifier.110.How this fix resolves it
_isReconfiguringItemsaround theReconfigureItemscall. Save the previous value and restore it infinally, including nested calls or exceptions.GetCellusesCellForItem(indexPath)?.ReuseIdentifierwhen available instead of recalculating the dequeue identifier from a newly selected template. This satisfies UIKit's same-identifier requirement and preserves the existing native cell.DetermineCellReuseIdpath. Keep the existing size-change reconfiguration and layout invalidation rather than reverting the earlier scroll-position fix.No public API changes. The fix is in the shared Items2 iOS controller; it does not change the legacy handler.
Regression coverage and validation
Add four iOS device-test cases covering cached/fresh templates × looping disabled/enabled. The tests invalidate item measurement, verify the same native cell and reuse identifier are retained with the updated label content and binding context, then verify the second carousel item displays correctly after scrolling. Sandbox reproduction changes are excluded from this PR.
Environment: iPhone 17 Pro simulator, iOS 26.5, Xcode 26.6.
TemplateSelectorPreservesCellWhenMeasureIsInvalidatedwith the reportedNSInternalInconsistencyException.VERIFICATION FAILEDbecause it incorrectly classified the baseline crash as PASS after recovery. The raw crash log and fixed-run xUnit results demonstrate crash-before/pass-after behavior; the automated gate is not claimed green.MacCatalyst, other iOS versions, Android, and Windows were not validated for this change.
Issues Fixed
Fixes #39211