fxcop

Why is DB an acronym and not abbreviation?

According to the .NET framework design guidelines, they say DB is an acronym and cased as such. But I thought it was an abbreviation of database? ...

Is there a StyleCop/FxCop autofixing tool?

Is there a tool that can automatically fix StyleCop and FxCop rules, rather than manually fixing thousands of warning and errors? There must be one, it is such a good business opportunity! ...

StyleCop and FxCop rules exclude each other

I'm using StyleCop and FxCop tools to improve my code but I came to a place where there are two rules, one in StyleCop and one in FxCop that exclude each other. If I fix my code to match the rule from StyleCop then FxCop validation fails and vice versa. First rule is SA1200 from StyleCop which says that all using directives must be plac...

How do I appease FxCop when a property getter/setter needs LinkDemand?

I have a property Foo on a class Bar: public int Foo { get { return GetFoo(); } set { SetFoo(value); } } Both GetFoo and SetFoo are decorated with [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]. As a result, FxCop correctly complains that the Foo prop...

How to specify CodeAnalysisRules in MSBuild via commandline

I want to be able to specify the Code AnalysisRules in commandline MSBuild (for Code Analysis / FXCOP). The project file would have something like this in it: <CodeAnalysisRules>-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302</CodeAnalysisRules> So I would assume that I use something like this: MSBuild.exe /property:Ru...

Running FxCop directly through VS project file

I am interested in setting up FxCop to run on each of our VS .csproj files in our developing environment by calling it as a target in the .csproj file itself without creating a separate MSBuild file for the project. Is this <Target Name="AfterBuild"> <Exec Command="&quot;C:\Program Files\Microsoft FxCop\FxCopCmd.exe&quot; /searchgac ...

Configuring Team System Code Analysis via a FxCop rules file

Is there anyway to configure the code analysis rules in Visual Studio Team System to match those in an FxCop configuration file and keep them in sync automatically? Not all the developers on the team have TS so keeping the rules we are currently running in an FxCop file is required so everyone can run the same set, but it would nice for...

FxCop command line and paths with spaces

I'm having problems getting the FxCop command line to work when I specify paths with spaces in them. Yes, I use the quotes properly. M:\build\IOService\src>"c:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe" /c /f:".\My Library\bin\Release\" /r:"c:\Program Files\Microsoft FxCop 1.36\Rules\" Microsoft (R) FxCop Command-Line Tool, Versio...

How to exclude an FxCop in source when item is auto-generated?

For example: Public Event CurrentChanged As EventHandler(Of CurrentChangedEventArgs(Of T)) Shows the message "Do not nest generic types in member signatures." on CurrentChangedEvent, which is the variable that holds the delegate for the event, and VB generates it automagically. How do I suppress the rule for the item? ...

Can't see my custom rules with fxcop

Hi all, I'm trying to develop a custom rule for fxcop. I've this code : namespace TestCustomRuleFxCop { public class DoTheRightThingRule : BaseIntrospectionRule { public DoTheRightThingRule() : base("DoTheRightThing", "TestCustomRuleFxCop.Rules", typeof(DoTheRightThingRule).Assembly) ...

Unit testing fxcop custom rules

Hi all, I would like to test my custom fxrules. I've seen this post : http://weblogs.asp.net/rosherove/archive/2007/02/24/writing-real-unit-tests-for-your-custom-fxcop-rules.aspx but it's not working with the last version of fxcop. The Microsoft.Cci.Method.GetMethod doesn't exists and I can't find an alternative. Do you know how to g...

fxcop custom rules - Inspecting source code to look for new keyword

Hi all, I would like to avoid instanciating certain class with new, and force to use the factory class. But I don't understand how to do that. Can someone show me a little sample ? Thanks in advance for any help, Best regards ...

fxcop custom rules - Avoid having more than one class per file

Hi all, as fxcop is an assembly inspector, is it possible to create a custom rule that check if there's more than one class per file ? If yes, how to do that ? Thanks for your help ...

FxCop: control assembly referenced by analyzed assembly not being loaded

FWIW: Windows 7 64bit, Compact Framework v3.5, FxCop v1.36 (running fxcopcmd.exe) I'm having problems getting FxCop 1.36 to run correctly. I'm analyzing a compact framework application with the globalization rules from http://www.dotneti18n.com/Downloads.aspx the .exe that i am analyzing has a reference to a 3rd party control suite: re...

Is fxcop a valuable/effective tool for improving code quality?

I have a large high quality c# framework codebase that I nevertheless want to try to improve. Is fxcop an effective tool for improving .NET frameworks? I know Microsoft uses the tool internally, but how do external users find it? Worthwhile? I already have a zillion lines of code and a well established style, can it be adapted to o...

Why not expose List(Of String) in the parameters of web service in VB.NET?

The FxCop says in a rule that generic List should not be exposed to the outside world. But I do not understand why and what is the replacement for the generice List? Reference : http://msdn.microsoft.com/en-in/library/ms182142%28en-us%29.aspx ...

What utilies you like of FxCop

I love Resharper, but Fxcop is free, and does some bits Resharper does. My question is what can do more to get best out of Fxcop? I am using VS2008, and planning to upgrade to VS2010 next March hopefully. ...

Stylecop vs FXcop

Has Stylecop superseded FXcop? Which product should we be using with Visual Studio 2008? ...

FxCop or other util to require inline docs in VB.NET?

I'm starting a new project; trying to be more strict than previous ones. I've set warnings as errors in the build I've added FxCop to PostBuild. The one last thing on my list os require people to add inline docs for all classes/non-private methods/properties. Is there a custom FxCop rule or another exe I can run in the post build to che...

Learning the Introspection API (used by FxCop)

Microsoft's FxCop tool uses the introspection API. This introspection API could be used to develop new code analysis tools. But the introspection api is not documented well. Additionally, I was not able to figure out any blogs which explains this API in breadth and depth of it. The knowledge gained by understanding the API can also be us...