i have to implement custom rule for
"Use two blank lines to separate method implementations and class declarations."
How can i achieve this functionality,i am able to retrive class name and method name but not able to get the line number differences
Pranay ChandraMonday, April 02, 2012 2:02 PM
This would be a better candidate for a StyleCop rule than an FxCop rule. StyleCop examines source code to enforce style rules (which is what you seem to want to write); FxCop examines IL to enforce correctness rules. Line numbers are not present in IL. FxCop can load line numbers from a PDB file when one is available but, even when this is the case, it will contain line numbers only for executable instructions, which declarations are not.Monday, April 02, 2012 3:07 PM
Agreed with Nicole, StyleCop is going to give you the proper solution for this. To add to Nicoles comments, as FxCop also operates on compiled code, it will not be able to translate certain optimization back to line numbers or it will see additional code generated by the compiler in order for the language features to work.
As StyleCop operates on the uncompiled sourcecode it's your best target for solving your requirements.
My blog: blog.jessehouwing.nlMonday, April 02, 2012 3:55 PM
Check out: http://stylecop.codeplex.com/
There is a discussion forum there as well for questions.
And this is a tutorial on how to write rules for StyleCop: http://scottwhite.blogspot.com/2008/11/creating-custom-stylecop-rules-in-c.html
My blog: blog.jessehouwing.nlTuesday, April 03, 2012 8:33 AM