I am trying to get "content" (SyntaxNodes) of a method when all I have is a SyntaxNode and SyntaxNodeAnalysisContext received by RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.InvocationExpression). Method (SyntaxNode) implementation is in another file, another class. I tried looking into Semantics but I do not really understand how it works. Does anybody know how it can be achived? Thank you in advance.
Asked
Active
Viewed 400 times
0
-
If you have a `ExpressionInvocationSyntax` or something else that invoke or access your method you can try to get the Declared symbol from SemanticModel `SemanticModel.GetDeclaredSymbol(...) ?? SemanticModel.GetSymbolInfo(...).Symbol` and using the relevant symbol try to find declaring syntax by `ISymbol.DeclaringSyntaxReferences` – George Alexandria Oct 05 '18 at 18:03
-
1Possible duplicate of [Roslyn Get Method Declaration from Invokation](https://stackoverflow.com/questions/45361709/roslyn-get-method-declaration-from-invokation) – Kris Vandermotten Dec 19 '18 at 17:08