Apply SuppressPropertyChangedWarnings on child classes
OlegNadymov opened this issue · 1 comments
I have a base class and a lot of its child classes. And I have my custom virtual method named OnAttributeChanged
. I decorated the base class with [SuppressPropertyChangedWarnings]
attribute to get rid of Fody's warning:
Fody/PropertyChanged: Unsupported signature for a On_PropertyName_Changed method: OnAttributeChanged in ConsoleApp2.ChildClass. You can suppress this warning with [SuppressPropertyChangedWarnings].
Also I have a plenty of overrides of my custom method OnAttributeChanged
. And the above warning is still in the output during build. This warning from all of my child classes with overridden OnAttributeChanged
. It's tough to decorate all my child classes with [SuppressPropertyChangedWarnings]
attribute . And this solution looks not good... at least in my case.
Demo:
[SuppressPropertyChangedWarnings]
public class BaseClass : INotifyPropertyChanged
{
public int MyProperty { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
/// <summary>
/// My custom virtual method.
/// </summary>
/// <param name="args"></param>
protected virtual void OnAttributeChanged(EventArgs args)
{
}
}
public class ChildClass : BaseClass
{
protected override void OnAttributeChanged(EventArgs args)
{
base.OnAttributeChanged(args);
}
}
Is it possible to implement the feature when it is enough to decorate only one single base class with the attribute to prevent all these warnings from child classes?
Is it possible to implement the feature when it is enough to decorate only one single base class with the attribute to prevent all these warnings from child classes?
happy to accept a PR for this