Recent update: 2008-3-21
<span>How do you ask FxCop to ignore all Globalization Rules while analyzing your assembly? </span>
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 ...
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 ...
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 ...
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 ...
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: ...
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 ...
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 ...
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
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, ...
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 ...
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 ...
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 ...
It is possible to define a common dictionary, but I can't see how a can define a common set of rules.
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
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. ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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); ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
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? ...
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 ...
Can anybody tell me the new function for ISMEthodCall() in older version? Thanks
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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: ...