Default behavior when ASPNETCORE_ENVIRONMENT is empty is documented wrong
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.
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. 🏃🏃🏃🏃 😅
Sorry, My bad, it was something we were doing wrong. I'll close this.