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

[Windows] Fix for ListView ScrollTo Method throws NullReferenceException #26385

Merged
merged 8 commits into from
Dec 10, 2024

Conversation

Tamilarasan-Paranthaman
Copy link
Contributor

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman commented Dec 5, 2024

Root Cause of the issue

  • The exception occurred because the scroll request was processed before the control was fully loaded, causing the dispatcher to be null.

Description of Change

  • I resolved the issue by invoking the ScrollTo method within MainThread.BeginInvokeOnMainThread. This ensures that the scroll request is executed on the main thread.

Test Case

Reference

https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.WPF/Renderers/ListViewRenderer.cs#L427

Issues Fixed

Fixes #26345

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix
WithException.mp4
FixVideoofListView.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 5, 2024
@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 5, 2024
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review December 5, 2024 14:48
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman requested a review from a team as a code owner December 5, 2024 14:48
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as draft December 5, 2024 14:50
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review December 5, 2024 15:26
@Redth
Copy link
Member

Redth commented Dec 5, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tamilarasan-Paranthaman
Copy link
Contributor Author

/rebase

@rmarinho
Copy link
Member

rmarinho commented Dec 6, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Tamilarasan-Paranthaman
Copy link
Contributor Author

Can we rebase and reenable the tests from the other prs https://github.com/dotnet/maui/pull/26367/files#diff-ddeee3ee10f01134abc383c69a74dc4a65b5e8cbfa6dd682ceeb34734c6bdd6bR1

@rmarinho, I have reenabled the test cases.

@rmarinho rmarinho requested a review from Foda December 6, 2024 19:53
@jfversluis jfversluis added the area-controls-listview ListView and TableView label Dec 9, 2024
@jfversluis jfversluis dismissed rmarinho’s stale review December 10, 2024 10:14

Feedback addressed

@jfversluis jfversluis merged commit cf30c13 into dotnet:main Dec 10, 2024
104 checks passed
@samhouts samhouts added fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Dec 16, 2024
@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
area-controls-listview ListView and TableView community ✨ Community Contribution fixed-in-net8.0-nightly This may be available in a nightly release! fixed-in-net9.0-nightly This may be available in a nightly release! partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows 🪟
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] ListView ScrollTo Method Throws NullReferenceException
7 participants