MSDN Conference's Material
The presentation of the conference about "Testing and guarantee of quality with Visual Studio Team System" that we gave at Microsoft last Thursday can be downloaded from Rodolfo's blog.
Just technical stuff.
The presentation of the conference about "Testing and guarantee of quality with Visual Studio Team System" that we gave at Microsoft last Thursday can be downloaded from Rodolfo's blog.
Publicado por Unknown en 20:25 1 comentarios
The code analysis feature that ships with Visual Studio Team System (VSTS), FxCop, comes with a rich API to write custom rules. Since the API almost lacks of documentation, I've been struggling for a while before I got my custom rules to work. That's why I've decided to write this short guide on how to make your own rules: (It is required that you have the VSTS version of Visual Studio 2005 intalled)
using System;
using Microsoft.Cci;
using Microsoft.FxCop.Sdk;
using Microsoft.FxCop.Sdk.Introspection;
namespace Microsoft.FxCop.Rules.Design{
internal abstract class DesignIntrospectionRule
: BaseIntrospectionRule {
protected DesignIntrospectionRule(string name)
: base(name,
"Microsoft.FxCop.Rules.Design.DesignRules",
typeof(DesignIntrospectionRule).Assembly) {
}
public override void AfterAnalysis(){
DesignRuleUtilities.Clear();
}
}
}
internal sealed class AbstractTypesShouldNotHaveConstructors
: DesignIntrospectionRule {
public AbstractTypesShouldNotHaveConstructors()
: base("AbstractTypesShouldNotHaveConstructors") {
}
public override ProblemCollection Check(TypeNode type) {
if (!type.IsAbstract) {
return null;
}
for (int num1 = 0; num1 < type.Members.Length; num1++) {
InstanceInitializer initializer1 = type.Members[num1]
as InstanceInitializer;
if ((initializer1 != null) && initializer1.IsPublic) {
Resolution resolution1 = base.GetResolution(new string[]
{ type.Name.Name });
Problem problem1 = new Problem(resolution1);
base.Problems.Add(problem1);
break;
}
}
return base.Problems;
}
...
}
<Rules FriendlyName="Design Rules">
...
<Rule TypeName="AbstractTypesShouldNotHaveConstructors"
Category="Microsoft.Design"
CheckId="CA1012">
<Name>Abstract types should not have constructors</Name>
<Description>Public constructors for abstract types do
not make sense because you cannot create instances of
abstract types.</Description>
<Url>/Design/AbstractTypesShouldNotHaveConstructors.html</Url>
<Resolution>Change the accessibility of all public constructors
in '{0}' to protected.</Resolution>
<Email>
</Email>
<MessageLevel Certainty="95">CriticalWarning</MessageLevel>
<FixCategories>NonBreaking</FixCategories>
<Owner />
</Rule>
...
</Rules>
Publicado por Unknown en 15:20
Etiquetas: code analysis
This month I will take a little part in an MSDN conference at Microsoft Argentina. Along with Diego Gonzalez and Rodolfo Finochietti we will speak about Testing and quality assurance with Visual Studio Team System (VSTS).
It is the first time I am backwards the blackboard at a Microsoft's conference, so I am very enthusiastic about that. I hope to see everyone there. It is on August 24th and here's the link to register.
Publicado por Unknown en 21:08