Recent update: 2008-3-21

Globalization Rules

100 byte By VivekAyer at 2008-3-7
<span>How do you ask FxCop to ignore all Globalization Rules while analyzing your assembly? </span>

Possible to detect use of enum.ToString()?

460 byte By MatthewWatson at 2008-3-6
Does anyone know if it is possible to detect the use of an enum's "ToString()" method? The reason I ask is because we have started obfuscating our code using Dotfuscator, and of course because that renames the enums, it plays merry hell with any use of enum.ToString()! It'd be great if FXCopy ...

FXCop addresses Security vulnerabilities?

2062 byte By Arshadje at 2008-3-5
I'm new to FxCop. Does FXCop addresses the following list of vulnerabilities? Buffer Overflow Detection Access Control Analysis Format String Issues Detection Dangerous Function/Method Calls Detection Thread Safety Race Conditions Detection Encryption and RNG Misuse Detection Input ...

Sharing FxCop project

463 byte By ACS at 2008-3-3
Hi, I'd like to know if there is a practical way to share an FxCop project between different developers and code reviewers. If you share the project through source safe I guess you would have to chek it out everytime you exclude a message or select/deselect an assembly for analysis and then ...

FxCop v1.32 versus FxCop version shipped with VS 2005 Beta2

757 byte By katrien at 2008-3-1
Hi,For a few days I have been working with FxCop v1.32 and the FxCop version that is included in VS 2005 Beta 2 (I will refer to this as FxCop v8) in order to evaluate these. Both are great tools and each one of them has some great features that the other one doesn't have. (differences like ...

Is there a way to get more detailed scan results of FxCop?

2101 byte By Tee at 2008-2-28
Hi,We are making a tool that displays the data generated by FxCop. However we couldn’t get the total scanned rules of FxCop, FxCop Analysis Report only contains the details of failed rules. (Screenshot: ...

Extend FxCop to check WebService Proxy.Url string

1800 byte By Rati at 2008-2-27
Hi Michael,This thread is a continuation of a thread (id=327628) from the old forum. That thread was started by SunilMenon. Since I did not get any reply to my post on the old forum I am re-sending the same on this forum.I have tried to create a custom rule for the above request. Can you please ...

Detecting unused code across multiple assemblies

359 byte By BrettShearer at 2008-2-26
In an older version of FX Cop (a few years ago now), I think there was a public class called Graph.I wrote an app that used this class to detect unused code across multiple assemblies (we have 247 assemblies at present and around 4.5 million lines of code).Is there any current way of performing ...

FXCop run befor i checkin the file in SourceSafe from VisualStudio2003

237 byte By Matthias2005 at 2008-2-25
Our project in the VisualStudio 2003 are to big to check it all the time with fxcop. So i want to check the file only when i checkin in the sourcesafe. Are there a posibility to call the cmdline of fxcop? Thx for helping Matthias

FxCop Error Message...

331 byte By SeunghoNam at 2008-2-24
Hello,I've encountered error message while integrating FxCop with Nant.The error message is as follows:External Program Failed: C:\Program Files\Microsoft FxCop 1.312\fxcopcmd.exe (return code was 2)Could you let me know how I can resolve this problem?Thanks in advance.Best regards,Nam, ...

PInvoke calling convention mismatch

762 byte By NathanB at 2008-2-23
By default, the unmanaged C++ compiler generates functions that are _cdecl, but .NET PInvoke requires _stdcall. This causes obvious stack corruption issues and hard-to-find bugs.Ideally, I would have thought that the .NET runtime could detect that the stack pointer changed after making a ...

ImplementIDisposableCorrectly

925 byte By SteveDunn at 2008-2-22
The rule “ImplementIDisposableCorrectly” should not be displayed in sealed classes as the Dispose(bool) method cannot be declared as protected or virtual. Also, the help page for this rule has no text for this rule and when clicking the feedback button, it generates an e-mail with the subject ...

Unresolved Reference: Microsoft.Vbe.Interop

1015 byte By KylePike at 2008-2-22
Hey,I'm working on a project that is in the process of being ported from VB6 to .NET. I've tried to run fxCop against the main .DLL (it's a web app) but I get an error message telling me that there is an unresolved reference to Microsoft.Vbe.Interop. Now, I have confirmed that this file does ...

How can I define a common set of rules to be used by others.

110 byte By Paulaps at 2008-2-21
It is possible to define a common dictionary, but I can't see how a can define a common set of rules.

Checking the number of elseif statements in a loop

257 byte By Biswa at 2008-2-20
Hi All Can any 1 help me. I want to write a rule to check the number of elseif conditions in a if statement. Can any one write to me if it possible to write this type of rule and if it is possible then how to go ahead with this. Thanks Biswa

Preferences: Use documentation from:

500 byte By SelormeyPaul at 2008-2-20
I am using the current version 1.32 and my setting is the default http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.32&url=However, a click on the documentation links gives an error message.Could not invoke link: Application not found.How do I resolve this?Best regards,Paul. ...

COM Classes Exceptions

19598 byte By DavidHary at 2008-2-19
It looks like the interface created by .Net for COM classes does not seem to conform to the FxCop rules. Here are some of the exceptions I am getting for the simple class below: Error, Certainty 95, for IdentifiersShouldNotContainUnderscores"Remove all underscores from type ...

Custom rules limitations

275 byte By JeremyMaddrey at 2008-2-18
We are beginning to implement FXCop, and are looking to use several custom rules. I've noticed limitations on certain rule testing. Are the following possible to implement as custom rules? Use brackets after if statements object assignments should occur in Try blocks

Questions about FxCop Error Message...

1987 byte By SeunghoNam at 2008-2-17
I integrated Fxcop with CCNET and nant. Everytime Fxcop runs, it shows an error message as follows:C:\Build\ITIS-Daily\Source\HOME\master.build(516,4):External Program Failed: C:\Program Files\Microsoft FxCop 1.312\fxcopcmd.exe (return code was 514) What does this message mean? Please tell me ...

I cannot get source code links in FxCopCmd report

551 byte By MrekM at 2008-2-16
I do not have any problem with getting correct link to the source code in "Message Details" box when I am running the analysis from FxCop GUI. However, when I run analysis from command line and then load the report to GUI, the only thing I am getting is <Location not stored in Pdb>The ...

maintainabilityrules.dll and reliabilityrules.dll

345 byte By Vi_Tinh at 2008-2-15
hi all,I used MSBuild to build my solution but it failed because it was looking for the 2 rule files from FXCop. They are not in the bin folder. Does someone know where I can get them? The version of FXCop is 1.32 and the 2 rule files it's looking for are maintainabilityrules.dll and ...

.NET 1.1 FxCop 1.32 SDK Documentation

392 byte By Steve.W at 2008-2-15
Hi all, I am new to FxCop, and can clearly see its advantages. However, I am unable to find any documentation as to how to use the SDK that accompanies the application version 1.32.I am eager to delve into FxCop to utilise it, but without API direction, I can see that I will potentially be ...

Possible false positive for ValidateArgumentsOfPublicMethods

874 byte By Joe2005 at 2008-2-15
I added an == operator to a class. Its method signature is public static bool operator ==(Table table1, Table table2).FxCop throws the ValidateArgumentsOfPublicMethods error and asks that I check the parameters for null. OK, so I did.if( table1 == null || table2 == null ){ return false;}FxCop ...

C#2.0 CA2123 and CA2122 ... Need Help to Resolve

3179 byte By orekin at 2008-2-15
Hi There Apologies for posting such a dumb question but I my knowledge of security is amatuer and I need to deploy this project tomorrow with no security warnings ... I am inheriting from DateTimePicker class to create a DateTimePicker control with a configurable back colour. I got the ...

[BUG] Possible false positive with ImplementIDisposableCorrectly

2336 byte By DavidM.Kean at 2008-2-15
Hi guys,I have encountered what appears to be a false positive with ImplementIDisposableCorrectly.When analyzing the code below, DerivedClass appears to trigger this violation incorrectly stating: 'Remove IDisposable from the list of interfaces implemented by WindowsApplication3.DerivedClass ...

Whose "Two letter acronyms should be upper-cased" convention is?

647 byte By Maxicus at 2008-2-14
Hello,Can you say, whose convention is it? "Two letter acronyms should be upper-cased. For example, use System.IO instead of System.Io. ..."I found it in MS Design Rules, but is is not explained why it is done in this way (most of other rules are well-explained).I need more facts to ask IT ...

DoNotCastUnnecessarily: Release vs Debug

341 byte By LeeGrissom at 2008-2-14
When I compare the outputs of FxCop for my assemblies in Debug and Release build modes, the results are very different. The Debug report shows 233 more issues that are all related to "DoNotCastUnnecessarily" messages. Is the compiler optimizing things for a release build and that's why I ...

Content of FxCop report file

634 byte By MrekM at 2008-2-13
I try to set up command line FxCop environment which uses my base report and then if new exceptions are detected it calls FxCop GUI. To get a report that can be opened by FxCop GUI, I specify /o:report.FxCop as an output file for my FxCopCmd.exe. First thing that I do not understand is that ...

FxComCmd error code for new messages

363 byte By MrekM at 2008-2-13
Hi there,In my test I use the baseline report and I am interested in catching the situation when FxCop detects new messages. I am checking ERRORLEVEL in the batch file but FxCopCmd seems to not report any error even if new exceptions were found in the code.Could you tell me what is not correct ...

Rule TypesShouldNotExtendCertainBaseTypes

1441 byte By MartinTirion at 2008-2-12
What about the rule on inheritance of ApplicationException not being the advised method anymore, but using System.Exception as the base? The link to MSDN shows an article that tells to inherit from ApplicationException…: Do not derive all new exceptions directly from the base class ...

Detect Use of Unmanaged Resources

871 byte By Lenin at 2008-2-11
Hi, I am completely new to FXCop so sorry if this is a dumb question, but could FXCop detect when an class creates an object that uses unmanaged resources, that does cleanup properly, something like public void CreateMemoryStreamUnmanaged() { MemoryStream memStream = new MemoryStream(100); ...

Using VS2005 (beta 2) with custom rules

950 byte By Sara_H at 2008-2-10
Hi,I'm trying to integrate custom FxCop rules using the Code Analysis capabilities of VS2005 beta 2 and I'm hitting some problems :(I've written a very simple custom rule which loads and runs OK under the stand-alone version of FxCop 1.32 I've then changed the FxCop and Cci references (and ...

Fxcop LiteralsShouldBeSpelledCorrectly and German

411 byte By toebens at 2008-2-10
Hi,i added Fxcop 1.32 to Visual Studio .net 2003.When i let it check my project i receive a lot of "LiteralsShouldBeSpelledCorrectly" Error messages in the output window of VS.Correct the spelling of the unrecognized token 'AGermanWordInHere' in the literal '<span>My german text in ...

PInvokeDeclarationsShouldBePortable

1045 byte By Anon at 2008-2-8
FxCop is giving me a PInvokeDeclarationsShouldBePortable error on my use of IntPtr in the following declaration: <DllImport("shell32.dll", CallingConvention:=CallingConvention.Winapi)> _ Private Shared Function ExtractIcon(ByVal hInst As IntPtr, ByVal lpszExeFileName As String, _ ByVal ...

Casting Instruction.Value

1381 byte By JamesJackson at 2008-2-8
I'm getting runtime errors (Specified cast is not valid) when attempting to cast Instruction.Value (for Stloc and Ldloc OpCode families) to an integer e.g.: int variableIndex; if(instruction.OpCode == OpCode.Stloc_S) { variableIndex = (int)instruction.Value; } An example line raising an ...

Changing ByVal arguments

475 byte By FilthyZombie at 2008-2-7
Is there or has anyone written a rule to check whether ByVal arguments are changed ?1) In order to provide our developers with correct calling information in a call stack it is important that we have the original values.2) If the developer was intending to pass information back to the caller ...

Assemblies Should have valid Strong Names

1203 byte By HelenD at 2008-2-7
I am trying to convince the developers in the company that we really should obey this rule. What I thought I would do would be create 2 projects one that calls a dll with a strong name and another that does not call a dll with a strong name. I was then intending to demonstrate that if the ...

Identifying 'using' (C#)

451 byte By JamesJackson at 2008-2-7
I'm trying to write a rule to check a certain object type is always used as part of a 'using' code block. I get the impression that the only way to do this is by doing some source walking - I find no 'VisitUsing' method. Looking at my source in ILDASM, it appears that using blocks are ...

How do change the custom rules of FxCop1.312 to v1.32

189 byte By FxCopCustomRule at 2008-2-7
Hi Can yuo pls give me some sample custom rules of FxCop 1.32 and some ideas about how to modify the custom rules of FxCop 1.312 to work in FxCop 1.32? Thanks in advance, Arun M

Language

306 byte By ACS at 2008-2-6
Hi, I tried to analize my code using spanish as the language to use for spelling options but I still get spelling errors for all the words in spanish (and no errors for words in english). Is there any way to get FxCop to recognize spanish words without adding them all to the custom dictionary? ...

Parsing method body

438 byte By smartneraj at 2008-2-6
HiI am trying to parse a method body in a custom rule for FXCOP and filter some words.e.g.void SomeMethod(){ statement1; statement2; statement3; } The method.Body.Statements does not contain the text of the statement. Is there any other method to get the result?Thanks ...

FXCOP

84 byte By smartneraj at 2008-2-5
Can anybody tell me the new function for ISMEthodCall() in older version? Thanks

Whidbey FxCop 1.32 ignores certain methods ?

409 byte By GuySmith-Ferrier at 2008-2-5
Does the Whidbey FxCop 1.32 have built in intelligence for ignoring certain methods ? I ask because I have various rules which check ASP.NET generated assemblies. They run fine using the .NET Framework 1.1 FxCop 1.32 but when I run them on ASP.NET 2 assemblies using the Whidbey FxCop 1.32 none ...

BaseIntrospectionRule.TargetVisibility is different for Whidbey FxCop 1.32

160 byte By GuySmith-Ferrier at 2008-2-4
Why does BaseIntrospectionRule.TargetVisibility return a lower visibility for the Whidbey FxCop 1.32 than it does for the .NET Framework 1.1 FxCop 1.32 ? Guy

Bug in FxCop 1.32 displaying an FxCop custom rule error

1452 byte By GuySmith-Ferrier at 2008-2-4
When I run FxCop.exe (build 50628.0) and analyze an assembly using my custom rules and then double click on the error generated from my custom rules I get the following error:-System.NullReferenceException: Object reference not set to an instance of an object. at ...

Spelling Rules

611 byte By GuySmith-Ferrier at 2008-2-4
Am I right in assuming that there is no way in which you can specify which dictionary to use on a per rule basis ?I ask because the "Identifiers should be spelled correctly" rule and the "Literals should be spelled correctly" rule both apply to the developer. However, the "Resource strings ...

FXCop: Exclude specific files from analysis?

365 byte By ClintStotesbery at 2008-2-4
Is it possible to exclude whole files from code analysis? My scenario is where I have a web reference that generates a web service proxy class. This reference will get updated periodically so I don't want to supress 500 messages every time I update it. Is it possible to exclude a whole file? I ...

error loading custom rules to FxCop v1.32

1745 byte By arch82 at 2008-2-3
Hello ,I am trying to add certain custom rules to fXCop v1.32.I had developed these for FxCop v1.312.The exception message i get while trying to load these rules to FxCop v1.32 isOne or more of the types in the assembly unable to load.The LoaderExceptions Array ...

"Normalize strings to uppercase" rule

372 byte By GuySmith-Ferrier at 2008-2-3
One of the new rules in 1.32 is the "Normalize strings to uppercase" which tells me to "replace the call to String.ToLower(CultureInfo.InvariantCulture) with String.ToUpper(CultureInfo.InvariantCulture)".I am missing the point of this new rule - why is a conversion to uppercase any more ...

CA1002 - DontExposeGenericLists

500 byte By adam11235 at 2008-2-2
Hi, FxCop has flagged my use of System.Collections.Generic.List<T>, saying I should expose System.Collections.ObjectModel.Collection<T> instead. If I use Collection<T>, I lose the ability to use Anonymous Delegates with the List<T> api. For example, I cannot use: ...

Visual Studio Team System

Site Classified