Parsing method body

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.StatementsIdea does not contain the text of the statement.
 Is there any other method to get the result
Thanks


Answer this question

Parsing method body

  • SteveMeyns

    Thanks .
    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

    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.

    Michael

  • Jim Kelly

    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.

    Michael Fanning
    VSTS Development: Code Analysis

  • Parsing method body