A Fody add-in that automatically injects INotifyPropertyChanged event-raising code into property setters at compile time.
PropertyChanged.Fody is a .NET library that simplifies implementing the INotifyPropertyChanged interface by automatically injecting property change notification code during compilation. It works as a post-compilation weaver, eliminating repetitive boilerplate code for data-bound classes in UI frameworks like WPF and Xamarin. This keeps source code clean and reduces manual errors while maintaining runtime performance.
.NET developers building data-bound applications with UI frameworks that require INotifyPropertyChanged, such as WPF, Xamarin, or other MVVM-based projects. It is particularly useful for developers maintaining large codebases with many data-bound classes.
Developers choose PropertyChanged.Fody because it automates the tedious and error-prone task of writing PropertyChanged event-raising logic, ensuring consistency and reducing bugs. Its unique selling point is the combination of post-compilation weaving for runtime efficiency and an optional C# source generator for compile-time boilerplate generation, along with advanced features like dependent property notification and customizable interception.
Injects INotifyPropertyChanged code into properties at compile time
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically injects PropertyChanged event-raising logic into property setters, drastically reducing manual code and minimizing human error, as shown in the README's before/after compilation example.
Detects and automatically notifies dependent properties (e.g., FullName when GivenNames changes), ensuring UI updates for calculated fields without extra attributes, though manual configuration is possible via AlsoNotifyFor.
Offers both IL weaving for runtime efficiency and an optional C# source generator for compile-time boilerplate in partial classes, providing flexibility for different project needs, though the generator has limitations like SDK-style project requirements.
Supports global, class-level, and property-level interception via attributes like DependsOn and DoNotNotify, allowing fine-tuned control over notification logic, as detailed in the wiki pages.
Requires integrating with Fody as a dependency and configuring FodyWeavers.xml, adding steps to the build pipeline that can complicate CI/CD setups and introduce versioning issues.
The C# source generator only works in SDK-style projects, doesn't support records, and can cause conflicts in WPF multi-targeting scenarios, necessitating workarounds like the RemoveDuplicateAnalyzers build target.
IL weaving obscures the direct link between source code and compiled output, making it harder to trace property change logic in debuggers compared to explicit implementations, which can slow down troubleshooting.