Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Custom Rules » FAQ   (RSS)

FAQ: How do I debug a custom rule?

While writing your custom rule, you will likely come across a need to debug it and work out why it's behaving in a particular manner. Debugging within FxCop Debugging a custom rule within the FxCop UI is actually quite easy. To do so, simply: Open the

FAQ: How do I get the SourceContext for a local?

I want to fire on the naming of a local, however, whenever I pass the local to the Problem constructor, the source information for the method is always used. How do I get FxCop/Code Analysis to use the source information for the local instead? Because

FAQ: When looking at the names of locals in a custom rule, why do I see strange names such as 'CS$1$0000' and 'VB$1$0000'?

Previously we showed you how to access the locals or variables of a method. Once you started to run your rule over an assembly, you might start to notice strange locals with names that start with 'CS$' and 'VB$'. These are compiler generated locals that

FAQ: Can I create custom rules that target both Visual Studio and FxCop? [David Kean]

I have users using both Visual Studio and FxCop, and I want to create custom rules that run on both. Is this possible? Although in the future we do plan on making it easier to move custom rules between Visual Studio and FxCop, currently you must recompile

FAQ: How do I access the locals of a method in a custom rule? [Michael Fanning, David Kean]

Note: The custom rules API is likely to change in the next version of FxCop/Visual Studio. Currently, the locals of a method are stored in a pseudo-instruction in the method's InstructionList. We plan to change this in a future version of the tool and

FAQ: How do I integrate custom rules with Visual Studio? [David Kean]

Update: To have rules target both Visual Studio and FxCop, see the following entry: FAQ: Can I create custom rules that target both Visual Studio and FxCop? Although not officially supported or documented, the Managed Code Analysis (FxCop) feature available
 
Page view tracker