Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 Pro - SuppressMessage

Is the option to SupressMessage not available in VS 2010 Pro?

When I right click on the warning in the warning list there is no option to suppress. I also tried it with errors and there was no option. I then tried to create my own GlobalSuppression.cs file but have no idea what category the warning should be classified under.

Right now I'm doing this, which works, but I would prefer to use a GlobalSuppression file

#pragma warning disable 0649,0169
[Import(AllowRecomposition = false)]
private IModuleManager _moduleManager;

[Import(AllowRecomposition = false)]
private IRegionManager _regionManager;

[Import(AllowRecomposition = false)]
private IRibbonService _menuService;
#pragma warning restore 0649,0169

These are the warnings from the output window that I want to suppress:

warning CS0649: Field 'Shell._moduleManager' is never assigned to, and will always have its default value null
warning CS0169: The field 'Shell._regionManager' is never used
warning CS0649: Field 'Shell._menuService' is never assigned to, and will always have its default value null

The reason why I want to suppress is that my solution uses Prism / MEF so those variables are assigned at runtime.

like image 708
Chris Klepeis Avatar asked Feb 15 '11 14:02

Chris Klepeis


1 Answers

The CSxxxx warnings you are seeing are C# compiler warnings, not FxCop/Code Analysis warnings. They must be suppressed using #pragma warning disable directives, not SuppressMessage attributes.

Incidentally, integrated Code Analysis is only availabe in Premium or Ultimate, not Pro.

like image 89
Nicole Calinoiu Avatar answered Sep 21 '22 11:09

Nicole Calinoiu