Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing IConfiguration from builder.Services is lost #3

Open
andrewdmoreno opened this issue Aug 13, 2020 · 0 comments
Open

Existing IConfiguration from builder.Services is lost #3

andrewdmoreno opened this issue Aug 13, 2020 · 0 comments

Comments

@andrewdmoreno
Copy link

Not sure when this started, but I am using v3 Azure Functions and when the below code runs, the ImplementationInstance is always null on the ServiceDescriptor. Perhaps the behavior has changed under the covers in recent versions, but it now requires calling BuildServiceProvider() and fetching the IConfguration from the IServiceProvider. The impact of this is that any modifications I make to host.json is lost when also using this package.

var descriptor = builder.Services.FirstOrDefault(d => d.ServiceType == typeof(IConfiguration));
if (descriptor?.ImplementationInstance is IConfigurationRoot configuration)
{
    configurationBuilder.AddConfiguration(configuration);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant