Hi, I would like to use the FXCop introspection API to create a custom rule that verifies the following:
in MethodA, the code sets a property B on a static class C to value D :
void MethodA() { C.B=D; }
what i would like is that inside override ProblemCollection Check(member m)
I want to check:
if m == MethodA
{
Assert: m assign...
I have the following code:
[SuppressMessage( "Microsoft.Performance", "CA1800:DoNotCastUnnecessarily" )]
private static void SetTestConnectionString( Component table )
{
if( table is Object1 )
{
fn1( (Object1)table );
}
// ... a few more if statements for different Classes
}
However, when I run FxCop over this ...
We are currently using TFS 2008 for source control and continuous integration.
We use FXCop to check for checking performance and security warnings. The Architect or senior developer runs FX Cop at the end of a sprint or before a delivery.
We would like this to run as part of the CI and fail the build if there is a warning, what is the...
Hey all,
Can anyone point me to an fxcop rule for identifing "string ==" usage. For example:
string s = "abc";
if (s == "def") {
// do somethign
}
I want the "if" statement raised as an error. Roughly speaking I want to always be using string.compare with the appropriate culture.
Thanks!
...
Possible Duplicate:
Exclude complete namespace from FxCop code analysis?
I'm running FxCop as a post-build step of my class library project and it's picking up violations from the LINQ-to-SQL generated code.
I am running FxCop as follows (line breaks added for clarity):
<PostBuildEvent>
"$(SystemDrive)\Utils\DeveloperTools...
I'm writing a custom rule to verify the constructor of any control type calls initialize component.
But when I hit these 2 edge cases:
public Form1(int? testInt,bool testBool,bool testBool2)
: this(false)
{
Action init = ( ) => InitializeComponent( );
init();
}
public Form1(int? testInt, bool testBoo...
Hi!
When not using an FxCop project, this works:
"c:\Program Files\Microsoft FxCop 1.35\fxcopcmd.exe" /file:SiteSeeker.Core\bin\Release\SiteSeeker.Core.dll /file:SiteSeeker.CoreTest\bin\Release\SiteSeeker.CoreTest.dll /file:SiteSeeker.Example\bin\SiteSeeker.Example.dll /file:SiteSeeker.Web.WebForms\bin\Release\SiteSeeker.Web.WebForms.d...
I've got code that catches everything and logs it. I don't normally do this, but I'm writing an HTTP handler and want to return an appropriate HTTP code. Anyway, I'm putting the following at the top of my method:
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "We just log the exception ...
I'm thinking of trying the following ideas:
System.IO
Package.GetGlobalService(typeof(EnvDTE.DTE))
public override Microsoft.FxCop.Sdk.ProblemCollection Check(Microsoft.FxCop.Sdk.Resource resource), while blocking on the thread that does Check(TypeNode type) until the resource reading completes.
Anyone know if any of these will be re...
Hi,
Placing this in our AssemblyInfo.cs:
[module: SuppressMessage("Microsoft.Performance",
"CA1822:MarkMembersAsStatic", Scope="member",
Target="Foo.CoreTest.StringUtilTest.CapitalizeNull():System.Void")]
Results in CA1822 being excluded for the method Foo.CoreTest.StringUtilTest.CapitalizeNull. However we would like CA1822 to be exc...
Hi!
I would like to exclude CA1822:MarkMembersAsStatic from the CoreTest assembly as the NUnit test methods cannot be converted to static methods as NUnit won´t execute them if I do. In the other assemblies I would like to have this rule as I have found it valuable.
If it is possible I do not like to add a SuppressMessage to each test ...
I would like to validate our code and check if every Thread that we execute runs in try catch block.
A valid sample:
Thread loadDataThread = new Thread(new ThreadStart(LoadData));
public void LoadData()
{
try {/*do something*/}
catch(Exception ex) { /*Handle exception*/ }
}
Not valid sample:
Thread loadDataThread = new Thread(...
I am trying to incorporate FxCop directly into my build. I am using the MSBuild Community Tasks. I have a targets file like this:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FxCopToolPath Condition="'$(FxCopToolPath)' == ''">$(MetaSharpL...
Hello
I need to run fxcop on a project that references an obfuscated commercial assembly (from dotnetremoting.com). Fxcop tries to load the obfuscated assembly and fails...
I have got exactly the same problem with Mono Gendarme. It also tries to analyse referenced assemblies and fails.
Thanks in advance for your responses
Alex
...
All our developers are using VS2010 professional so code analysis is not available. I want them to use FxCop to analyze the code before checking in. I have gone through the rules and disabled a bunch of them and added couple of them. I want all the developers to use same set of rules since it will be the rules used in MSBuild. How do I d...
We are trying to get our TeamCity 5.1 installation to use our FXCop project file. It apparently does not like the newest version, V10:
[08:26:33]: Failed loading FxCop project.
[08:26:33]: Error text: This project file is version 10.0 but the current application version is 1.36. Please download a more recent version of FxCop to open th...
Try as I might to keep [SuppressMessage]s to a minimum in the codebase, new ones continue to get introduced. I would like some way to say in the code "I've reviewed this [SuppressMessage] and it is 'acceptable'".
One thought was to create my own My.CodeAnalysis.SuppressMessageAttribute class which inherits from System.Diagnostics.CodeA...
I have a foreach loop that declares a variable I never use, but I don't know how to get around it.
foreach (string i in stringCollection){
some other stuff
}
I never use "i" - but I need an iterator in the loop. So how do I get rid of this error?
...
<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification:="Needs function to return two values.")> _
<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification:="Needs function to return two values.")> _
I am trying ...
hi how can i write a custom rule to identify an expression in an if condition? Kindly help me in this.
...