azure-sdk-for-net: [BUG] Internal Error with AsPages Method not found Exception

Library name and version

Azure.Security.KeyVault.Secrets 4.5.0.0 Azure.Extensions.AspNetCore.Configuration.Secrets 1.2.2

Describe the bug

our team moved from connecting directly to Azure Key Vault to use the nuget package Azure.Extensions.AspNetCore.Configuration.Secrets and use the AddAzureKeyVault(URI, AzureCredential) method. when we did that the app threw the following exception: Method ‘AsPages’ in type ‘FuncAsyncPageable`1’ from assembly ‘Azure.Security.KeyVault.Secrets, Version=4.5.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation. attempts to reduce Azure.Security.KeyVault.Secrets to 4.3 and 4.2 did not help. we also found this error in another open issue without solution: https://github.com/Azure/azure-functions-host/issues/9127

Expected behavior

the expected beheviour it that we will manage to connect

Actual behavior

internal exception is thrown

Reproduction Steps

remove all non microsoft related nuget packages - yet still the issue reproduces it has not reproduced on other services

Environment

.net 6 (migration from .net 4.6.2)

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 2
  • Comments: 40 (13 by maintainers)

Most upvoted comments

Also have the same issiue in Azure Container Apps. Anyone was able to find solution of workaround?

Unhandled exception. System.TypeLoadException: 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.
at Azure.Core.PageResponseEnumerator.CreateAsyncEnumerable[T](Func`2 pageFunc)
at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsAsync(SettingSelector selector, CancellationToken cancellationToken)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass29_1.<<LoadSelectedKeyValues>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadSelectedKeyValues(ConfigurationClient client, CancellationToken cancellationToken)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass28_0.<<InitializeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass41_0.<<ExecuteWithFailOverPolicyAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.ExecuteWithFailOverPolicyAsync[T](IEnumerable`1 clients, Func`2 funcToExecute, CancellationToken cancellationToken)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.ExecuteWithFailOverPolicyAsync(IEnumerable`1 clients, Func`2 funcToExecute, CancellationToken cancellationToken)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.InitializeAsync(Boolean ignoreFailures, IEnumerable`1 availableClients, CancellationToken cancellationToken)
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
at Microsoft.Extensions.Configuration.AzureAppConfigurationExtensions.AddAzureAppConfiguration(IConfigurationBuilder configurationBuilder, Action`1 action, Boolean optional)
at Program.<Main>$(String[] args)

Hi I prepared sample app. If following code is deployed to ACA then app end up with mentioned error. On dev enviroment it works ok.

Regards

SAMPLE.zip

@yossika-tr : Thank you for sharing the trace and the additional package list. The traces confirm that the expected versions of Azure libraries were loaded into the primary AppDomain and that the known down-level references were resolved to the pinned versions. There also appear to be number of other dependencies for the app, many of which look like other internal packages or potentially projects in the solution.

Unfortunately, that has not given any further hints to the root cause nor insight into how to reproduce. We continue to be unable to reproduce the error across different target frameworks, project types, and host environments - including the container-based hosts mentioned by folks commenting on this issue.

At this point, we’re effectively blocked without repro. Our best hope is that one of the folks who is experiencing this error can share a small, self-contained project that reproduces the error so that we can analyze.

We found the same issue as @yossika-tr when he said: “the strangest thing here is that we also didn’t manage to reproduce it on other apps so its very unclear where the origin of this error comes from”

We have two apps with identical Nuget packages and one of them gave us this error (until the work around I mentioned in the duplicate bug report mentioned in this) and one of them didn’t.