-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
I was getting some errors when trying to launch the debugger on my machine - Kestrel couldn't start because it said something was already listening on the same port. It appears to be because the debug proxy is still trying to inherit environment variables from the parent process.
By putting a breakpoint on the following line in DebugProxyHost.cs, it's possible to confirm that the EnvironmentVariablesConfigurationProvider is still being used:
It looks like this is because both GenericWebHostBuilder and WebHostBuilder (not certain which is used in this case) are hardcoded to call .AddEnvironmentVariables(prefix: "ASPNETCORE_") in their constructors.
As such I'm not sure what is the recommended pattern for not loading config from environment variables. @Tratcher - do you have any suggestions?
I investigated to see if we could remove the EnvironmentVariablesConfigurationProvider after the builder is created, but that's not easy since by the time ConfigureAppConfiguration gets called, that provider is already nested several levels deep in ChainedConfigurationSource instances, which seems to be immutable.
If nothing else works we could go back to our previous pattern of removing all environment variables that start with the ASPNETCORE_ prefix before launching the debug proxy, but cc @captainsafia for any other ideas.
