Skip to content

[iOS/MacCatalyst] Fix CollectionView crash during incremental loading - #40481

Merged
kubaflo merged 7 commits into
dotnet:release/11.0.1xx-sr2from
SubhikshaSf4851:Fix-40467
Nov 24, 2026
Merged

kubaflo merged 7 commits into
dotnet:release/11.0.1xx-sr2from
SubhikshaSf4851:Fix-40467

Conversation

@SubhikshaSf4851

@SubhikshaSf4851 SubhikshaSf4851 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Target Branch

This PR is for Initial base
New features, API changes, or .NET 12 work (including .NET 12 fixes) main
.NET 11 servicing fixes net11, for review
Older servicing, release integration, infrastructure, or documentation The branch designated for that work

For .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into net11; agents must not retarget or merge.

This pull request improves the reliability of the "remaining items threshold" feature in CollectionView on iOS by preventing re-entrant threshold notifications during rapid or synchronous collection updates. It also introduces a new test to ensure that additional pages are loaded correctly while scrolling, and that the threshold command is not invoked again before its previous execution completes.

Regression introduced by: #39493. Its scroll during collection-update finalization can trigger a nested threshold notification while the previous command is still adding items.

Description of Change

CollectionView RemainingItemsThreshold reliability improvements:

  • Added a _notifyingThreshold flag to ItemsViewDelegator2 to prevent re-entrant calls to the threshold notification logic while it is already processing, ensuring that the threshold command cannot be triggered multiple times simultaneously. [1] [2] [3]

Testing enhancements:

  • Added a new test RemainingItemsThresholdLoadsPagesWhileScrolling in CollectionViewTests.iOS.cs to verify that the CollectionView loads additional pages as the user scrolls, and to assert that the threshold command does not re-enter before finishing its previous invocation.

Issues Fixed

Fixes #40467

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
BeforeFix40467.mov
AfterFix40467.mov

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 20, 2026
@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot added area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/ios platform/macos macOS / Mac Catalyst labels Nov 20, 2026
@kubaflo

This comment has been minimized.

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

MauiBot commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@SubhikshaSf4851 — existing-test verification; Setup did not capture a tested commit.

Result INCONCLUSIVE Platform iOS


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Setup did not capture a verified PR head; no commit is claimed as tested.

No immutable without-fix baseline was prepared.

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

@github-actions github-actions Bot 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.

Expert Review — 1 finding

Reviewed commit 76ae42f.

See inline comments for details.

@kubaflo
kubaflo force-pushed the candidate/11.0.1xx-sr2 branch from 2848169 to a61b68c Compare November 22, 2026 18:07
@kubaflo

kubaflo commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

/review run-tests

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Skill Validation Results

@SubhikshaSf4851 — new skill validation results are available based on this last commit: 66bc022.
To request a fresh validation after new comments or commits, comment /evaluate-skills.

Overall Failed Static Failed LLM Skipped Skills 0 Agents 0

❌ Skill Validation Results — 66bc022 · [iOS/MacCatalyst] Fix CollectionView crash during incremental loading · 2026-11-24T04:58:26Z

❌ Static Checks Failed

Skills: 0 | Eval specs linted:

⏭️ LLM Evaluation: Skipped

💡 LLM evaluation was not run for this external PR.
A repository contributor can post /evaluate-skills on this PR to trigger full evaluation.

🔍 Full results and investigation steps

@kubaflo

kubaflo commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

/review expert-review-with-gate

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

Copy link
Copy Markdown
Contributor

Warning

Your /review gate couldn't start due to a transient error triggering the pipeline. The command was left unacknowledged so scheduled recovery can retry it automatically; you can also comment /review gate again in a minute.

@github-actions github-actions Bot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 23, 2026
@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo

kubaflo commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

/review expert-review-with-gate

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

This comment has been minimized.

@github-actions github-actions Bot 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.

Expert Review — 0 findings

Reviewed commit feb1232.

@kubaflo
kubaflo deleted the branch dotnet:candidate/11.0.1xx-sr2 November 24, 2026 12:02
@kubaflo kubaflo closed this Nov 24, 2026
@devanathan-vaithiyanathan
devanathan-vaithiyanathan changed the base branch from candidate/11.0.1xx-sr2 to net11 November 24, 2026 12:57
@kubaflo
kubaflo changed the base branch from net11 to release/11.0.1xx-sr2 November 24, 2026 13:42
@kubaflo
kubaflo marked this pull request as ready for review November 24, 2026 13:42
Copilot AI balanced review requested due to automatic review settings November 24, 2026 13:42
@kubaflo
kubaflo merged commit 4858add into dotnet:release/11.0.1xx-sr2 Nov 24, 2026
34 of 45 checks passed

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.

🔵 Needs a closer look

The fix relies on native UIKit callback ordering that remains unverified, so the regression test must be confirmed to fail without the guard and pass with it on both iOS and MacCatalyst.

No open issues 🎉

What changed in this PR

This PR addresses the iOS/MacCatalyst CollectionView incremental-loading crash reported in #40467, linked to scroll behavior introduced by #39493.

Changes:

  • Prevents synchronous re-entry into remaining-items threshold notifications, resetting the guard in a finally block.
  • Skips threshold evaluation if the item source changes during the Scrolled event.
  • Adds device tests for incremental page loading, command re-entry, and source changes during scrolling.
File Description
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewTests.iOS.cs Adds paging, re-entry, and source-change regression tests.
src/​Controls/​src/​Core/​Handlers/​Items2/​iOS/​ItemsViewDelegator2.cs Guards threshold notifications against synchronous re-entry and replaced sources.

Review effort: Balanced

kubaflo added a commit that referenced this pull request Nov 24, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

### Description of Change

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

Backport #40481 from `release/11.0.1xx-sr2` to `net11`. The change
prevents re-entrant CollectionView remaining-items threshold
notifications and skips threshold evaluation when the scrolled event
replaces the items source. It includes the original iOS/MacCatalyst
device tests.

Source commit: `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`.

**Validation**

- `git diff --cached --check` - passed.
- `git diff --cached | git patch-id --stable` - matched the patch ID of
source commit `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`.
- Building `Microsoft.Maui.BuildTasks.slnf` failed locally with
`NETSDK1140`: the installed Apple workload accepts platform version 27.2
while the projects request 27.0.
- iOS and MacCatalyst device tests were not run locally; CI validation
is required.

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

Relates to #40467.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->
@kubaflo kubaflo added this to the .NET 11 SR2 milestone Nov 24, 2026
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
…0578)

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

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

### Description of Change

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

Backport dotnet#40481 from `release/11.0.1xx-sr2` to `net11`. The change
prevents re-entrant CollectionView remaining-items threshold
notifications and skips threshold evaluation when the scrolled event
replaces the items source. It includes the original iOS/MacCatalyst
device tests.

Source commit: `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`.

**Validation**

- `git diff --cached --check` - passed.
- `git diff --cached | git patch-id --stable` - matched the patch ID of
source commit `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`.
- Building `Microsoft.Maui.BuildTasks.slnf` failed locally with
`NETSDK1140`: the installed Apple workload accepts platform version 27.2
while the projects request 27.0.
- iOS and MacCatalyst device tests were not run locally; CI validation
is required.

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

Relates to dotnet#40467.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — feb1232c Deployed Nov 24, 2026 by devanathan-vaithiyanathan via conclusion #3250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios platform/macos macOS / Mac Catalyst

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MAUI] I9 -Incremental loading on scroll for 'RemainingItemsThreshold' - Opens an exception CLR/ObjCRuntime.ObjCException

6 participants