azure-functions-core-tools: Method not found: 'Microsoft.Extensions.Primitives.StringValues Microsoft.AspNetCore.Http.IQueryCollection.get_Item(System.String)'

Keep getting this error when I create a new function on: Azure Functions Core Tools (2.0.3) Function Runtime Version: 2.0.12115.0 VS 2017 15.8.5. This is the plain vanilla Function1 type of project. Thanks Herald



[10/2/2018 8:12:11 PM] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=dd86ca07-b93b-4bbb-b868-d9e0b200b45e)
[10/2/2018 8:12:12 PM] Executed 'Function1' (Failed, Id=dd86ca07-b93b-4bbb-b868-d9e0b200b45e)
[10/2/2018 8:12:12 PM] System.Private.CoreLib: Exception while executing function: Function1. afunc_datafeeds_airports: **Method not found: 'Microsoft.Extensions.Primitives.StringValues Microsoft.AspNetCore.Http.IQueryCollection.get_Item(System.String)'.**
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLH8KDB621VD", Request id "0HLH8KDB621VD:00000001": An unhandled exception was thrown by the application.
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Function1 ---> System.MissingMethodException: Method not found: 'Microsoft.Extensions.Primitives.StringValues Microsoft.AspNetCore.Http.IQueryCollection.get_Item(System.String)'.
   at afunc_datafeeds_airports.Function1.Run(HttpRequest req, ILogger log)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at afunc_datafeeds_airports.Function1.Run(HttpRequest req, ILogger log)
   at lambda_method(Closure , Function1 , Object[] )
   at Microsoft.Azure.WebJobs.Host.Executors.TaskMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\TaskMethodInvoker.cs:line 21
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 63
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 561
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 508
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstance instance, ParameterHelper parameterHelper, IFunctionOutputDefinition outputDefinition, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 444
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstance instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 249
   --- End of inner exception stack trace ---
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstance instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 293
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 89
   at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ExceptionDispatchInfoDelayedException.cs:line 28
   at Microsoft.Azure.WebJobs.JobHost.CallAsync(String name, IDictionary`2 arguments, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\JobHost.cs:line 231
   at Microsoft.Azure.WebJobs.Script.WebHost.Features.FunctionExecutionFeature.ExecuteAsync(HttpRequest request, CancellationToken cancellationToken) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Features\FunctionExecutionFeature.cs:line 67
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware.GetResultAsync(HttpContext context, IFunctionExecutionFeature functionExecution) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\FunctionInvocationMiddleware.cs:line 147
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware.Invoke(HttpContext context) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\FunctionInvocationMiddleware.cs:line 56
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.HttpThrottleMiddleware.Invoke(HttpContext httpContext, IOptions`1 httpOptions, HttpRequestQueue requestQueue, HostPerformanceManager performanceManager, IMetricsLogger metricsLogger) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\HttpThrottleMiddleware.cs:line 66
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.HomepageMiddleware.Invoke(HttpContext context) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\HomepageMiddleware.cs:line 34
   at Microsoft.AspNetCore.Buffering.ResponseBufferingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.HttpExceptionMiddleware.Invoke(HttpContext context) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\HttpExceptionMiddleware.cs:line 23
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.AppServiceHeaderFixupMiddleware.Invoke(HttpContext httpContext) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\AppServiceHeaderFixupMiddleware.cs:line 35
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.ScriptHostRequestServiceProviderMiddleware.Invoke(HttpContext httpContext, WebJobsScriptHostService manager) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\ScriptHostRequestServiceProviderMiddleware.cs:line 36
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.HostWarmupMiddleware.Invoke(HttpContext httpContext) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\HostWarmupMiddleware.cs:line 34
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.HostAvailabilityCheckMiddleware.Invoke(HttpContext httpContext, IScriptHostManager scriptHostManager) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\HostAvailabilityCheckMiddleware.cs:line 47
   at Microsoft.Azure.WebJobs.Script.WebHost.Middleware.EnvironmentReadyCheckMiddleware.Invoke(HttpContext httpContext, IScriptWebHostEnvironment webHostEnvironment) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\Middleware\EnvironmentReadyCheckMiddleware.cs:line 29
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 1598.447ms 500

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@ltouro @aherrick .NET Core 3.0/ASP.NET Core 3.0 dependencies are supported in the Azure Functions 3.x preview. You can find more details here: https://github.com/Azure/app-service-announcements/issues/200

Closing this as the original issue has been addressed. Please open new issues with details if you have additional questions or continue to run into problems.

@ahmelsayed I think Microsoft.Extensions.Configuration was there in my project, before upgrading the Azure Function tool in VS. Obviously it is used to retrieve config values from local files. The strange part was that the same Azure Function would work fine if deployed in Azure, but would fail if run/debugged locally, so it had to do with the Azure Functions Core Tools (2.0.3).

It is very possible that the Microsoft.Extensions.Configuration it is added to the Function when created in Visual Studio via the latest project template. But I cannot fully attest to that since I now run the latest version of Visual Studio (VS 2017 15.8.5) and the current template does not add any libraries.

Thanks

I had this same issue - for me this was fixed by downgrading Microsoft.Extensions.Configuration nuget package from 2.2.0 (preview2) to 2.1.1 (latest stable). Possibly a bug in 2.2.0. Might not be the same cause for you, perhaps with a different package.