Skip to content

Comments

[iOS] Fixed a crash issue with CollectionView when configured with CollectionViewHandler2 on iOS 15 and iOS 16.#27051

Merged
rmarinho merged 3 commits intodotnet:mainfrom
Tamilarasan-Paranthaman:fix-26997
Jan 14, 2025
Merged

[iOS] Fixed a crash issue with CollectionView when configured with CollectionViewHandler2 on iOS 15 and iOS 16.#27051
rmarinho merged 3 commits intodotnet:mainfrom
Tamilarasan-Paranthaman:fix-26997

Conversation

@Tamilarasan-Paranthaman
Copy link
Member

Root Cause of the issue

  • On iOS versions 15 and 16, the NumberOfSections method is called immediately after the base.LoadView method is invoked. At this point, ItemsSource was not set, which caused a crash when accessing the details from ItemsSource.

Description of Change

  • To address this issue, I added a check to verify if ItemsSource is null before proceeding. On iOS 17 and later, this behavior works correctly as the method is no longer called prematurely. For compatibility with older iOS versions, the null check ensures the method returns 0 if ItemsSource is null, resolving the issue with CV2 on iOS 15 and 16

Issues Fixed

Fixes #26997

Tested the behaviour in the following platforms

  • iOS
  • Android
  • Windows
  • Mac

Tested Versions

iOS Version Did the App crash?
iOS 15.2
iOS 15.5
iOS 16.4
iOS 17.5
iOS 18.0
iOS 18.1

Screenshots

Note: The video attached below shows that this issue occurs only on iOS 15+ and 16+ versions.

iOS version Before Issue Fix After Issue Fix
iOS 15.2
Before-Fix.mov
After-Fix.mov
iOS 15.5
Before-15.5.mov
After-15.5.mov
iOS 16.4
Before-16.4.mov
After-16.4.mov
iOS 17.5
Before-17.5.mov
After-17.5.mov
iOS 18.1
Before-18.1.mov
After-18.1.mov

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

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

@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 10, 2025
@jsuarezruiz jsuarezruiz added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Jan 10, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review January 10, 2025 17:36
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman requested a review from a team as a code owner January 10, 2025 17:36
@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis added this to the .NET 9 SR4 milestone Jan 11, 2025
@rmarinho rmarinho merged commit d4b563d into dotnet:main Jan 14, 2025
104 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman deleted the fix-26997 branch September 24, 2025 07:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[iOS 15] CollectionView with CollectionViewHandler2 configured, is crashing app on iOS 15 (15.2)

5 participants