Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed CollectionViewHandler2 null reference exception if ItemsLayout is set for Tablet but not on mobile devices #26152

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

NirmalKumarYuvaraj
Copy link
Contributor

@NirmalKumarYuvaraj NirmalKumarYuvaraj commented Nov 27, 2024

Issue Details

Adding a collectionview to a page and only setting the ItemsLayout property for Tablet will throw a null reference exception before the page appears on mobile.

Root Cause

At the time of wiring the ItemsLayout propertyChanged event the value for ItemsLayout is null. As a result , the exception is thrown.

Description of Change

Added a null check to ensure that the ItemsLayout property is not null before accessing it and wiring the event once the fallback value is set for ItemsLayout.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #26065

Output

Before After
Before After
IPad Tablet IPad Tablet

Copy link
Contributor

Hey there @NirmalKumarYuvaraj! 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 community ✨ Community Contribution label Nov 27, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@NirmalKumarYuvaraj NirmalKumarYuvaraj changed the title Fixed CollectionViewHandler2 null reference exception if ItemsLayout is set for Tablet but NOT Phone Fixed CollectionViewHandler2 null reference exception if ItemsLayout is set for Tablet but not on mobile devices Nov 29, 2024
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review November 29, 2024 07:05
@NirmalKumarYuvaraj NirmalKumarYuvaraj requested a review from a team as a code owner November 29, 2024 07:05
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho added this to the .NET 9 SR2 milestone Dec 4, 2024
@rmarinho rmarinho merged commit 0ddc794 into dotnet:main Dec 4, 2024
98 of 104 checks passed
@NirmalKumarYuvaraj NirmalKumarYuvaraj added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 6, 2024
@samhouts samhouts added fixed-in-9.0.21 fixed-in-net8.0-nightly This may be available in a nightly release! labels Dec 16, 2024
devanathan-vaithiyanathan added a commit to devanathan-vaithiyanathan/maui that referenced this pull request Jan 8, 2025
…sLayout is set for Tablet but not on mobile devices (dotnet#26152)"

This reverts commit 0ddc794.
devanathan-vaithiyanathan added a commit to devanathan-vaithiyanathan/maui that referenced this pull request Jan 8, 2025
…msLayout is set for Tablet but not on mobile devices (dotnet#26152)"

This reverts commit 4b9074c.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
collectionview-cv2 community ✨ Community Contribution fixed-in-9.0.21 fixed-in-net8.0-nightly This may be available in a nightly release! partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CollectionViewHandler2 null reference exception if ItemsLayout is set for Tablet but NOT Phone
4 participants