Hi I am trying to parse a method body in a custom rule for FXCOP and filter some words. e.g. void SomeMethod() { statement1; statement2; statement3; } The method.Body.Statements does not contain the text of the statement. Is there any other method to get the result Thanks
That is correct. If you need to perform source-based analysis, you could consider writing a VS add-in and using the C# code model to do the work you're interested in.
FxCop is a binary checker. The abstract syntax trees exposed by Method.Body are raised from IL. So, any information that's directly tied to source is lost. We are considering adding a source-based analysis in the future, but unfortunately it does not exist today.
Parsing method body
SteveMeyns
This means I can not filter some words and/or phrases from my code base by designing a rule, at present,right
Rajan
Steve Jensen
Michael
Jim Kelly
Michael Fanning
VSTS Development: Code Analysis