I have consolidated some old WebJobs and worker roles into a new Azure Function project. I have used Azure Functions before with no trouble. This project has a persistent problem I have been battling for a few days. It throws the following error in the console window:
System.Private.CoreLib: Exception has been thrown by the target of an invocation. Microsoft.Azure.WebJobs.Extensions.Storage.Queues: Could not load file or assembly ‘System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The system cannot find the file specified.
Value cannot be null. (Parameter ‘provider’)
This error showed up with an old version of the project. I rebuilt it from scratch using .NET 6.0. It worked for a while but then the error returned. The current environment is:
Visual Studio 17.11.5,
Azure Functions and Web Jobs tools 17.11.231.19466
I have tried numerous combinations of NuGet package versions. Relevant (I think) NuGet packages are:
Microsoft.Azure.WebJobs.Extensions.Storage 5.3.3,
Microsoft.NET.Sdk.Functions 4.5.0"
I have also tried removing Microsoft.Azure.WebJobs.Extensions.Storage and replacing it with Microsoft.Azure.WebJobs.Extensions.Storage.Queues with no result.
I have searched extensively and found no reference matching my error. Any suggestions would be greatly appreciates.
Thanks in advance,
Robert Keith
2
Answers
Please try "Microsoft.Azure.WebJobs.Extensions.Storage" "5.3.2" Microsoft.NET.Sdk.Functions" Version="4.4.0"
Make sure that you are using version
4.x
of the AzureFunctions runtime:<AzureFunctionsVersion>v4</AzureFunctionsVersion>
should be present in your .csproj file.Older runtime versions are not compatible with .NET 6 and runtime libraries in version
6.x.x
are therefore missing, which could explain your error.See the official Migrate apps from Azure Functions version 3.x to version 4.x documentation.