-
Notifications
You must be signed in to change notification settings - Fork 355
Description
Currently, using [ObservableObject]
/[INotifyPropertyChanged]
generator in WinUI project causes warning MVVMTK0049/0050, since WinRT source generator can't see the implemented interface in MVVMTK source generator.
A workaround for this can be explicitly specify the interfaces in user written part, then they are visible to WInRT source generator:
[INotifyPropertyChanged]
public abstract partial class MyControlBase : UserControl, INotifyPropertyChanged
{
}
However, when the MVVMTK generator sees the interface specification, it will think the interface is implemented by user and remove its generation. If we can force it to provide its generation, then the AOT warning should be addressed.
I also find a workaround by introducing another level of inheritance:
[INotifyPropertyChanged]
public abstract partial class ObservableUserControl : UserControl
{
}
public partial class MyControl : ObservableUserControl, INotifyPropertyChanged
Then WinRT source generator will correctly see interfaces on MyControl
, only ObservableUserControl
is missing the interface info. Is it safe to ignore the warnings for abstract types?