b1f8eb1d8d
Currently, dotnet will crash with an `ArgumentNullException` if `USERPROFILE` (Windows) or `HOME` (macOS and Linux) is not set in the environment. This is because there is a missing null check after retrieving the environment variable's value. Additionally, if either variable is set to an empty string, a `.dotnet` directory is created in the current directory where dotnet is being run. This commit fixes this by printing a graceful error informing the user the home directory could not be determined and to set `DOTNET_CLI_HOME` to the directory to use. This variable will be respected before `USERPROFILE` or `HOME`. It is likely that CI environments where `HOME` is not set can use `DOTNET_CLI_HOME` to specify a local temporary location; by using this variable rather than setting `HOME`, it is guaranteed to only affect dotnet. It was discussed that we should perhaps fallback to some temporary location if the home directory could not be determined, but NuGet currently requires `HOME` to be set to work. Because of this, it was decided that we should just handle this case gracefully and provide a way for users to override the home directory without relying on `USERPROFILE`/`HOME` entirely. Closes #8053. |
||
---|---|---|
.. | ||
BuildServerTests | ||
CommandTests | ||
ParserTests | ||
BundledTargetFramworkTests.cs | ||
CommandLineApplicationTests.cs | ||
CommandObjectTests.cs | ||
dotnet.Tests.csproj | ||
FakeRecordEventNameTelemetry.cs | ||
GivenThatDotNetRunsCommands.cs | ||
GivenThatICareAboutVBApps.cs | ||
GivenThatIWantToManageMulticoreJIT.cs | ||
GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | ||
GivenThatTheUserRequestsHelp.cs | ||
MSBuild.exe | ||
MSBuild.exe.config | ||
PackagedCommandTests.cs | ||
PrintableTableTests.cs | ||
TelemetryCommandTest.cs | ||
TelemetryCommonPropertiesTests.cs | ||
TestCommandExtensions.cs | ||
VersionTest.cs |