Make IHostEnvironment.ApplicationName non-nullable (#72945)
authorEric Erhardt <eric.erhardt@microsoft.com>
Mon, 1 Aug 2022 15:22:21 +0000 (09:22 -0600)
committerGitHub <noreply@github.com>
Mon, 1 Aug 2022 15:22:21 +0000 (10:22 -0500)
commit028e556926ad4b03afba9ac1d616cfd3538d36cf
tree182c3390b6960bd767fef26258b2cd64a0564edb
parentcfe26ecb3b677a506711878c19586ddd06117d0e
Make IHostEnvironment.ApplicationName non-nullable (#72945)

* Make IHostEnvironment.ApplicationName non-nullable

It is not intended that normal execution has a null ApplicationName, so don't make callers need to check for null. When an ApplicationName is not available, it is set to string.Empty.

Fix #68512

* Make the other string properties in HostingEnvironment default to string.Empty.
src/libraries/Microsoft.Extensions.Hosting.Abstractions/ref/Microsoft.Extensions.Hosting.Abstractions.cs
src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostEnvironment.cs
src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostingEnvironment.cs
src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs
src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs
src/libraries/Microsoft.Extensions.Hosting/src/Internal/HostingEnvironment.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostApplicationBuilderTests.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostBuilderTests.cs