azure-functions-host: Assembly conflict in Azure in process function v4
@xztmp1 commented on Wed Mar 01 2023
Library name and version
Azure.Data.AppConfiguration
Describe the bug
Azure.Data.AppConfiguration: Method ‘AsPages’ in type ‘FuncAsyncPageable`1’ from assembly ‘Azure.Data.AppConfiguration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation.
Expected behavior
We are converting a .net3.1 inprocess function to .net6 function v4. The assembly is getting resolved properly on the localhost, but when it is deployed to Azure fails with the following error Azure.Data.AppConfiguration: Method ‘AsPages’ in type ‘FuncAsyncPageable`1’ from assembly ‘Azure.Data.AppConfiguration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation.
Actual behavior
Azure.Data.AppConfiguration: Method ‘AsPages’ in type ‘FuncAsyncPageable`1’ from assembly ‘Azure.Data.AppConfiguration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation.
Reproduction Steps
These are the libraries referenced in the project file: “Azure.Identity” Version=“1.4.1” “AzureExtensions.Swashbuckle” Version=“3.3.2” “AspNetCore.HealthChecks.CosmosDb” Version=“3.1.2” “Elevate.CacheServices.Client” Version=“1.1.1” “FluentValidation” Version=“10.3.3” “Microsoft.ApplicationInsights” Version=“2.20.0” “Microsoft.Azure.Cosmos” Version=“3.22.1” “Microsoft.Azure.WebJobs.Extensions.CosmosDB” Version=“3.0.9” “Microsoft.Extensions.Configuration.AzureAppConfiguration” Version=“5.2.0” “Microsoft.Extensions.Logging” Version=“6.0.0” “Microsoft.Extensions.Options.DataAnnotations” Version=“6.0.0” “Microsoft.NET.Sdk.Functions” Version=“4.1.1” “Newtonsoft.Json” Version=“13.0.1”
Environment
No response
@jsquire commented on Wed Mar 01 2023
Thank you for your feedback. Tagging and routing to the team member best able to assist.
@JoshLove-msft commented on Wed Mar 01 2023
I found a StackOverflow post that describes this exact scenario and recommends adding an explicit dependency for Microsoft.Extensions.Configuration.Abstractions to 6.0.0, as the issue appears to be due to an incompatibilty with 7.x which is pulled in transitively via your Microsoft.Extensions.Configuration.AzureAppConfiguration reference. Would you be able to try this workaround?
@fabiocav Is there any other docs we can point customers to for this issue? Is the above workaround accurate to your knowledge? I can also move this issue over to the functions host repo.
@xztmp1 commented on Wed Mar 01 2023
I tried as per your suggestion, but I am getting the same error: Azure.Data.AppConfiguration: Method ‘AsPages’ in type ‘FuncAsyncPageable`1’ from assembly ‘Azure.Data.AppConfiguration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation.
Also this happens only on Azure run time. It works fine on my localhost all the time
@JoshLove-msft commented on Wed Mar 01 2023
@xztmp1 could you share a zip containing a minimal repo?
@xztmp1 commented on Thu Mar 02 2023
Sorry I won’t be able to share the code as it has proprietary information. This is a simple Http trigger function
@JoshLove-msft commented on Thu Mar 02 2023
Given that this appears to be an issue with the dependency resolution happening on the function host, and not locally, I will go ahead and transfer this issue to the functions host repo. The functions team should be able to debug further including having access to any server logs that may help them track down the issue.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (1 by maintainers)
Not sure if it help anyone, but having spent hours trying to solve this I thought I’d share. TLDR: Make sure the publish step in the build pipeline targets the main project instead of **/*.csproj.
Encountered this exact error message on a .NET console application (Hosted service, running as a Windows service).
For me the problem was solved by changing the build pipeline’s publish step from;
projects: '**/*.csproj'to the csproj-file of the default project of the solution, ex:projects: '**/Service.csproj.My theory, after a lot of trial and error and adding direct references to all the
Microsoft.Extensions.*7.0 packages that it complained about, is that the publish step included things thattesthost.exeneeded (or some other build step part), and that conflicted with what the application needed.Was easy to re-create in my scenario, downloading the artifacts from the build pipeline and trying to execute them locally gave the same error. (The error: "Method ‘AsPages’ in type 'FuncAsyncPageable
1'" started showing itself after I'd added direct references to almost everyMicrosoft.Extensions.*`-package out there, so it felt anyway… 😃)I am running into a similar error getting configurations from Azure KeyVault:
This is coming up inconsistently when deploying our function app to Azure; some builds work and some don’t.
Hey, I see that the workaround was to use a different package and method is there a solution to this? we are facing the same issue but not with Azure functions - just regular app with attempt to connect to KV using the extention method AddAzureKeyVault