Skip to content
No description, website, or topics provided.
C# PowerShell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.paket Update dependencies. Aug 11, 2019
ValidCode BoolToVisibilityConverter Aug 18, 2019
WpfAnalyzers.Benchmarks Rename KnownSymbols Aug 12, 2019
WpfAnalyzers.Test
WpfAnalyzers.Vsix
WpfAnalyzers Bump version. Aug 17, 2019
documentation WPF0176 StyleTypedProperty is missing. Aug 15, 2019
.editorconfig Update dependencies. Apr 14, 2018
.gitattributes Initial. Sep 23, 2016
.gitignore Rerun benchmarks. Oct 27, 2017
LICENSE Create LICENSE Oct 1, 2016
README.md WPF0176 StyleTypedProperty is missing. Aug 15, 2019
RELEASE_NOTES.md Bump version. 2.3 Aug 16, 2019
WpfAnalyzers.Demo.sln.DotSettings Add reference to JetBrains.Annotations Sep 26, 2016
WpfAnalyzers.sln WPF0176 StyleTypedProperty is missing. Aug 15, 2019
WpfAnalyzers.sln.DotSettings Fix a couple of tests. Aug 11, 2019
WpfAnalyzers.snk Sign, fix #152. Oct 17, 2017
appveyor.yml image: Visual Studio 2019 Jul 14, 2019
azure-pipelines.yml Set up CI with Azure Pipelines Jul 21, 2019
paket.dependencies Use WpfAnalyzers in ValidCode.csproj Aug 11, 2019
paket.lock Update dependencies. Aug 17, 2019

README.md

WpfAnalyzers

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

Roslyn analyzers for WPF.

  • 1.x versions are for C#6.
  • 2.x versions are for C#7.
Id Title
WPF0001 Backing field for a DependencyProperty should match registered name.
WPF0002 Backing field for a DependencyPropertyKey should match registered name.
WPF0003 CLR property for a DependencyProperty should match registered name.
WPF0004 CLR method for a DependencyProperty must match registered name.
WPF0005 Name of PropertyChangedCallback should match registered name.
WPF0006 Name of CoerceValueCallback should match registered name.
WPF0007 Name of ValidateValueCallback should match registered name.
WPF0008 [DependsOn(target)] must exist.
WPF0010 Default value type must match registered type.
WPF0011 Containing type should be used as registered owner.
WPF0012 CLR property type should match registered type.
WPF0013 CLR accessor for attached property must match registered type.
WPF0014 SetValue must use registered type.
WPF0015 Registered owner type must inherit DependencyObject.
WPF0016 Default value is shared reference type.
WPF0017 Metadata must be of same type or super type.
WPF0018 Use containing type.
WPF0019 Cast sender to correct type.
WPF0020 Cast value to correct type.
WPF0021 Cast sender to containing type.
WPF0022 Cast value to correct type.
WPF0023 The callback is trivial, convert to lambda.
WPF0030 Backing field for a DependencyProperty should be static and readonly.
WPF0031 DependencyPropertyKey member must be declared before DependencyProperty member.
WPF0032 Use same dependency property in get and set.
WPF0033 Add [AttachedPropertyBrowsableForType]
WPF0034 Use correct argument for [AttachedPropertyBrowsableForType]
WPF0035 Use SetValue in setter.
WPF0036 Avoid side effects in CLR accessors.
WPF0040 A readonly DependencyProperty must be set with DependencyPropertyKey.
WPF0041 Set mutable dependency properties using SetCurrentValue.
WPF0042 Avoid side effects in CLR accessors.
WPF0043 Don't set DataContext using SetCurrentValue.
WPF0050 XmlnsPrefix must map to the same url as XmlnsDefinition.
WPF0051 XmlnsDefinition must map to existing namespace.
WPF0052 XmlnsDefinitions does not map all namespaces with public types.
WPF0060 Backing member for DependencyProperty must have standard documentation text.
WPF0061 Accessor method for attached property must have standard documentation text.
WPF0062 Property changed callback must have standard documentation text.
WPF0070 Add default field to converter.
WPF0071 Add ValueConversion attribute.
WPF0072 ValueConversion must use correct types.
WPF0073 Add ValueConversion attribute (unknown types).
WPF0074 Use containing type.
WPF0080 Add MarkupExtensionReturnType attribute.
WPF0081 MarkupExtensionReturnType must use correct return type.
WPF0082 [ConstructorArgument] must match.
WPF0083 Add [ConstructorArgument].
WPF0084 Target of [XamlSetMarkupExtension] should exist and have correct signature.
WPF0085 Target of [XamlSetTypeConverter] should exist and have correct signature.
WPF0090 Name the invoked method OnEventName.
WPF0091 Name the invoked method OnEventName.
WPF0100 Backing field for a RoutedEvent should match registered name.
WPF0101 Containing type should be used as registered owner.
WPF0102 Name of the event should match registered name.
WPF0103 Use same event in add and remove.
WPF0104 Call AddHandler in add.
WPF0105 Call RemoveHandler in remove.
WPF0106 Use the registered handler type.
WPF0107 Backing member for a RoutedEvent should be static and readonly.
WPF0108 Backing member for RoutedEvent must have standard documentation text.
WPF0120 Register containing member name as name for routed command.
WPF0121 Register containing type as owner for routed command.
WPF0122 Register name and owning type for routed command.
WPF0123 Backing field for a RoutedCommand should be static and readonly.
WPF0130 Add [TemplatePart] to the type.
WPF0131 Use correct [TemplatePart] type.
WPF0132 Use PART prefix.
WPF0133 ContentProperty target does not exist.
WPF0140 Use containing type when creating a ComponentResourceKey.
WPF0141 Use containing member as key when creating a ComponentResourceKey.
WPF0150 Use nameof().
WPF0170 StyleTypedProperty.Property must exist.
WPF0171 StyleTypedProperty.Property must specify a property of type Style.
WPF0172 StyleTypedProperty.Property must be specified.
WPF0173 StyleTypedProperty.StyleTargetType must be assignable to a type that has a Style property.
WPF0174 StyleTypedProperty.StyleTargetType must be specified.
WPF0175 StyleTypedProperty.Property must be specified only once.
WPF0176 StyleTypedProperty is missing.

Using WpfAnalyzers

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

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

Installation

WpfAnalyzers 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 WpfAnalyzers

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 WpfAnalyzers 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.

You can’t perform that action at this time.