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 Phone #26152

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NirmalKumarYuvaraj
Copy link
Contributor

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

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
2 participants