How to exclude viewmodel properties from CA1811

Using VS 2010 / .Net 4.0, a CA1811 code analysis warning (see below) is triggered in all properties in the ViewModel, even if they are used with XAML binding:

Warning CA1811: Microsoft.Performance: "BackupWindowViewModel.BackupCommand.get ()" does not seem to have open or protected callers.

public ICommand BackupCommand { get { return _backupCommand; } } <--- CA1811 <Button Content="Backup" Command="{Binding BackupCommand}" /> 

This is because Code Analysis (currently) does not parse XAML. My question is, is there a way to exclude all properties in all ViewModels (e.g. classes derived from ViewModelBase) from CA1811? To suppress this warning for each individual property is a huge pain.

+6
c # static-analysis mvvm
source share
1 answer
  • Open the Properties project.
  • Go to the Create property page.
  • In the Errors and Warnings section, change the Suppress warnings : /nowarn:1811 property

http://msdn.microsoft.com/en-us/library/7f28x9z3%28v=VS.100%29.aspx

+2
source share

All Articles