Hello
I have base type "Base" in assembly "A" and derived type "Child" in assembly "B".
I'm using FxCop to find in assembly "B" types derived from "Base" like this:
var baseAssemblyNode = AssemblyNode.GetAssembly("A.dll"), true, true, false);
var baseType = baseAssemblyNode.Types.Single(t => t.Name.Name == "Base");
var assemblyNode =...
I'll prefix by saying that I understand that both Code Analysis and StyleCop are meant as guidelines, and many people chose to ignore these anyway. But having said that, I'd like to see what the general consensus is with regard to these two rules.
Rule CA1500 says don't make parameter names and private field names the same.
Rule SA130...
I try running code analysis on my solution. It fails with a generic error message that doesn't give any information. What is the best way to troubleshoot this sort of thing? For example is there a log file?
...
Hi,
how can I do suppress FxCop warnings for whole type?
I have
Hi guys,
how to suppress warnings for all members in type
namespace ConsoleApplication1
{
public static class Serializer<T>
{
public static string Serialize(T obj)
{
return string.Empty;
}
public static T Deserialize...
I'm learning T4, and am successfully interrogating my custom class for its member.
What I need however, is to bring out only the properties that I created, like FirstName, Surname, and Postcode.
Here's an example of what I'm actually getting when I use :
foreach(Microsoft.Cci.Member member in class.Members)
{
if( member.IsPublic ...
I'm getting a code analysis warning on some of my unit tests:
WidgetManagerTests.cs (40): CA2000 :
Microsoft.Reliability : In method
'WidgetManagerTests.TestInitialize()',
call System.IDisposable.Dispose on
object 'new
ContainerControlledLifetimeManager()'
before all references to it are out of
scope.
I'm using Unity ...
Premise
When using code analysis (or fxCop) with C# optional parameters you can get a warning of CA1026. The short reason1 for this is not suppling all parameters with a default value.
The declaration below rightly generates this warning
public Color GetColor(bool red, bool blue = true, bool green = true)
However there is a situatio...
Hi,
I have a piece of code which deals with customers stored in database. There is an object Customer, and it has, among other, two properties of type byte[]: one property for password salt, the second one for password hash.
Checking the code with FxCop, I see that it complains (CA1819, Performance Rules) that:
"Properties that ret...
I get the following unhelpful error while building my .NET project when Code Analysis runs. It happens both in Visual Studio and building from the command line with MSBuild.
* 1 total analysis engine exceptions.
MSBUILD : error : CA0001 : The given key was not present in the dictionary.
Any ideas on what is broken?
Edit:
Have fo...
Is it possible to have FxCop ignore/skip analyzing of internal interfaces and classes in a given assembly?
I'm not interested in specifying all public interfaces and classes to FxCop (as analyze only these). This would mean that every time a new public type is added I have to go to FxCop's configuration and add this new type.
...
I need to run FxCop with CruiseControl.NET 1.5 for continuous Integration. I have included the buildscript with the command to execute the FxCop project file.
When I Build the project in CruiseControl.NET, I get the following error.
C:\CPLBuildScripts\CheckpointLearning\FullBuild\Web.BuildScript.proj (19,5):
errorMSB3073: T...
Below are my custom rule assembly and embeded xml resources file. My assembly name and the default namespace name are both MyRules. I just cannot figure out why it could be SO SO difficult to add a custom fxcop rule? I always got the "no rules were selected" error. I am going crazy...
using System;
using System.Collections.Generic;
usin...
does anyone know how to or can provide the syntax for running FxCop via command line.
i want to set a task to run a defined rules.fxcop file (this is a empty project that i made with only a select set of rules enabled to reduce noise and check for things i am interested in)
can someone explain how i can accomplish this...
i am guessin...
On a continued mission to clean up the codebase I inherited, via stylecop and fxcop, and one of the warnings from fxcop was CA1801: Parameter 'value' of Something.MyProperty.set(string) is never used. Remove the parameter or use it in the method body.
The code it complains about is:
public class Something : ISomeInterface
public ne...
This rule indicates that P/Invokes should not be made public. My question is why? A caller can trivially create their own declaration within their own assembly to make the exact same call. A caller could just write a C library to call the API. What benefit, security or otherwise, is gained by making these declarations internal?
...
Hello everyone !
I would like to use fxcop in a continuous build, and almost every class in my project are analysed, but there is some exception (assembly load) and it makes the fxcopcmd exit with error code 8. So the continuous build fails, because of this error code.
I want the build to finish, so that i can present all the results, ...
I am trying to use the FxCop build runner in TeamCity (5.1.2) and while I get the analysis output, the errors all show '0' for the code line link and I can't open anything in the IDE using that link.
I am assuming (since I have not been able to get any further) that I should be able to see the offending lines of code.
Currently, I have...
Hi,
While analyzing in FXCOP, it show Locate assembly eference window.
Do I need to do any setting.
Thanks for help,
Jaydeep
...
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;
}
how can I write this?
also how can I debug through a rule?
...
Due to certain reasons, in our ASP.NET web application, it is not recommended to use Response.Redirect("something", True). It should be used with False for the endResponse parameter. We want to enforce this with a custom FxCop rule.
I've managed to find the usages of Response.Redirect, but now I want to find the value of the endResponse ...