[Windows] Fix Indicator View Causing Looping Issue with CarouselView#27880
[Windows] Fix Indicator View Causing Looping Issue with CarouselView#27880Tamilarasan-Paranthaman wants to merge 8 commits intodotnet:mainfrom
Conversation
|
/rebase |
d4dd6c0 to
6d63ed5
Compare
|
/rebase |
6d63ed5 to
44d1664
Compare
|
/rebase |
44d1664 to
fc83861
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
|
||
| [Test] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void VerifyCarouselViewScrolling() |
There was a problem hiding this comment.
The test is failing on Mac and Windows:

at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2367
at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2384
at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 665
at Microsoft.Maui.TestCases.Tests.Issues.Issue27563.VerifyCarouselViewScrolling() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27563.cs:line 21
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
There was a problem hiding this comment.
The test failed with a timeout exception on both Windows and Mac.
On Mac, this appears to be due to the lack of support for SwipeRightToLeft. We can modify the test case specifically for the Mac platform.
On Windows, the test ran for an extended period before failing with a timeout exception.
I conducted further testing on a local machine and found that the test passed when CarouselView.Loop was set to false. This suggests that the issue occurs only when CarouselView.Loop is set to true. Additionally, I identified other test cases where Loop is enabled, and they also include the TEST_FAILS_ON_WINDOWS condition referencing this issue (e.g., Script: 12574 - Sample - 12574).
However, in the CI environment, the failure when Loop is enabled appears to be due to a different issue.
@jsuarezruiz, could you please share your insights on this and suggest how we should proceed on Windows platforms?
There was a problem hiding this comment.
@jsuarezruiz @Tamilarasan-Paranthaman is there a way forward with this PR?
|
@jsuarezruiz friendly ping |
|
/rebase |
0feecdd to
7b3fa97
Compare
|
Rebased and running a new build. |
|
|
||
| [Test] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void VerifyCarouselViewScrolling() |
There was a problem hiding this comment.
Can extend the new test to cover loop initial centering and the reentrancy case (tap indicator repeatedly while swiping), and a test that toggles Position to the same value to ensure no scroll storm occurs.
|
Hi, is this still valid? |
7b3fa97 to
c55024a
Compare
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 27880Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 27880" |
@kubaflo I have verified this on my end, and it is still valid PR. The issue still reproduces on the latest main source and is resolved by the changes made in this PR.
|
📋 PR Finalization ReviewTitle: ✅ GoodCurrent: Description:
|
| Before Issue Fix | After Issue Fix |
|---|---|
Before-Fix.mp4 |
After-Fix.mp4 |
Code Review: ⚠️ Issues Found
🔴 Critical Issues
1. Removed Loop centering code in UpdateInitialPosition
- File:
src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs - Problem: The original code had a block that set
_loopableCollectionView.CenterMode = true, calledListViewBase.ScrollIntoView(item), then resetCenterMode = falsewhenElement.Loopwas enabled. This entire block was removed. For Loop mode, the carousel needs to be centered in the virtualized list to allow bi-directional scrolling. Without this, Loop mode initial positioning may regress on Windows. - Recommendation: Verify that Loop mode still works correctly on initial load. If the centering was removed intentionally, add a code comment explaining why it is no longer needed.
2. UI test excluded from Windows — the target platform
- File:
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27563.cs - Problem: The test uses
#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYSTwhich excludes it from both Windows and MacCatalyst. Since this is a Windows-targeted fix, the test cannot verify the fix on the platform it targets. The comment references issue [Testing] Appium test does not perform the tap action with CarouselView. #29245 (TimeoutException with Loop), but the test page does not even useLoop = true. - Recommendation: Investigate whether the Windows exclusion is still necessary. If the Loop-related issue ([Testing] Appium test does not perform the tap action with CarouselView. #29245) does not affect this test scenario (no Loop in the test page), consider removing the Windows exclusion so CI validates the fix on Windows.
🟡 Suggestions
-
Snapshot label shows stale position — Both Android and iOS reference snapshots show "CarouselView Position - 0" even though the carousel is visually at position 2 ("Percentage View"). The HostApp button handler reads
carousel.Positionsynchronously after settingindicatorView.Position = 2, before the carousel finishes scrolling. Consider using aPropertyChangedhandler on CarouselView.Position to update the label asynchronously for accurate snapshot verification. -
CarouselScrolledreset edge case — The tracker reset (_lastScrolledToPosition = -1) inCarouselScrolledonly fires whenposition != _lastScrolledToPosition. If a user manually scrolls back to the same position the tracker already holds, it will not reset, which could prevent a subsequent programmatic scroll to that index. -
Missing newline at end of file — Both
Issue27563.csfiles (HostApp and Shared.Tests) are missing a trailing newline.
✅ Looks Good
- The
_lastScrolledToPositiontracking mechanism is a clean, effective approach to break the infinite ScrollTo → Scrolled → UpdatePosition loop - Good use of
IsDraggingandIsScrollingguards inUpdatePositionto prevent programmatic scrolls during user interaction - Proper reset of
_lastScrolledToPositioninOnCollectionItemsSourceChangedensures stale state does not persist after data changes - The HostApp test page uses C# only (preferred pattern), has correct
AutomationIdattributes, and appropriate[Issue]attribute - Single
[Category(UITestCategories.CarouselView)]on the test (correct per guidelines) - Fixes 3 long-standing related issues ([Windows] Indicator view causes looping with CarouselView #27563, CarouselView behaves strangely when manipulating position in ViewModel #22468, [Windows] [Scenario Day] Scroll by Object not working the first time #7149) with a single cohesive approach
|
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #27880 | Track _lastScrolledToPosition to guard ScrollTo re-entry |
❌ FAILED (Gate) | CarouselViewHandler.Windows.cs |
Tests excluded from Windows |
🔧 Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix (claude-opus-4.6) | Remove #if !WINDOWS from VerifyCarouselViewIndicatorPositionWithoutLooping |
FAIL | Issue27563.cs (test) |
App unresponsive on Windows; WinAppDriver proxy timeout (pre-existing #29245) |
| 2 | try-fix (claude-sonnet-4.6) | Re-entrancy bool flag _isScrollingProgrammatically reset in OnScrollViewChanged |
PASS (build) | CarouselViewHandler.Windows.cs |
Build 0 errors/0 warnings; cleaner semantics than int tracking; avoids subtle edge cases |
| 3 | try-fix (gpt-5.3-codex) | Block CarouselScrolled sync-back during programmatic scroll |
FAIL (env) | CarouselViewHandler.Windows.cs |
Build env TFM mismatch; approach conceptually valid but different risk profile |
| 4 | try-fix (gpt-5.4) | Restore Loop centering + int tracking (like PR) | BLOCKED (env) | CarouselViewHandler.Windows.cs |
Build env issues; approach is PR's fix + restored Loop centering |
| PR | PR #27880 | Track _lastScrolledToPosition (int) to guard ScrollTo re-entry; removes Loop centering |
FAILED (Gate) | CarouselViewHandler.Windows.cs |
Tests excluded from Windows (#if !WINDOWS) |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| claude-opus-4.6 | 2 | Yes | Defer ScrollTo via Dispatcher.Dispatch to break synchronous re-entrant call stack |
| claude-sonnet-4.6 | 2 | Yes | Position equality guard compare target position vs CarouselView.Position before ScrollTo |
| gpt-5.3-codex | 2 | Yes | Idempotent check: bail if target index equals both Position and CurrentItem |
| gpt-5.4 | 2 | Yes | Use SetValueFromRenderer instead of direct property sets to avoid triggering MapPosition feedback loop |
| claude-opus-4.6 | 3 | NO NEW IDEAS | |
| claude-sonnet-4.6 | 3 | NO NEW IDEAS | |
| gpt-5.3-codex | 3 | NO NEW IDEAS | |
| gpt-5.4 | 3 | NO NEW IDEAS |
Exhausted: Yes (Round 2 new ideas not actionable due to build environment constraints; 4 models confirm NO NEW IDEAS in round 3)
Selected Fix: Candidate #2 (bool re-entrancy flag) Only validated passing fix; cleaner semantics than PR's int tracking
📋 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Issue #27563 identified; Windows-only bug; 5 files changed |
| Gate | ❌ FAILED | Windows — both tests excluded via #if !WINDOWS |
| Try-Fix | ✅ COMPLETE | 4 attempts; 1 passing (bool re-entrancy flag, build validated) |
| Report | ✅ COMPLETE |
Summary
PR #27880 fixes a Windows CarouselView infinite scrolling loop caused by IndicatorView interactions, but the gate failed because both added tests are excluded from Windows with #if !WINDOWS guards. A PR that fixes a Windows-specific bug with no Windows test coverage is the core problem. Try-Fix found a cleaner alternative implementation (bool flag instead of int position tracking). The PR also removes Loop centering code from UpdateInitialPosition, which the author acknowledges may be a regression.
Root Cause
In CarouselViewHandler.Windows.cs, UpdateCurrentItem calls ItemsView.ScrollTo(...) unconditionally. This triggers the Scrolled event → CarouselScrolled → SetCarouselViewPosition → MapPosition → UpdatePosition → another ScrollTo, creating an infinite re-entrancy loop when an IndicatorView is connected to the CarouselView.
Fix Quality
Issues with the PR's fix:
-
No Windows test coverage (critical): Both tests use
#if !WINDOWS, meaning the Windows fix has zero automated validation. The tests cite issue [Testing] Appium test does not perform the tap action with CarouselView. #29245 (WinAppDriver timeout with Loop), butVerifyCarouselViewIndicatorPositionWithoutLoopingdoes not useLoop = true— the blanket exclusion is unnecessarily broad. -
Subtle reset logic in
CarouselScrolled: The reset conditionif (position != _lastScrolledToPosition) { _lastScrolledToPosition = -1; }is inverted — it resets the tracker only when the scrolled position is different from what was tracked. This means: if a user scrolls to the same position that was programmatically scrolled to, the tracker isn't reset. Subsequent programmatic scrolls to that same index will be silently blocked. A cleaner alternative (bool flag reset inOnScrollViewChangedwhen!e.IsIntermediate) avoids this edge case entirely. -
Removed Loop centering code (potential regression): The PR removes the Loop centering block from
UpdateInitialPositionand states this is intentional, but acknowledges a "potential regression." This changes behavior for apps usingLoop = true— initial centering no longer happens viaCenterMode. The PR does not include a regression test for Loop behavior. -
UpdatePositionadds ScrollTo with incomplete guard: The newScrollToinUpdatePositionis guarded by!IsDragging && !IsScrolling, butIsDragging/IsScrollingare set inOnScrollViewChanging/OnScrollViewChanged(WinUI scroll viewer events). Between a programmaticScrollTocall and the viewer'sViewChangingevent firing, these flags may still be false — the guard may not prevent all re-entry paths.
Agent's alternative (Candidate #2):
A bool _isScrollingProgrammatically flag (set before ScrollTo, reset in OnScrollViewChanged when !e.IsIntermediate) is simpler, has no subtle edge cases with position comparison, and compiled with 0 errors/0 warnings. It directly expresses the invariant: "one programmatic scroll at a time."
Reviewer feedback not addressed: jsuarezruiz asked to extend the test to cover "loop initial centering and the reentrancy case (tap indicator repeatedly while swiping)". This is still unresolved.
#34575) <!-- 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! ## Description Adds Windows platform support to the `maui-copilot` CI pipeline (AzDO definition 27723), enabling Copilot PR reviews on Windows-targeted PRs. ### Changes **`eng/pipelines/ci-copilot.yml`** - Add `catalyst` and `windows` to Platform parameter values - Add per-platform pool selection (`androidPool`, `iosPool`, `macPool`, `windowsPool`) - Skip Xcode, Android SDK, simulator setup for Windows/Catalyst - Add Windows-specific "Set screen resolution" step (1920x1080) - Add MacCatalyst-specific "Disable Notification Center" step - Fix `sed` command for `Directory.Build.Override.props` on Windows (Git Bash uses GNU sed) - Handle Copilot CLI PATH detection on Windows vs Unix - Change `script:` steps to `bash:` for cross-platform consistency **`.github/scripts/Review-PR.ps1`** - Add `catalyst` to ValidateSet for Platform parameter **`.github/scripts/BuildAndRunHostApp.ps1`** - Add Windows test assembly directory for artifact collection **`.github/scripts/post-ai-summary-comment.ps1` / `post-pr-finalize-comment.ps1`** - Various improvements for cross-platform comment posting ### Validation Successfully ran the pipeline with `Platform=windows` on multiple Windows-specific PRs: - PR #27713 — ✅ Succeeded - PR #34337 — ✅ Succeeded - PR #26217, #27609, #27880, #28617, #29927, #30068 — Triggered and running --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The concern in the AI summary is that the fix is specific to Windows, but the test is restricted on Windows. The AI suggested adding a Windows test to validate the fix. |
🚦 Gate - Test Before and After Fix📊 Expand Full Gate —
|
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue27563 Issue27563 |
✅ FAIL — 516s | ❌ FAIL — 423s |
🔴 Without fix — 🖥️ Issue27563: FAIL ✅ · 516s
Determining projects to restore...
Restored D:\a\1\s\src\Graphics\src\Graphics.Win2D\Graphics.Win2D.csproj (in 19.81 sec).
Restored D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj (in 19.81 sec).
Restored D:\a\1\s\src\Essentials\src\Essentials.csproj (in 9.44 sec).
Restored D:\a\1\s\src\Core\src\Core.csproj (in 15.54 sec).
Restored D:\a\1\s\src\Core\maps\src\Maps.csproj (in 13 sec).
Restored D:\a\1\s\src\Controls\src\Xaml\Controls.Xaml.csproj (in 65 ms).
Restored D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj (in 19 ms).
Restored D:\a\1\s\src\Controls\Maps\src\Controls.Maps.csproj (in 21 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj (in 7.11 sec).
Restored D:\a\1\s\src\Controls\Foldable\src\Controls.Foldable.csproj (in 13 ms).
Restored D:\a\1\s\src\BlazorWebView\src\Maui\Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 22 ms).
3 of 14 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics.Win2D -> D:\a\1\s\artifacts\bin\Graphics.Win2D\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Maps -> D:\a\1\s\artifacts\bin\Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Maps.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Microsoft.AspNetCore.Components.WebView.Maui -> D:\a\1\s\artifacts\bin\Microsoft.AspNetCore.Components.WebView.Maui\Debug\net10.0-windows10.0.19041.0\Microsoft.AspNetCore.Components.WebView.Maui.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Xaml -> D:\a\1\s\artifacts\bin\Controls.Xaml\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Xaml.dll
Controls.Foldable -> D:\a\1\s\artifacts\bin\Controls.Foldable\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Foldable.dll
Controls.Maps -> D:\a\1\s\artifacts\bin\Controls.Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Maps.dll
Controls.TestCases.HostApp -> D:\a\1\s\artifacts\bin\Controls.TestCases.HostApp\Debug\net10.0-windows10.0.19041.0\win-x64\Controls.TestCases.HostApp.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:05:48.63
Determining projects to restore...
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils\VisualTestUtils.csproj (in 721 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.NUnit\UITest.NUnit.csproj (in 1.32 sec).
Restored D:\a\1\s\src\TestUtils\src\UITest.Core\UITest.Core.csproj (in 3 ms).
Restored D:\a\1\s\src\TestUtils\src\UITest.Appium\UITest.Appium.csproj (in 1.05 sec).
Restored D:\a\1\s\src\TestUtils\src\VisualTestUtils.MagickNet\VisualTestUtils.MagickNet.csproj (in 6.52 sec).
Restored D:\a\1\s\src\TestUtils\src\UITest.Analyzers\UITest.Analyzers.csproj (in 5.16 sec).
Restored D:\a\1\s\src\Controls\tests\CustomAttributes\Controls.CustomAttributes.csproj (in 10 ms).
Restored D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj (in 3.5 sec).
7 of 15 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit run
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.08] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.28] Discovered: Controls.TestCases.WinUI.Tests
No test matches the given testcase filter `Issue27563` in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
🟢 With fix — 🖥️ Issue27563: FAIL ❌ · 423s
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics.Win2D -> D:\a\1\s\artifacts\bin\Graphics.Win2D\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Maps -> D:\a\1\s\artifacts\bin\Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Maps.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Maps -> D:\a\1\s\artifacts\bin\Controls.Maps\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Maps.dll
Controls.Xaml -> D:\a\1\s\artifacts\bin\Controls.Xaml\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Xaml.dll
Controls.Foldable -> D:\a\1\s\artifacts\bin\Controls.Foldable\Debug\net10.0-windows10.0.19041.0\Microsoft.Maui.Controls.Foldable.dll
Microsoft.AspNetCore.Components.WebView.Maui -> D:\a\1\s\artifacts\bin\Microsoft.AspNetCore.Components.WebView.Maui\Debug\net10.0-windows10.0.19041.0\Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.TestCases.HostApp -> D:\a\1\s\artifacts\bin\Controls.TestCases.HostApp\Debug\net10.0-windows10.0.19041.0\win-x64\Controls.TestCases.HostApp.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:05:33.48
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Graphics -> D:\a\1\s\artifacts\bin\Graphics\Debug\net10.0\Microsoft.Maui.Graphics.dll
Controls.CustomAttributes -> D:\a\1\s\artifacts\bin\Controls.CustomAttributes\Debug\net10.0\Controls.CustomAttributes.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Essentials -> D:\a\1\s\artifacts\bin\Essentials\Debug\net10.0\Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Core -> D:\a\1\s\artifacts\bin\Core\Debug\net10.0\Microsoft.Maui.dll
Controls.Core.Design -> D:\a\1\s\artifacts\bin\Controls.Core.Design\Debug\net472\Microsoft.Maui.Controls.DesignTools.dll
Controls.BindingSourceGen -> D:\a\1\s\artifacts\bin\Controls.BindingSourceGen\Debug\netstandard2.0\Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13750583
Controls.Core -> D:\a\1\s\artifacts\bin\Controls.Core\Debug\net10.0\Microsoft.Maui.Controls.dll
UITest.Core -> D:\a\1\s\artifacts\bin\UITest.Core\Debug\net10.0\UITest.Core.dll
UITest.Appium -> D:\a\1\s\artifacts\bin\UITest.Appium\Debug\net10.0\UITest.Appium.dll
UITest.NUnit -> D:\a\1\s\artifacts\bin\UITest.NUnit\Debug\net10.0\UITest.NUnit.dll
VisualTestUtils -> D:\a\1\s\artifacts\bin\VisualTestUtils\Debug\netstandard2.0\VisualTestUtils.dll
VisualTestUtils.MagickNet -> D:\a\1\s\artifacts\bin\VisualTestUtils.MagickNet\Debug\netstandard2.0\VisualTestUtils.MagickNet.dll
UITest.Analyzers -> D:\a\1\s\artifacts\bin\UITest.Analyzers\Debug\netstandard2.0\UITest.Analyzers.dll
Controls.TestCases.WinUI.Tests -> D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
Test run for D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
NUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit run
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.07] Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.28] Discovered: Controls.TestCases.WinUI.Tests
No test matches the given testcase filter `Issue27563` in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
⚠️ Issues found
- ❌ Issue27563 FAILED with fix (should pass)
📁 Fix files reverted (2 files)
eng/pipelines/ci-copilot.ymlsrc/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs
@kubaflo The tests added in the PR are not executed on Windows, even though they address a Windows specific issue. This is due to a known issue (#29245) that occurs when using CarouselView with Loop = true. Therefore, the test has been restricted on Windows. This has already been documented in the test case comments and updated in the PR description. |
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!
Root Cause of the issue
Description of Change
_lastScrolledToPositiontracking field to prevent re-entrant ScrollTo calls that cause the infinite loop.UpdateCurrentItemto only issue ScrollTo when the position actually differs AND has not already been scrolled to.UpdatePosition(guarded byIsDragging/IsScrollingchecks) so IndicatorView-driven position changes scroll the carousel correctly.CarouselScrolled) and collection source changes (OnCollectionItemsSourceChanged).UpdateInitialPosition(see code review note about potential regression).Why tests are restricted on Windows and Mac:
Issues Fixed
Fixes #27563
Fixes #22468
Fixes #7149
Tested the behaviour in the following platforms
Screenshot
Before-Fix.mp4
After-Fix.mp4