Analyzing data flow in Roslyn

I have the following code in C #:

public class X : IX
{
   public void E(IX d)
   {
        Data dt = new Data();
        dt.Name = ViewState["a"];
        Count(dt);
   }
}

      

And I use Roslyn to do a few tests related to data flow analysis. So, I pass the first statement ( Data dt = new Data()

) to parse the data flow, and I would like to get as a result that there is a flow from the first to the third statement.

Can this be done in Rosina? Get a path showing the path of exposure?

thank

+3


source to share


1 answer


Take a look at SemanticModel.AnalyzeDataflow

. It can tell you which variables are being read / written / written / etc. In a certain choice.



+3


source







All Articles