Defer adding user secrets and building configuration #334
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Hey!
I am proposing to not build the configuration root until constructors of derived classes have run.
This way we can change the environment variables in the constructor of derived classes (e.g. load with Dotenv). Right now, we are loading env variables with dotnev but they are actually not showing up in the configuration because the configuration has already been built before the constructor ran.
The same will be true for user secrets, this is why I moved that line, too (allthough I am not using that feature right now). In my IDE, I am getting a warning "virtual member call in constructor" which would be resolved as well.
Best
Chris