Partager via


Code Analysis FAQ

Find answers to commonly asked questions about Visual Studio Code Analysis.

General

FAQ: Why is FxCop 1.32 not available for download?
FAQ: Why does FxCop generate violations against itself?

Analysis and Rules

FAQ: Why is file and line information available for some warnings in FxCop but not for others?
FAQ: Why does FxCop warn against catch(Exception)?
FAQ: Why does DoNotExposeGenericLists recommend that I expose Collection<T> instead of List<T>?
FAQ: How do I indicate to DoNotDeclareReadOnlyMutableReferenceTypes that a type is immutable?
FAQ: What exception should I throw instead of the reserved exceptions that DoNotRaiseReservedExceptionTypes warns against?
FAQ: Why do some sources recommend extending ApplicationException while FxCop does not?
FAQ: How do I fix a violation of MovePInvokesToNativeMethodsClass?
FAQ: How do I increase the number of Code Analysis warnings displayed in the Error List?

Suppressions

FAQ: Why does FxCop ignore my in-code (SuppressMessageAttribute) suppressions?
FAQ: What is the GlobalSuppressions.cs/GlobalSuppressions.vb file and why is it needed? Is it possible to change the name of this file?

Configuration and Setup

FAQ: How do I share Managed Code Analysis rule settings over multiple projects?
FAQ: How do I run FxCop during a post-build event?

Custom Rules

FAQ: How do I integrate custom rules with Visual Studio?
FAQ: Can I create custom rules that target both Visual Studio and FxCop?
FAQ: How do I debug a custom rule?
FAQ: How do I access the locals of a method in a custom rule?
FAQ: How do I get the SourceContext for a local?
FAQ: When looking at the names of locals in a custom rule, why do I see strange names such as 'CS$1$0000' and 'VB$1$0000'?