[Android] Fix CarouselView Issue23291 and Issue29216 test regression on candidate branch#34996
Merged
kubaflo merged 3 commits intodotnet:inflight/candidatefrom Apr 17, 2026
Conversation
Contributor
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 16, 2026
Open
Contributor
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
During CarouselView startup on Android,
UpdateFromPositionruns before the carousel is fully initialized (_initialized = false). It sets_gotoPositionduring an initial scroll attempt, but since the layout is not ready, the scroll never completes. This leaves_gotoPositionstuck at a non-negative value.Earlier, this was unintentionally handled by an unconditional
_gotoPosition = -1inUpdateFromCurrentItem, which cleared the stale state. PR #34570 removed that line (to avoid breaking the guard during animations for #29544), exposing the issue.As a result,
_gotoPositionremains stuck, causing all subsequentUpdateFromPositioncalls to fail the_gotoPosition == -1check and skip scrolling. This leads to timeouts in tests likeIssue23291andIssue29216, as the carousel never moves to the requested position.Description of Change
Updated the guard condition in
UpdateFromPositionby applying the_initializedcheck only to the_gotoPositionassignment, ensuring it is set only after initialization while leaving the rest of the logic unaffected.This prevents premature or stale
_gotoPositionvalues during startup and preserves the existing scroll behavior, keeping the change safe.Issues Fixed
Fixes regression introduced by #34570 :
Issue23291TestIssue29216CarouselViewScrollingIssue on Candidate branch.Tested the behaviour in the following platforms