Azure函数:值不能为null。参数名称:来源

时间:2019-01-17 20:02:55

标签: c# .net azure-functions azure-webjobs

最近,当我调用Azure函数时,每当我尝试向AddGroup函数发出HTTP请求时,都会看到此异常。

  • 它一直有效,直到我更新了一些NuGet软件包(特别是Newtonsoft JSON 11.0.2)
  • 在本地运行该功能时效果很好-与Azure有关
  • 我推送了新代码并多次重新启动了功能
  • 这里的其他问题说这可能是连接字符串问题,但同样,它在我的本地计算机上也有效,而且我还没有碰过连接字符串
  • 当我尝试连接云调试器时,该异常会在我的代码中遇到任何断点之前显示出来。

有什么想法吗?

Time 11:04:02 AM
Exception type Microsoft.Azure.WebJobs.Host.FunctionInvocationException
Exception message Exception while executing function: AddGroup <--- Value cannot be null. Parameter name: source
Host.Results
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: AddGroup ---> System.ArgumentNullException: Value cannot be null.

Parameter name: source

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.FunctionInvocationFilterInvoker.<InvokeAsync>d__9.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<InvokeAsync>d__24.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__23.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__22.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__16.MoveNext()

   --- End of inner exception stack trace ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__16.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__13.MoveNext()

1 个答案:

答案 0 :(得分:1)

I figured it out- I had a NuGet package conflict. One of my projects was trying to reference version Newtonsoft Json 9.0.1 (which the Azure Functions SDK depends on) and also 11.0.2, which another project wanted. I wound up having the other project also use the 9.0.1 version of the package.