-
-
Notifications
You must be signed in to change notification settings - Fork 234
Description
Describe the issue
PropertyChanged.Fody weaver makes unintended changes to behavior of setters with custom logic. Specifically, it prevents any custom code in the setter from firing when the value is unchanged, except when configured not to check for equality.
Minimal Repro
Test cases demonstrating this added here
Pull request will be created.
Make an effort to fix the bug
To fix this behavior, the weaver would have to be adjusted so that the control logic using the equality check is constrained only to the OnPropertyChanged injection, rather than indiscriminately applying to the setter as a whole.
So EnqualityCheckWeaver.cs:InjectEqualityCheck(Instruction targetInstruction, TypeReference targetType, TypeReference declaringType) would have to be adjusted.
-
to ensure custom code prior to backing field/property assignment is run, it should accept an insertion site as input, or detect the proper insertion site internally
-
to ensure custom code after backing field/property assignment is run, the inserted instructions should not be equivalent to
if (true) return; else //continuei.e. usingOpCodes.Ret, but ratherif (true) //continue; else OnPropChanged();