Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.42 KB

WPF0014.md

File metadata and controls

49 lines (36 loc) · 1.42 KB

WPF0014

SetValue must use registered type.

Topic Value
Id WPF0014
Severity Error
Enabled True
Category WpfAnalyzers.DependencyProperty
Code SetValueAnalyzer

Description

Use a type that matches registered type when setting the value of a DependencyProperty

Motivation

When setting the value of adependency property the value must be a representation preserving conversion due to the value being boxed.

How to fix violations

Use a value of the registered type.

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable WPF0014 // SetValue must use registered type.
Code violating the rule here
#pragma warning restore WPF0014 // SetValue must use registered type.

Or put this at the top of the file to disable all instances.

#pragma warning disable WPF0014 // SetValue must use registered type.

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("WpfAnalyzers.DependencyProperty", 
    "WPF0014:SetValue must use registered type.", 
    Justification = "Reason...")]