Azure / Azure/azure-functions-core-tools

Arrays in local.settings.json no longer work for version 4

Open
#2,965 2 comments 0 reactions 0 assignees View on GitHub
investigate
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

I recently upgraded to version 4 of the CLI for Mac using the recommended upgrade guide.
After doing so the array functionality for local.settings.json no longer works.
After reverting back the version 3 of the CLI it worked.

local.settings.json example below:
```
{
"IsEncrypted": false,
"Values": {
"ExpirationNeverExpire:[0]": "311",
"ExpirationNeverExpire:[1]": "2007",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
```

Reading settings code:
```
public static IServiceCollection AddExpirationConfiguration(this IServiceCollection services)
{
services.Configure>(_config.GetSection("ExpirationNeverExpire"));
}

...

public ExpireApplications
(
IOptionsSnapshot> expirationNeverExpire,
)
{
// Version 4, Count = 0
// Version 3, Count = 2
_expirationNeverExpire = expirationNeverExpire.Value ?? new List();
}
```

I tried this using Function v3 and v4. Neither worked with CLI version 4.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the local.settings.json example and compare CLI versions 3 and 4, using the shown AddExpirationConfiguration and IOptionsSnapshot> code to inspect the resulting values. Done means the ExpirationNeverExpire array binds with Count = 2 under CLI version 4 for the reported Function versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.