Cosmos trigger on Azure Functions v4 (.net 6) fails - cannot resolve SystemConfiguration.ConfigurationManager
See original GitHub issueI 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:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Thanks @brettsam . That did indeed, fix it! Onward to the release, then 😃
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