Skip to content

Roslyn analyzers for INotifyPropertyChanged

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.orig
Notifications You must be signed in to change notification settings

JCBurnside/PropertyChangedAnalyzers

 
 

Repository files navigation

PropertyChangedAnalyzers

Join the chat at https://gitter.im/DotNetAnalyzers/PropertyChangedAnalyzers License Build status NuGet

Roslyn analyzers for WPF.

  • 1.x versions are for Visual Studio 2015.
  • 2.x versions are for Visual Studio 2017.

inpc

INPC001 Implement INotifyPropertyChanged.
INPC002 Mutable public property should notify.
INPC003 Notify when property changes.
INPC004 Use [CallerMemberName]
INPC005 Check if value is different before notifying.
INPC006_a Check if value is different using ReferenceEquals before notifying.
INPC006_b Check if value is different using object.Equals before notifying.
INPC007 The class has PropertyChangedEvent but no invoker.
INPC008 Struct must not implement INotifyPropertyChanged
INPC009 Don't raise PropertyChanged for missing property.
INPC010 The property sets a different field than it returns.
INPC011 Don't shadow PropertyChanged event.
INPC012 Don't use expression for raising PropertyChanged.
INPC013 Use nameof.
INPC014 Prefer setting backing field in constructor.
INPC015 Property is recursive.
INPC016 Notify after update.

Using PropertyChangedAnalyzers

The preferable way to use the analyzers is to add the nuget package PropertyChangedAnalyzers to the project(s).

The severity of individual rules may be configured using rule set files in Visual Studio 2015.

Installation

PropertyChangedAnalyzers can be installed using Paket or the NuGet command line or the NuGet Package Manager in Visual Studio 2015.

Install using the command line:

Install-Package PropertyChangedAnalyzers

Updating

The ruleset editor does not handle changes IDs well, if things get out of sync you can try:

  1. Close visual studio.
  2. Edit the ProjectName.rulset file and remove the PropertyChangedAnalyzers element.
  3. Start visual studio and add back the desired configuration.

Above is not ideal, sorry about this. Not sure this is our bug.

Current status

Early alpha, names and IDs may change.

About

Roslyn analyzers for INotifyPropertyChanged

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.orig

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.8%
  • PowerShell 0.2%