From 6ec4d4bdf4ebc9e40d63cbc783638d2b13bf7fc1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 20:57:50 +0000 Subject: [PATCH 1/3] Initial plan From fcc9f380d23f2a1207ec150e3b8c8194c460a183 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:05:44 +0000 Subject: [PATCH 2/3] Fix SyntaxTree is not part of the compilation exception in analyzers Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> --- src/Analyzers/Orchestration/OrchestrationAnalyzer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs b/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs index bfffb57a..b6b04db4 100644 --- a/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs +++ b/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs @@ -330,8 +330,15 @@ void FindInvokedMethods( { // Since the syntax tree of the callee method might be different from the caller method, we need to get the correct semantic model, // avoiding the exception 'Syntax node is not within syntax tree'. + // We also need to check if the syntax tree is part of the compilation to avoid 'SyntaxTree is not part of the compilation' exception. + if (!this.Compilation.ContainsSyntaxTree(calleeSyntax.SyntaxTree)) + { + // Skip this syntax tree if it's not part of the compilation (e.g., from external assemblies) + continue; + } + SemanticModel sm = semanticModel.SyntaxTree == calleeSyntax.SyntaxTree ? - semanticModel : semanticModel.Compilation.GetSemanticModel(calleeSyntax.SyntaxTree); + semanticModel : this.Compilation.GetSemanticModel(calleeSyntax.SyntaxTree); this.FindInvokedMethods(sm, calleeSyntax, calleeMethodSymbol, rootOrchestration, reportDiagnostic); } From 650cfa67af533afcd69ef8fcc9ac79ff3bf62756 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:07:37 +0000 Subject: [PATCH 3/3] Improve comment accuracy based on code review feedback Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> --- src/Analyzers/Orchestration/OrchestrationAnalyzer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs b/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs index b6b04db4..50013630 100644 --- a/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs +++ b/src/Analyzers/Orchestration/OrchestrationAnalyzer.cs @@ -333,7 +333,7 @@ void FindInvokedMethods( // We also need to check if the syntax tree is part of the compilation to avoid 'SyntaxTree is not part of the compilation' exception. if (!this.Compilation.ContainsSyntaxTree(calleeSyntax.SyntaxTree)) { - // Skip this syntax tree if it's not part of the compilation (e.g., from external assemblies) + // Skip this syntax tree if it's not part of the current compilation context (e.g., from referenced projects or source generators) continue; }