Open sandboxFocus

Method TryGetSyntaxTreeByPath

TryGetSyntaxTreeByPath(IPartialCompilation, string, out SyntaxTree?)

Gets the syntax tree of an IPartialCompilation that represents the document at a given path.

Declaration
public static bool TryGetSyntaxTreeByPath(this IPartialCompilation compilation, string path, out SyntaxTree? syntaxTree)
Parameters
Type Name Description
IPartialCompilation compilation
string path
SyntaxTree syntaxTree
Returns
Type Description
bool
Remarks

The string counterpart of TryGetSyntaxTree(DocumentKey, out SyntaxTree?), for the boundaries at which a path arrives as a string and nothing else is available: the Roslyn analyzer callbacks and the cross-process contracts. Everything inside those boundaries holds a DocumentKey already.