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.

Cosmos trigger on Azure Functions v4 (.net 6) fails - cannot resolve SystemConfiguration.ConfigurationManager

See original GitHub issue

I have a Cosmos trigger on Azure Functions v4 which cannot register the function because of a failure to resolve System.Configuration.ConfigurationManager version 4.0.3.0 (aka 4.7.0)

Repro steps

Create a function project - .net6 preview, functions v4 - with the following function:

        [FunctionName("Function1")]
        public async Task Run([CosmosDBTrigger(
            databaseName: "Stats",
            containerName: "RawData",
            Connection = "DefaultConnection")]IReadOnlyList<object> input, ILogger log)
        {
            if (input != null && input.Count > 0)
            {
                log.LogInformation("Documents modified " + input.Count);
            }

            await Task.CompletedTask;
        }

local.settings.json is as follows:

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",

    "DefaultConnection": "___REDACTED___"
  }
}

Expected behavior

Function should run …

Actual behavior

Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cannot create container information for RawData in database Stats with lease leases in database Stats : Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. Microsoft.Azure.Cosmos.Client: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Known workarounds

None yet

  • Package version Microsoft.Azure.WebJobs.Extensions.CosmosDB - 4.0.0-preview2 Microsoft.Azure.Cosmos - 3.22.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
AdrianPellcommented, Oct 20, 2021

Thanks @brettsam . That did indeed, fix it! Onward to the release, then 😃

1reaction
brettsamcommented, Oct 20, 2021

Try using 4.0.0 of Microsoft.NET.Sdk.Functions – that should fix it. https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/4.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

'System.Configuration.ConfigurationManager, Version ...
In this function, I connect to a cosmosdb (SQL API) Azure Function ... Cosmos trigger on Azure Functions v4 (.net 6) fails -...
Read more >
[Azure Function]Could not load file or assembly 'System. ...
System.Configuration.ConfigurationManager 6.0 won't support .net SDK 3.1, so update the "System.Configuration.ConfigurationManager" version ...
Read more >
Troubleshoot issues with the Azure Functions trigger for ...
This error happens if your Azure Functions project (or any referenced project) contains a manual NuGet reference to the Azure Cosmos DB SDK...
Read more >
Develop C# class library functions using Azure Functions
NET class libraries. Important. This article supports .NET class library functions that run in-process with the runtime. Your C# functions can ...
Read more >
Error connecting Azure Function with CosmosDB
I'm trying to output a document to Azure CosmosDB for Table with Azure function Http Trigger. I followed the sample from the documentation ......
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