Skip to content

User Secrets not loading Microsoft.Extensions.Hosting 6.0 #63246

@devhl-labs

Description

@devhl-labs

Description

The host is not loading secrets from the user secrets nor from the command line.

Reproduction Steps

https://github.com/devhl-labs/Hosting-6.0-Issue-Repro/blob/daabb5c610c640a76fae9d2bc0391fcc620424db/WorkerService1/WorkerService1/Program.cs#L20

See the repo above, or create a new worker service project. Observe the IConfigurationBuilder sources count be different when using Microsoft.Extensions.Hosting 5.0 and 6.0. Look at the HostBuilderContext.Configuration.Providers and observe that what is missing is user secrets and CommandLineConfigurationProvider.

Expected behavior

The loaded secrets should be the same.

Actual behavior

Missing secrets configurations when using 6.0.

Regression?

Yes, this worked under 5.0

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions