AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Default behavior when ASPNETCORE_ENVIRONMENT is empty is documented wrong

Open gregbair opened this issue 8 years ago • 2 comments

In Work with multiple environments, it's stated (emphasis mine):

ASP.NET Core reads the environment variable ASPNETCORE_ENVIRONMENT at application startup and stores that value in IHostingEnvironment.EnvironmentName. ASPNETCORE_ENVIRONMENT can be set to any value, but three values are supported by the framework: Development, Staging, and Production. If ASPNETCORE_ENVIRONMENT isn't set, it will default to Production.

This last sentence in incorrect, through my testing, if the environment variable is not set, the property is just null.

gregbair avatar Apr 18 '18 12:04 gregbair

It should default here: https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/Internal/HostingEnvironment.cs#L10

Where/how are you trying to access IHostingEnvionment? Can you put up a simple repro? ... I'll take a look if you'll put up a repro and see if I can help. Otherwise, you'll need to ping the engineers on the Hosting repo. It's best to see if I can help first before asking them.

I'm just garden-variety busy ... those cats are crazy, super, insanely busy. 🏃🏃🏃🏃 😅

guardrex avatar Apr 18 '18 17:04 guardrex

Sorry, My bad, it was something we were doing wrong. I'll close this.

gregbair avatar Apr 18 '18 17:04 gregbair