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

Invoking the PropertyChanged event throws NullReferenceException #21431

Open
AlphaNERD- opened this issue Mar 25, 2024 · 3 comments
Open

Invoking the PropertyChanged event throws NullReferenceException #21431

AlphaNERD- opened this issue Mar 25, 2024 · 3 comments
Labels
area-controls-listview ListView and TableView platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@AlphaNERD-
Copy link

AlphaNERD- commented Mar 25, 2024

Description

Hello MAUI devs,

so i've been working on a small app for testing purposes. That app uses a ViewModel which implements the INotifyPropertyChanged interface. When i try to update a ListView by invoking PropertyChanged, all i get is a NullReferenceException.

The kicker is that according to VS, the PropertyChanged event is not null. However i cannot check whether the invocation list is null because of some other exception within the debugger. I did implement a null check within my ViewModel hoping that this exception wouldn't come up again but it does.

Steps to Reproduce

  1. Build the project
  2. Enter something within the entry. Ideally one of the first or last names listed within the constructor of ViewModelTest

Expected behavior:
A list of names should appear under the text box.

Actual behavior:
The debugger reports an uncaught NullReferenceException in OnPropertyChanged().

Link to public reproduction project repository

https://github.com/AlphaNERD-/NETMAUIBindingDemo

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows, macOS

Affected platform versions

Windows 10, macOS 14.4

Did you find any workaround?

No response

Relevant log output

No response

@AlphaNERD- AlphaNERD- added the t/bug Something isn't working label Mar 25, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Mar 26, 2024
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio 17.10.0 Preview 2. Can repro on windows platform with sample project. Android works fine.
https://github.com/AlphaNERD-/NETMAUIBinding
image

@AlphaNERD-
Copy link
Author

AlphaNERD- commented Mar 27, 2024

Little update: This issue also occurs on macOS with .NET MAUI 8.0.7.

@Toomas75
Copy link

The elements specified in the DataTemplate define the appearance of each item in the list, and the child of the DataTemplate must be a Cell object.

<ListView ItemsSource="{Binding TestUsers, Mode=TwoWay}"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Label Text="{Binding UserName}"/> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

@PureWeen PureWeen added the area-controls-listview ListView and TableView label May 15, 2024
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 4, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-listview ListView and TableView platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants