Visual Studio Code Analysis and Code Metrics
Discuss issues regarding FxCop and Visual Studio's Code Analysis features, including both Managed and C/C++ Code Analysis, Code Analysis Policy and Code Metrics.
Announcements
What's new in Code Analysis for Visual Studio 2010
Duke KamstraMicrosoft EmployeeMonday, March 22, 2010 4:35 PMPlease see our blog for a description of the new Code Analysis functionality available in Visual Studio 2010: http://blogs.msdn.com/codeanalysis/archive/2010/03/22/what-s-new-in-code-analysis-for-visual-studio-2010.aspxFxCop Version 10.0 is available
Duke KamstraMicrosoft EmployeeMonday, July 26, 2010 4:30 PMVersion 10.0 of FxCop is the version that ships with Visual Studio 2010 Premium. FxCop 10.0 is part of Version 7.1 of the Microsoft Windows SDK for Windows 7 and .NET Framework 4.
Instructions
- Download the Microsoft Windows SDK for Windows 7 and .NET Framework 4 Version 7.1
- Using elevated privileges execute FxCopSetup.exe from the %ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\FXCop folder.
Frequently Asked Questions (FAQ)
Duke KamstraMicrosoft EmployeeThursday, February 18, 2010 6:45 PMFollowing is a collection of Frequently Asked Questions (FAQ) regarding PreFAST, FxCop, Managed Code Analysis and Code Metrics.
Visual Studio 2010 Rule Sets
Question: How do I ensure that the same code analysis rule set is used for all the projects developed by my team(s)?
Answer: See JB Browns blog post on this topic.
Rule Behavior
Question: Why does FxCop generate violations against itself?
Answer: Answered on the FxCop blog.
Question: Why do some sources recommend extending ApplicationException while FxCop does not?
Answer: Answered on the FxCop blog.
Question: Why does FxCop ignore my in-code (SuppressMessageAttribute) suppressions?
Answer: Answered on the FxCop blog.
Question: Why does DoNotExposeGenericLists recommend that I expose Collection<T> instead of List<T>?
Answer: Answered on the FxCop blog.
Question: How do I indicate to DoNotDeclareReadOnlyMutableReferenceTypes that a type is immutable?
Answer: Answered on the FxCop blog.
Custom Rule Development
Question: How do I integrate my custom FxCop rules into Visual Studio 2010?
Answer: Answered on the FxCop blog.
Question: Where is the official FxCop custom rules SDK?
Answer: There is currently no official custom rules SDK developed by Microsoft. The primary reason is that we are currently rewriting key components of the FxCop metadata reader and data flow analysis engine. This work guarantees that rules written today will need to be modified or entirely re-written in the future. Rules developers who have been working in FxCop for the past few years can attest to the fact that every release has involved some churn in the custom rules API. Each release readme contains detailed information about porting existing rules to the latest architecture.
As soon as the FxCop metadata and other relevant API stabilize sufficiently, we will develop an official FxCop custom rules SDK with samples demonstrating common patterns written in several languages. Until then, there are several resources available to custom rules developers:
· This forum. Post your rules development questions here.
· Rules samples uploaded to the MSDN Code Gallery. Search for 'FxCop'.
· Rules samples developed externally. Search the web for 'fxcop' and 'rules'
· Visit the custom rules category on the FxCop blog
Question: How do I integrate custom rules with Visual Studio?
Answer: Answered on the FxCop blog.
Question: How do I access the locals for a method?
Answer: Answered on the FxCop blog.
Filtering and SortingUse these options to narrow down the question and discussion list.
- 8235391

Tell me what kind of Custom Rule you want to write!!!
Joe Rohde Wednesday, July 04, 2007 1:35 AM - 947917

FxCop 1.36 Released!
Haiying Xu - MSFTMicrosoft EmployeeTuesday, August 19, 2008 8:41 PM - 022665

FxCop Blogs
David M. KeanMicrosoft EmployeeThursday, April 13, 2006 2:06 PM - 062

SVN Visual Studio Changes Coming from Nowhere?
adamvan101 15 hours 16 minutes ago - 5313

Visual Studio Code Metrics ganeration raises an error
juaprebo Thursday, May 17, 2012 7:25 AM - 2114

Find iBuf[ ... Visual Studio 2008
cte677 Monday, May 21, 2012 12:48 PM - 58159

What is CA2209 and how to fix it?
Pure Krome Wednesday, October 18, 2006 12:06 AM - 3233

How to parse CodeAnalysisLog.xml?
_BostonGeorge_ Wednesday, May 16, 2012 3:43 PM - 5261

CA2000 with try...catch...finally block
Krishna Chaithanya Tuesday, May 15, 2012 4:32 AM - 95079

How to include pdb file with debug information with Fxcopcmd.exe to exclude the warning:CA0068?
Fox Fu Thursday, September 03, 2009 6:30 AM - 5228

CA2202 isues
Krishna Chaithanya Tuesday, May 15, 2012 4:21 AM - 46791

Do not expose generic lists: performance of Collection<T> vs. List<T>
RMatsu Wednesday, May 31, 2006 7:23 PM - 1213

Check js file name with Fxcop
Othman S Tuesday, May 15, 2012 7:45 AM - 2179

CA2101: don't know how to resolve
DadCat Wednesday, May 16, 2012 4:41 PM - 105013

CA1816: Why should you call GC.SuppressFinalize when you have not provided ~class()
mherle Wednesday, December 10, 2008 5:16 AM - 2223

Code metrics maintainability index threshold
_BostonGeorge_ Tuesday, May 15, 2012 9:21 AM - 4348

FxCop Custom Rule for checking impersonation with integrated secuirity
Sharad Birajdar Wednesday, May 09, 2012 5:43 AM - 1316

FxCop v10 error "Method type parameter in position 0 is not valid."
Kelly Ethridge Wednesday, May 09, 2012 11:44 PM - 16272

How to display the System.String.Concat() parameter value in FxCop
KunSha Tuesday, October 05, 2010 11:18 AM - 3307

FxCop Custom Rule to identiy ASP Page attributes.
Sharad Birajdar Wednesday, May 09, 2012 5:57 AM

