After a build of my .NETCore 3.1 Function App using DurableTask v2.2.1 with the DurableTask.Analyzers v0.2.1, I see warnings in the build output: CSC : warning AD0001: Analyzer 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer' threw an exception of type 'System.ArgumentException' with message 'Syntax node is not within syntax tree'.
No build warnings, or specific (DFxxx) warnings related to the DurableTask Analyzer.
Copied from build output:
1>------ Build started: Project: DurableFunctions.Demo.DotNetCore, Configuration: Debug Any CPU ------
1>CSC : warning AD0001: Analyzer 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer' threw an exception of type 'System.ArgumentException' with message 'Syntax node is not within syntax tree'.
1>CSC : warning AD0001: Analyzer 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer' threw an exception of type 'System.ArgumentException' with message 'Syntax node is not within syntax tree'.
1>CSC : warning AD0001: Analyzer 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer' threw an exception of type 'System.ArgumentException' with message 'Syntax node is not within syntax tree'.
1>DurableFunctions.Demo.DotNetCore -> C:\dev\git\personal\demos-azure-durable-functions\src\DurableFunctions.Demo.DotNetCore\bin\Debug\netcoreapp3.1\bin\DurableFunctions.Demo.DotNetCore.dll
1>Done building project "DurableFunctions.Demo.DotNetCore.csproj".
2>------ Build started: Project: DurableFunctions.Demo.DotNetCore.Test, Configuration: Debug Any CPU ------
2>DurableFunctions.Demo.DotNetCore.Test -> C:\dev\git\personal\demos-azure-durable-functions\src\DurableFunctions.Demo.DotNetCore.Test\bin\Debug\netcoreapp3.1\DurableFunctions.Demo.DotNetCore.Test.dll
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
I temporarily removed the dependency to the Analyzer by modifying the DurableTask extension nuspec:
.NETFramework4.6.1, and one for .NETStandard2.0.Oh, I've seen this issue before. I know exactly what this is.
If you're curious, this issue has to do with a recent change in the FunctionAnalyzer that passes around semantic models. I encountered this when I made the changes to the OrchestratorAnalyzer and added a method (GetSyntaxTreeSemanticModel, admittedly not the best name I've ever given a method) to get the SemanticModel for the syntax tree.
Thank you so much for letting me know about this! I'll fix this and try to have another analyzer patch release really soon.
Most helpful comment
Oh, I've seen this issue before. I know exactly what this is.
If you're curious, this issue has to do with a recent change in the FunctionAnalyzer that passes around semantic models. I encountered this when I made the changes to the OrchestratorAnalyzer and added a method (GetSyntaxTreeSemanticModel, admittedly not the best name I've ever given a method) to get the SemanticModel for the syntax tree.
Thank you so much for letting me know about this! I'll fix this and try to have another analyzer patch release really soon.