Solution - Value cannot be null. Parameter name paths at System.IO.Path.Combine(String[] paths) at Microsoft.TemplateEngine.Utils.EngineEnvironmentSettings.DefaultPathInfo.get_BaseDir()

In Azure DevOps, got this error:

2018-09-25T21:24:45.2778646Z ERROR: Error: Value cannot be null.
2018-09-25T21:24:45.2791049Z Parameter name: paths
2018-09-25T21:24:45.2804472Z at System.IO.Path.Combine(String[] paths)
2018-09-25T21:24:45.2818339Z at Microsoft.TemplateEngine.Utils.EngineEnvironmentSettings.DefaultPathInfo.get_BaseDir()
2018-09-25T21:24:45.2832030Z at Microsoft.TemplateEngine.Edge.Paths.UserPaths.get_AliasesFile()
2018-09-25T21:24:45.2845669Z at Microsoft.TemplateEngine.Edge.Settings.AliasRegistry.EnsureLoaded()
2018-09-25T21:24:45.2859343Z at Microsoft.TemplateEngine.Edge.Settings.AliasRegistry.TryExpandCommandAliases(IReadOnlyList`1 inputTokens, IReadOnlyList`1& expandedInputTokens)
2018-09-25T21:24:45.2874783Z at Microsoft.TemplateEngine.Cli.AliasSupport.TryExpandAliases(INewCommandInput commandInput, AliasRegistry aliasRegistry)
2018-09-25T21:24:45.2888665Z at Microsoft.TemplateEngine.Cli.AliasSupport.CoordinateAliasExpansion(INewCommandInput commandInput, AliasRegistry aliasRegistry, ITelemetryLogger telemetryLogger)
2018-09-25T21:24:45.2902455Z at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync()
2018-09-25T21:24:45.2915947Z at Microsoft.TemplateEngine.Cli.CommandParsing.NewCommandInputCli.<>c__DisplayClass19_0.<<OnExecute>b__0>d.MoveNext()

Tracked it down to this line of code:
https://github.com/dotnet/templating/blob/4bd80f0577550c7f36867b53d0c074f8f3dcde17/src/Microsoft.TemplateEngine.Utils/EngineEnvironmentSettings.cs#L60

string profileDir = _parent.Environment.GetEnvironmentVariable(isWindows
? "USERPROFILE"
: "HOME");

Which assumes that either USERPROFILE or HOME will be set.

I’m running tox in my Azure DevOps build from a Linux agent and wasn’t passing HOME in passenv.

Add HOME to passenv in your tox.ini and this error should go away.

passenv = APPDATA ProgramFiles USERPROFILE PROGRAMDATA DOTENV_FILE LOCALAPPDATA DOTNET_CLI_HOME HOME

Jon