0

I'm trying to build an automatic documentation with Roslyn. The application is composed of several sln solutions, several projects, one of them containing a library called by all the others. I want to built an array with the following columns : 1.filepath, 2.method or classname (list of all of them in the solutions),3.called method or classname,4.comments

My problem is that after one week and dozens of searches and tests, I'm not able to build the "method or classname called". I'm able to find methods and classes easily by looping IEnumerable ClassDeclarationSyntax items or IEnumerable MethodDeclarationSyntax items, get comments from trivia but I don't find how can I catch called methods/classes invocations for each of the calling one.

Any help will be appreciated Olivier

olivier57
  • 11
  • 1
  • You could go backwards, namely finding references to your classes and methods as described in https://stackoverflow.com/questions/31861762/finding-all-references-to-a-method-with-roslyn, and then inverting that result. If you really look for *all* methods and class names you'll be outputting things like string methods and Console.Write() etc. – Christopher Hamkins Nov 05 '21 at 10:00
  • Thanks Christopher, I managed to do this with those links https://gist.github.com/vendettamit/5a1a71eba84c741b397a#file-referencefinder-cs but I encountered an empty projects list solution is here https://stackoverflow.com/questions/56104882/msbuildworkspace-solution-contains-no-documents-and-no-projects-on-visual-stud Install-Package Buildalyzer.Workspaces – olivier57 Nov 07 '21 at 08:06

0 Answers0