Skip to content

Conversation

@kasperk81
Copy link
Contributor

@kasperk81 kasperk81 commented Oct 1, 2024

Description

when HOME is not set in container, nuget commands fail while other sdk commands work due to SpecialFolder.UserProfile fallback https://github.com/dotnet/sdk/blob/c3a8f72c3a5491c693ff8e49e7406136a12c3040/src/Common/CliFolderPathCalculatorCore.cs#L38-L38.

nuget already uses UserProfile with full framework, this pr adds the same fallback for coreclr.

  The "WarnForInvalidProjectsTask" task failed unexpectedly.
  System.InvalidOperationException: Required environment variable 'HOME' is not set. Try setting 'DOTNET_CLI_HOME' or 'HOME' and running the operation
     at NuGet.Common.NuGetEnvironment.GetValueOrThrowMissingEnvVarsDotnet(Func`1 getValue, String home, String dotnetHome)
     at NuGet.Common.NuGetEnvironment.GetHome()
     at NuGet.Common.NuGetEnvironment.<>c.<.cctor>b__20_0()
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
     at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
     at System.Lazy`1.CreateValue()
     at NuGet.Common.NuGetEnvironment.GetFolderPath(SpecialFolder folder)
     at NuGet.Common.NuGetEnvironment.GetFolderPath(NuGetFolderPath folder)
     at NuGet.Common.PathUtility.CheckIfFileSystemIsCaseInsensitive()
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
     at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
     at System.Lazy`1.CreateValue()
     at NuGet.Common.PathUtility.get_IsFileSystemCaseInsensitive()
     at NuGet.Common.PathUtility.GetStringComparerBasedOnOS()
     at NuGet.Build.Tasks.WarnForInvalidProjectsTask.Execute()
     at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
     at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

fix NuGet/Home#13834

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests (idk, how to test it in ci)
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@kasperk81 kasperk81 requested a review from a team as a code owner October 1, 2024 22:06
@microsoft-github-policy-service microsoft-github-policy-service bot added the Community PRs created by someone not in the NuGet team label Oct 1, 2024
@kasperk81
Copy link
Contributor Author

the timeout failures don't look related. @zivkan, please take a look thanks!

@zivkan zivkan merged commit 310f5d4 into NuGet:dev Oct 17, 2024
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NuGet Fails in Containers When HOME Is Not Set

3 participants