-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
What happened?
If you add a [Ignored] property, it calls OnPropertyChanged (the entry point to raise property changed for computed properties) but does not actually call RaisePropertyChanged. Since RaisePropertyChanged and the event handler are private, its hard to actually call RaisePropertyChanged (can't call it from OnPropertyChanged or you'd get a loop)
Repro steps
Create Ignored property
[Ignored]
public int Order
{
get;
set;
}
Generated IL:
[Ignored]
public int Order
{
get => this.<Order>k__BackingField;
set
{
if (this.<Order>k__BackingField == value)
return;
this.<Order>k__BackingField = value;
this.OnPropertyChanged(nameof (Order));
}
}
Version
11.7.0
What Atlas Services are you using?
Local Database only
What type of application is this?
Xamarin
Client OS and version
11.7.0
Code snippets
Required to create a backing property to call RaisePropertyChanged
private int _order;
[Ignored]
public int Order
{
get => _order;
set
{
_order = value;
RaisePropertyChanged();
}
}
This surprisingly generates IL that does an extra equality check
[Ignored]
[CustomMappingIgnore]
public int Order
{
get => this._order;
set
{
if (this._order == value)
return;
this._order = value;
this.RaisePropertyChanged(nameof (Order));
}
}