Skip to content

Conversation

@Dhivya-SF4094
Copy link
Contributor

@Dhivya-SF4094 Dhivya-SF4094 commented Mar 3, 2025

Issue Details

Updating grouped data in a hidden CollectionView can cause a crash on iOS and macOS.

Root Cause

The existing implementation of CollectionChanged() retrieves section and item counts from UICollectionView before processing collection changes such as Add, Remove, Replace, or Move. When an item is added to a new group or a group is deleted, the group count is updated within the Add/Remove methods. Since UICollectionView is not updated at this point, it results in inconsistencies in the internal data structure, leading to a crash when accessing sections.

Description of Change

To resolve this issue, updates to the CollectionView should be processed before and after querying its section and item counts. This ensures that UICollectionView correctly updates its internal state after retrieving section data, preventing inconsistencies and potential crashes.

This fixes the issue #28098 which is break

Validated the behaviour in the following platforms

  • iOS
  • Mac

Issues Fixed:

Fixes #28098
Fixes #27797

Screenshots

Video reference for #28098

Before  After 
 
28098_BeforeFix.mov
  
28098_AfterFix.mov

Video reference for #27797

Before  After 
 
27797_BeforeFix.mov
  
27797_AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 3, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @Dhivya-SF4094! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 3, 2025
@jsuarezruiz jsuarezruiz added the area-navigation NavigationPage label Mar 3, 2025
@PureWeen PureWeen added this to the .NET 9 SR5 milestone Mar 3, 2025
@PureWeen PureWeen added platform/ios p/0 Current heighest priority issues that we are targeting for a release. area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Mar 3, 2025
@PureWeen PureWeen moved this from Todo to Changes Requested in MAUI SDK Ongoing Mar 3, 2025
@Dhivya-SF4094 Dhivya-SF4094 changed the title Fixed Blank Screen on navigating back to Previous Page Fixed crash in CollectionView on iOS when updating grouped data. Mar 6, 2025
@Dhivya-SF4094 Dhivya-SF4094 marked this pull request as ready for review March 6, 2025 15:50
@Dhivya-SF4094 Dhivya-SF4094 requested a review from a team as a code owner March 6, 2025 15:50
@PureWeen PureWeen modified the milestones: .NET 9 SR5, .NET 9 SR6 Mar 7, 2025
@dotnet dotnet deleted a comment from PureWeen Mar 12, 2025
@dotnet dotnet deleted a comment from jsuarezruiz Mar 12, 2025
@rmarinho
Copy link
Member

Does this happens on CV2 also?

@dotnet dotnet deleted a comment from azure-pipelines bot Mar 12, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 12, 2025
@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Dhivya-SF4094
Copy link
Contributor Author

Does this happens on CV2 also?

@rmarinho Yes, this issue occurs in both CV1 and CV2. The provided fix resolves the issue in both.

@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Mar 18, 2025
@rmarinho rmarinho moved this from Ready To Review to Approved in MAUI SDK Ongoing Mar 18, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current March 18, 2025 19:07
@PureWeen PureWeen merged commit c235542 into dotnet:inflight/current Mar 18, 2025
123 of 128 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Mar 18, 2025
PureWeen pushed a commit that referenced this pull request Mar 26, 2025
)

* Fixed Blank Screen on navigating back to Previous Page

* Updated class naming

* Updated test sample

* Updated fix in ObservableGroupedSource

* Added snapshots

* Updated  test file namespace

* Added test case for CollectionView with grouped data
PureWeen pushed a commit that referenced this pull request Mar 26, 2025
)

* Fixed Blank Screen on navigating back to Previous Page

* Updated class naming

* Updated test sample

* Updated fix in ObservableGroupedSource

* Added snapshots

* Updated  test file namespace

* Added test case for CollectionView with grouped data
github-actions bot pushed a commit that referenced this pull request Mar 27, 2025
)

* Fixed Blank Screen on navigating back to Previous Page

* Updated class naming

* Updated test sample

* Updated fix in ObservableGroupedSource

* Added snapshots

* Updated  test file namespace

* Added test case for CollectionView with grouped data
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView area-navigation NavigationPage community ✨ Community Contribution p/0 Current heighest priority issues that we are targeting for a release. partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

Status: Done

4 participants