Skip to content

Commit 9622ebb

Browse files
committed
update
1 parent ca72180 commit 9622ebb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Analyzers/Orchestration/OrchestrationAnalyzer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ void FindInvokedMethods(
323323
IEnumerable<MethodDeclarationSyntax> calleeSyntaxes = calleeMethodSymbol.GetSyntaxNodes();
324324
foreach (MethodDeclarationSyntax calleeSyntax in calleeSyntaxes)
325325
{
326+
// Check if the syntax tree is part of the current compilation before trying to get its semantic model.
327+
// Extension methods from external assemblies won't be in the compilation, so skip them.
328+
if (!semanticModel.Compilation.ContainsSyntaxTree(calleeSyntax.SyntaxTree))
329+
{
330+
continue;
331+
}
332+
326333
// Since the syntax tree of the callee method might be different from the caller method, we need to get the correct semantic model,
327334
// avoiding the exception 'Syntax node is not within syntax tree'.
328335
SemanticModel sm = semanticModel.SyntaxTree == calleeSyntax.SyntaxTree ?

0 commit comments

Comments
 (0)