I get this warning while building my Azure functions project. There aren't much details in the the stack trace. Can anyone please help me make sense of this error?
> CSC : warning AD0001: Analyzer
> 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer'
> threw an exception of type 'System.NullReferenceException' with
> message 'Object reference not set to an instance of an object.'.
Here's the stacktrace if it helps:
> Severity Code Description Project File Line Suppression State Detail
> Description Warning AD0001 Analyzer
> 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer'
> threw an exception of type 'System.NullReferenceException' with
> message 'Object reference not set to an instance of an
> object.'.
1 Active Analyzer
> 'Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer'
> threw the following exception: 'Exception occurred with following
> context: Compilation:
>
> System.NullReferenceException: Object reference not set to an instance
> of an object. at
> Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.ArgumentAnalyzer.TryGetInputFromDurableContextCall(SemanticModel
> semanticModel, SyntaxNode definitionInput, SyntaxNode&
> inputFromContext) at
> Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.ArgumentAnalyzer.TryGetDefinitionInputType(SemanticModel
> semanticModel, ActivityFunctionDefinition functionDefinition,
> ITypeSymbol& definitionInputType) at
> Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.ArgumentAnalyzer.ReportProblems(CompilationAnalysisContext
> context, SemanticModel semanticModel, IEnumerable`1
> availableFunctions, IEnumerable`1 calledFunctions) at
> Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers.FunctionAnalyzer.RegisterAnalyzers(CompilationAnalysisContext
> context) at
> Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c.<ExecuteCompilationActionsCore>b__46_1(ValueTuple`2
> data) at
> Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer
> analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
> ----- '.
The DurableTask Analyzer is a Roslyn analyzer that checks your code for inconsistencies when working with Durable Functions to help you prevent common mistakes. It is part of the DurableFunctions extension now.
Are you using the latest version of Durable Functions, v2.2.1? This version contains the most recent version of the DurableTask Analyzer v0.2.1 as a dependency and it appears there is a bug in there which causes the exception.
You could remove the Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers
dependency as a workaround to avoid getting this exception as follows:
C:\Users\%User%\.nuget\packages\microsoft.azure.webjobs.extensions.durabletask\2.2.1
nuspec
file and comment out (or remove) the two dependencies for Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers
, one for .NETFramework4.6.1
, and one for .NETStandard2.0
.I get the same error as you btw. I will check the issues at GitHub and will add a new one there if it hasn't been done yet.
Update: GH issue has been created.