question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The addition of ConfigurationManager 6.0 is a breaking change for Azure Function Apps 3

See original GitHub issue

We are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.

Describe the bug The dependency on System.Configuration.ConfigurationManager 6.0.0 introduced in the latest version of Azure.Cosmos (3.29.0) conflicts with the pinned version bundled with Azure Function App 3.

To Reproduce

  1. Create a new Azure Function App on version 3 of the SDK
  2. Install Azure.Cosmos 3.29.0
  3. Try to use the dependency in any manner, such as initializing a client

Expected behavior The expected behavior is for the exception not to be thrown.

Actual behavior An exception such as the following is thrown when using the library:

Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 
The system cannot find the file specified.at Microsoft.Azure.Cosmos.DocumentClient.Initialize(Uri serviceEndpoint,ConnectionPolicy connectionPolicy,Nullable`1 desiredConsistencyLevel,HttpMessageHandler handler,ISessionContainer sessionContainer,Nullable`1 enableCpuMonitor,IStoreClientFactory storeClientFactory,TokenCredential tokenCredential)at Microsoft.Azure.Cosmos.DocumentClient..ctor

Environment summary SDK Version: 3.29.0 OS Version (e.g. Windows, Linux, MacOSX): MacOSX

Additional context Add any other context about the problem here (for example, complete stack traces or logs).

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shibayancommented, Aug 30, 2022

@ealsur Yes, this problem occurred only with Azure Functions V3. Azure Functions V4 worked fine because the offending System.Configuration.ConfigurationManager was not removed by the optimization process at publish time, but was left behind.

1reaction
shibayancommented, Aug 30, 2022

This is due to the version 6.0.0 update of System.Configuration.ConfigurationManager package from Cosmos DB SDK v3.29 and the assembly optimization process in Azure Functions.

You may need to add _FunctionsSkipCleanOutput or FunctionsPreservedDependencies to csproj to resolve this.

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
  </PropertyGroup>

or

  <ItemGroup>
    <FunctionsPreservedDependencies Include="System.Configuration.ConfigurationManager.dll" />
  </ItemGroup>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Functions runtime versions overview
The following articles detail breaking changes between versions, including language-specific breaking changes. They also provide you with step- ...
Read more >
Migrate apps from Azure Functions version 3.x to 4.x
Review the list of breaking changes between 3.x and 4.x. Complete the steps in Upgrade your local project to migrate your local project...
Read more >
Azure Functions – 2022 update
Azure Functions – 2022 update With Microsoft Build completed, and Ignite happening now, the team wanted to give an update on the latest ......
Read more >
Develop C# class library functions using Azure Functions
Understand how to use C# to develop and publish code as class libraries that run in-process with the Azure Functions runtime.
Read more >
Azure function app upgrade, function V4 ...
Function V4 runtime requires .NET 6.0. The platform didn't update it automatically, this is to avoid breaking customer's applications who uses ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found