[iOS] Fixed the Items are not displaying in CarouselView 2#29397
Merged
PureWeen merged 22 commits intodotnet:inflight/candidatefrom Oct 31, 2025
Merged
[iOS] Fixed the Items are not displaying in CarouselView 2#29397PureWeen merged 22 commits intodotnet:inflight/candidatefrom
PureWeen merged 22 commits intodotnet:inflight/candidatefrom
Conversation
Contributor
|
/azp run MAUI-UITests-public |
jsuarezruiz
suggested changes
May 8, 2025
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
|
/azp run MAUI-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
22e3539 to
953971b
Compare
Contributor
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
13d3f99 to
1e51570
Compare
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
previously requested changes
Sep 18, 2025
src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue7678_1.cs
Outdated
Show resolved
Hide resolved
Member
|
/azp run |
Changes Made
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
reviewed
Sep 23, 2025
|
|
||
| return true; | ||
| } | ||
| catch (Exception ex) when (ex is ObjectDisposedException or InvalidOperationException) |
Contributor
There was a problem hiding this comment.
Do we know how to reproduce an ObjectDisposedException? Catching ObjectDisposedException suggests lifecycle management issues that should be fixed at the source.
Contributor
Author
There was a problem hiding this comment.
I’m not exactly sure how to reproduce this ObjectDisposedException edge case @jsuarezruiz
jsuarezruiz
approved these changes
Oct 23, 2025
github-actions bot
pushed a commit
that referenced
this pull request
Nov 4, 2025
* Fixed the CarouselView2 rendering issues * Modified the test case * Fixed the 7678_1 issue * Re-fixed the issue7678_1 based on conflicts file * Removed the GetDesiredSize code * Removed spaces * Fixed the 31339 crash issue and position update related issue * Fixed the crash when setting position is greater than itemcount * Included the more test scenarios and included the recipe test * Added the Log for debugging purposes * Fixed the CarouselView2 rendering issues * Modified the test case * Fixed the 7678_1 issue * Re-fixed the issue7678_1 based on conflicts file * Removed the GetDesiredSize code * Removed spaces * Fixed the 31339 crash issue and position update related issue * Fixed the crash when setting position is greater than itemcount * Included the more test scenarios and included the recipe test * Added the Log for debugging purposes * Committed the review changes
This was referenced Nov 11, 2025
Closed
This was referenced Nov 24, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 of the issue
An exception is caused when attempting to scroll to an index that is out of bounds (i.e., not present in the section), which leads to the issue. (Issue 7678_1 and Issue31339)
After fixing the crash issue, it was observed that items were positioned at the last instead of the first in issue 31339. The root cause is that
InitialPositionSetis set to true during the initial load when the ItemsSource is not yet assigned. Later, when the ItemsSource is dynamically updated, InitialPositionSet remains true. As a result, the SetPosition method in CarouselViewController2 (triggered by section.VisibleItemsInvalidationHandler) applies the wrong position during concurrent updates, causing an incorrect item to be displayed in the view.Description of Change
Added a check to validate the index before attempting to scroll. This prevents exceptions caused by trying to scroll to an out-of-bounds item in the carousel view.
Set
InitialPositionSetto true only after the ItemsSource has been updated. This ensures the correct position can be calculated and applied.Issues Fixed
Fixes #29310
Fixes #31339
Fixes #31431
Fixes #16020
Test Case
Reenabled the test case :
Issue7678Reenabled the test case :
Issue7678_1Tested the behaviour in the following platforms
Screenshot
Cv2CrashOccured.mov
CV2NoCrashFixed.mov
CarouselView2Crash.mov
Nocrashoncv2.mov