Skip to content

[Testing] Wait for the deferred CarouselView override scroll request on Windows - #40394

Merged
kubaflo merged 1 commit into
candidate/11.0.1xx-sr2from
fix/carousel-sync-override-request-wait
Nov 18, 2026
Merged

kubaflo merged 1 commit into
candidate/11.0.1xx-sr2from
fix/carousel-sync-override-request-wait

Conversation

@kubaflo

@kubaflo kubaflo commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Note

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

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.

Description of Change

Test-only change. No product code changes.

Warning

Draft: the current head includes a temporary diagnostic test, DiagnosticSynchronousCurrentItemOverrideRequestOrdering, which always fails and reports timings. It will be removed in a follow-up commit after Windows device CI records its results.

Symptom. Candidate device build 1688573 (#40116), Run DeviceTests Windows (Controls.DeviceTests-packaged): CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride failed with Assert.Equal() Failure: Expected: 1, Actual: 0 after 0.54 s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate 1688573, #40361's 1687233, #40288's 1683284, darc-net11 1681785, net11 1680671 and inflight 1680652. The test file is identical on the candidate, net11 and main.

Root cause (test race). Removing the current item makes replacement current, and the test's CurrentItemChanged handler overrides it to override. Synchronously, the handler sets Position = 1 and queues the deferred override scroll. In this test, item 1 is not visible yet, so the Low-priority CompleteCollectionCurrentItemOverrideScroll does three things:

  1. It calls ScrollIntoView. Since the viewport width equals the item width, this already centers item 1 natively.
  2. It schedules a 50 ms retry.
  3. On the retry pass, it sees the item visible, clears the override and calls ItemsView.ScrollTo(1, Center, animate: false). That call raises the counted ScrollToRequested.

So the visible centering always precedes the counted request by at least 50 ms. The test asserted scrollToRequests == 1 as soon as WaitForCenteredPositionAsync (100 ms poll) observed centering. It passed only when the poll landed after the retry pass.

Fix. Wait for the request before asserting the count, exactly like the sibling CollectionChangePreservesCurrentItemOverrideFromPositionChanged test:

await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");

Every existing assertion is unchanged, including Assert.Equal(1, scrollToRequests) and the Mode/Index/Center/IsAnimated checks, so a duplicate request still fails. No timeout, retry or tolerance changes.

Issues Fixed

Fixes a failing device test on the SR2 candidate (#40116).

Validation

Pending Windows device CI. The evidence will be added here.

CollectionChangePreservesSynchronousCurrentItemOverride asserted the
ScrollToRequested count as soon as item 1 was visibly centered. The
deferred override first centers the item natively via ScrollIntoView and
only requests the final ScrollTo on a later retry pass (>=50 ms later),
so the assert depended on the 100 ms poll phase. Wait for the request
like the sibling CollectionChangePreservesCurrentItemOverrideFromPositionChanged
test does; all existing asserts are unchanged.

Temporarily adds DiagnosticSynchronousCurrentItemOverrideRequestOrdering
to measure centering vs request ordering in CI; it will be removed.

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

This comment has been minimized.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 20:45 — with GitHub Actions Inactive
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 20:47 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 20:49 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 20:51 — with GitHub Actions Inactive
@kubaflo
kubaflo marked this pull request as ready for review November 18, 2026 21:20
@kubaflo
kubaflo merged commit fc55531 into candidate/11.0.1xx-sr2 Nov 18, 2026
14 of 26 checks passed
@kubaflo
kubaflo deleted the fix/carousel-sync-override-request-wait branch November 18, 2026 21:20
kubaflo added a commit that referenced this pull request Nov 18, 2026
…ic (#40395)

<!-- 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).
This is a test-only follow-up to #40394, which merged into the SR2
candidate (#40116).

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

Test-only change. No product code changes.

#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from #40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from #40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to #40394. Unblocks Windows device tests on #40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo mentioned this pull request Nov 18, 2026
1 task
kubaflo added a commit that referenced this pull request Nov 18, 2026
…on Windows (#40394)

<!-- 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).
This is a test-only fix for a failure on the SR2 candidate #40116.

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

Test-only change. No product code changes.

> [!WARNING]
> **Draft:** the current head includes a temporary diagnostic test,
`DiagnosticSynchronousCurrentItemOverrideRequestOrdering`, which always
fails and reports timings. It will be removed in a follow-up commit
after Windows device CI records its results.

**Symptom.** Candidate device build
[1688573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688573)
(#40116), *Run DeviceTests Windows* (`Controls.DeviceTests-packaged`):
`CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride`
failed with `Assert.Equal() Failure: Expected: 1, Actual: 0` after 0.54
s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate
1688573, #40361's 1687233, #40288's 1683284, darc-net11 1681785, net11
1680671 and inflight 1680652. The test file is identical on the
candidate, `net11` and `main`.

**Root cause (test race).** Removing the current item makes
`replacement` current, and the test's `CurrentItemChanged` handler
overrides it to `override`. Synchronously, the handler sets `Position =
1` and queues the deferred override scroll. In this test, item 1 is not
visible yet, so the Low-priority
`CompleteCollectionCurrentItemOverrideScroll` does three things:

1. It calls `ScrollIntoView`. Since the viewport width equals the item
width, this already centers item 1 natively.
2. It schedules a 50 ms retry.
3. On the retry pass, it sees the item visible, clears the override and
calls `ItemsView.ScrollTo(1, Center, animate: false)`. That call raises
the counted `ScrollToRequested`.

So the visible centering always precedes the counted request by at least
50 ms. The test asserted `scrollToRequests == 1` as soon as
`WaitForCenteredPositionAsync` (100 ms poll) observed centering. It
passed only when the poll landed after the retry pass.

**Fix.** Wait for the request before asserting the count, exactly like
the sibling
`CollectionChangePreservesCurrentItemOverrideFromPositionChanged` test:

```csharp
await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");
```

Every existing assertion is unchanged, including `Assert.Equal(1,
scrollToRequests)` and the Mode/Index/Center/IsAnimated checks, so a
duplicate request still fails. No timeout, retry or tolerance changes.

### Issues Fixed

Fixes a failing device test on the SR2 candidate (#40116).

### Validation

Pending Windows device CI. The evidence will be added here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…ic (#40395)

<!-- 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).
This is a test-only follow-up to #40394, which merged into the SR2
candidate (#40116).

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

Test-only change. No product code changes.

#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from #40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from #40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to #40394. Unblocks Windows device tests on #40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
…on Windows (#40394)

<!-- 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).
This is a test-only fix for a failure on the SR2 candidate #40116.

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

Test-only change. No product code changes.

> [!WARNING]
> **Draft:** the current head includes a temporary diagnostic test,
`DiagnosticSynchronousCurrentItemOverrideRequestOrdering`, which always
fails and reports timings. It will be removed in a follow-up commit
after Windows device CI records its results.

**Symptom.** Candidate device build
[1688573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688573)
(#40116), *Run DeviceTests Windows* (`Controls.DeviceTests-packaged`):
`CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride`
failed with `Assert.Equal() Failure: Expected: 1, Actual: 0` after 0.54
s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate
1688573, #40361's 1687233, #40288's 1683284, darc-net11 1681785, net11
1680671 and inflight 1680652. The test file is identical on the
candidate, `net11` and `main`.

**Root cause (test race).** Removing the current item makes
`replacement` current, and the test's `CurrentItemChanged` handler
overrides it to `override`. Synchronously, the handler sets `Position =
1` and queues the deferred override scroll. In this test, item 1 is not
visible yet, so the Low-priority
`CompleteCollectionCurrentItemOverrideScroll` does three things:

1. It calls `ScrollIntoView`. Since the viewport width equals the item
width, this already centers item 1 natively.
2. It schedules a 50 ms retry.
3. On the retry pass, it sees the item visible, clears the override and
calls `ItemsView.ScrollTo(1, Center, animate: false)`. That call raises
the counted `ScrollToRequested`.

So the visible centering always precedes the counted request by at least
50 ms. The test asserted `scrollToRequests == 1` as soon as
`WaitForCenteredPositionAsync` (100 ms poll) observed centering. It
passed only when the poll landed after the retry pass.

**Fix.** Wait for the request before asserting the count, exactly like
the sibling
`CollectionChangePreservesCurrentItemOverrideFromPositionChanged` test:

```csharp
await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");
```

Every existing assertion is unchanged, including `Assert.Equal(1,
scrollToRequests)` and the Mode/Index/Center/IsAnimated checks, so a
duplicate request still fails. No timeout, retry or tolerance changes.

### Issues Fixed

Fixes a failing device test on the SR2 candidate (#40116).

### Validation

Pending Windows device CI. The evidence will be added here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
…ic (#40395)

<!-- 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).
This is a test-only follow-up to #40394, which merged into the SR2
candidate (#40116).

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

Test-only change. No product code changes.

#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from #40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from #40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to #40394. Unblocks Windows device tests on #40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
…on Windows (#40394)

<!-- 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).
This is a test-only fix for a failure on the SR2 candidate #40116.

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

Test-only change. No product code changes.

> [!WARNING]
> **Draft:** the current head includes a temporary diagnostic test,
`DiagnosticSynchronousCurrentItemOverrideRequestOrdering`, which always
fails and reports timings. It will be removed in a follow-up commit
after Windows device CI records its results.

**Symptom.** Candidate device build
[1688573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688573)
(#40116), *Run DeviceTests Windows* (`Controls.DeviceTests-packaged`):
`CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride`
failed with `Assert.Equal() Failure: Expected: 1, Actual: 0` after 0.54
s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate
1688573, #40361's 1687233, #40288's 1683284, darc-net11 1681785, net11
1680671 and inflight 1680652. The test file is identical on the
candidate, `net11` and `main`.

**Root cause (test race).** Removing the current item makes
`replacement` current, and the test's `CurrentItemChanged` handler
overrides it to `override`. Synchronously, the handler sets `Position =
1` and queues the deferred override scroll. In this test, item 1 is not
visible yet, so the Low-priority
`CompleteCollectionCurrentItemOverrideScroll` does three things:

1. It calls `ScrollIntoView`. Since the viewport width equals the item
width, this already centers item 1 natively.
2. It schedules a 50 ms retry.
3. On the retry pass, it sees the item visible, clears the override and
calls `ItemsView.ScrollTo(1, Center, animate: false)`. That call raises
the counted `ScrollToRequested`.

So the visible centering always precedes the counted request by at least
50 ms. The test asserted `scrollToRequests == 1` as soon as
`WaitForCenteredPositionAsync` (100 ms poll) observed centering. It
passed only when the poll landed after the retry pass.

**Fix.** Wait for the request before asserting the count, exactly like
the sibling
`CollectionChangePreservesCurrentItemOverrideFromPositionChanged` test:

```csharp
await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");
```

Every existing assertion is unchanged, including `Assert.Equal(1,
scrollToRequests)` and the Mode/Index/Center/IsAnimated checks, so a
duplicate request still fails. No timeout, retry or tolerance changes.

### Issues Fixed

Fixes a failing device test on the SR2 candidate (#40116).

### Validation

Pending Windows device CI. The evidence will be added here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
…ic (#40395)

<!-- 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).
This is a test-only follow-up to #40394, which merged into the SR2
candidate (#40116).

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

Test-only change. No product code changes.

#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from #40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from #40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to #40394. Unblocks Windows device tests on #40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
…on Windows (#40394)

<!-- 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).
This is a test-only fix for a failure on the SR2 candidate #40116.

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

Test-only change. No product code changes.

> [!WARNING]
> **Draft:** the current head includes a temporary diagnostic test,
`DiagnosticSynchronousCurrentItemOverrideRequestOrdering`, which always
fails and reports timings. It will be removed in a follow-up commit
after Windows device CI records its results.

**Symptom.** Candidate device build
[1688573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688573)
(#40116), *Run DeviceTests Windows* (`Controls.DeviceTests-packaged`):
`CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride`
failed with `Assert.Equal() Failure: Expected: 1, Actual: 0` after 0.54
s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate
1688573, #40361's 1687233, #40288's 1683284, darc-net11 1681785, net11
1680671 and inflight 1680652. The test file is identical on the
candidate, `net11` and `main`.

**Root cause (test race).** Removing the current item makes
`replacement` current, and the test's `CurrentItemChanged` handler
overrides it to `override`. Synchronously, the handler sets `Position =
1` and queues the deferred override scroll. In this test, item 1 is not
visible yet, so the Low-priority
`CompleteCollectionCurrentItemOverrideScroll` does three things:

1. It calls `ScrollIntoView`. Since the viewport width equals the item
width, this already centers item 1 natively.
2. It schedules a 50 ms retry.
3. On the retry pass, it sees the item visible, clears the override and
calls `ItemsView.ScrollTo(1, Center, animate: false)`. That call raises
the counted `ScrollToRequested`.

So the visible centering always precedes the counted request by at least
50 ms. The test asserted `scrollToRequests == 1` as soon as
`WaitForCenteredPositionAsync` (100 ms poll) observed centering. It
passed only when the poll landed after the retry pass.

**Fix.** Wait for the request before asserting the count, exactly like
the sibling
`CollectionChangePreservesCurrentItemOverrideFromPositionChanged` test:

```csharp
await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");
```

Every existing assertion is unchanged, including `Assert.Equal(1,
scrollToRequests)` and the Mode/Index/Center/IsAnimated checks, so a
duplicate request still fails. No timeout, retry or tolerance changes.

### Issues Fixed

Fixes a failing device test on the SR2 candidate (#40116).

### Validation

Pending Windows device CI. The evidence will be added here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
…ic (#40395)

<!-- 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).
This is a test-only follow-up to #40394, which merged into the SR2
candidate (#40116).

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

Test-only change. No product code changes.

#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from #40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from #40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to #40394. Unblocks Windows device tests on #40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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
…on Windows (dotnet#40394)

<!-- 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).
This is a test-only fix for a failure on the SR2 candidate dotnet#40116.

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

Test-only change. No product code changes.

> [!WARNING]
> **Draft:** the current head includes a temporary diagnostic test,
`DiagnosticSynchronousCurrentItemOverrideRequestOrdering`, which always
fails and reports timings. It will be removed in a follow-up commit
after Windows device CI records its results.

**Symptom.** Candidate device build
[1688573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688573)
(dotnet#40116), *Run DeviceTests Windows* (`Controls.DeviceTests-packaged`):
`CarouselViewTests.CollectionChangePreservesSynchronousCurrentItemOverride`
failed with `Assert.Equal() Failure: Expected: 1, Actual: 0` after 0.54
s. Since 11-13 it failed in 6 of 552 Windows device runs: candidate
1688573, dotnet#40361's 1687233, dotnet#40288's 1683284, darc-net11 1681785, net11
1680671 and inflight 1680652. The test file is identical on the
candidate, `net11` and `main`.

**Root cause (test race).** Removing the current item makes
`replacement` current, and the test's `CurrentItemChanged` handler
overrides it to `override`. Synchronously, the handler sets `Position =
1` and queues the deferred override scroll. In this test, item 1 is not
visible yet, so the Low-priority
`CompleteCollectionCurrentItemOverrideScroll` does three things:

1. It calls `ScrollIntoView`. Since the viewport width equals the item
width, this already centers item 1 natively.
2. It schedules a 50 ms retry.
3. On the retry pass, it sees the item visible, clears the override and
calls `ItemsView.ScrollTo(1, Center, animate: false)`. That call raises
the counted `ScrollToRequested`.

So the visible centering always precedes the counted request by at least
50 ms. The test asserted `scrollToRequests == 1` as soon as
`WaitForCenteredPositionAsync` (100 ms poll) observed centering. It
passed only when the poll landed after the retry pass.

**Fix.** Wait for the request before asserting the count, exactly like
the sibling
`CollectionChangePreservesCurrentItemOverrideFromPositionChanged` test:

```csharp
await AssertEventually(() => scrollToRequests == 1, timeout: 2000, message: "The deferred current-item override did not request its final centered scroll.");
```

Every existing assertion is unchanged, including `Assert.Equal(1,
scrollToRequests)` and the Mode/Index/Center/IsAnimated checks, so a
duplicate request still fails. No timeout, retry or tolerance changes.

### Issues Fixed

Fixes a failing device test on the SR2 candidate (dotnet#40116).

### Validation

Pending Windows device CI. The evidence will be added here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
…ic (dotnet#40395)

<!-- 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).
This is a test-only follow-up to dotnet#40394, which merged into the SR2
candidate (dotnet#40116).

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

Test-only change. No product code changes.

dotnet#40394 merged into `candidate/11.0.1xx-sr2` (fc55531) while it still
contained a temporary diagnostic test,
`CarouselViewTests.DiagnosticSynchronousCurrentItemOverrideRequestOrdering`.
That test reports its timing measurements through `Assert.Fail`, so it
fails on every Windows device run (packaged and unpackaged).

This PR deletes that method only. The fix from dotnet#40394 stays: the
`AssertEventually(() => scrollToRequests == 1, …)` wait in
`CollectionChangePreservesSynchronousCurrentItemOverride`.

After this PR, the net change from dotnet#40394 against the previous candidate
head b45b3b4 is just that 4-line wait (`git diff b45b3b4
a8985d9`).

### Issues Fixed

Follow-up to dotnet#40394. Unblocks Windows device tests on dotnet#40116.

### Validation

- Roslyn syntax parse of `CarouselViewTests.Windows.cs` (net11.0): 0
diagnostics. A semantic Windows compile and the Windows device run are
not possible on this macOS machine.
- `git diff b45b3b4 HEAD`: only the 4-line `AssertEventually`
addition remains.
- Pending: Windows `maui-pr-devicetests` on this PR, to confirm the
diagnostic is gone and
`CollectionChangePreservesSynchronousCurrentItemOverride` passes in both
packaged and unpackaged runs.

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

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 57ceb3bc Deployed Nov 18, 2026 by kubaflo via conclusion #3095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant