microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
208 stars 7 forks source link

[BUG] Unable to find fallback package folder 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' on Linux devcontainer #1138

Open dibarbet opened 1 month ago

dibarbet commented 1 month ago

Describe the Issue

Hitting an issue opening Roslyn.sln inside a linux container from Windows. Using VSCode devcontainers and the devcontainer.json here - https://github.com/dotnet/roslyn/blob/main/.devcontainer/devcontainer.json

There is a fault thrown during project loading

=====================
5/22/2024 12:12:50 AM
LimitedFunctionality
StreamJsonRpc.RemoteInvocationException: Request nominateProject failed with message: Cannot read properties of undefined (reading 'size')
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.VisualStudio.ProjectSystem.PackageReferences.NuGetRestoreService.NominateAsync(ProjectRestoreInfo restoreData, IReadOnlyCollection`1 inputVersions, CancellationToken cancellationToken)
===================

The projects output window shows multiple instances of

2024-05-22 00:13:04.630 [error] (/workspaces/roslyn/src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj): The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages'.
   at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders)
   at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable`1 packageFolders)
   at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task)
   at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash)
   at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task)
   at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups()
   at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

The Windows nuget package path there is suspicious. I don't believe it is coming from the Roslyn repo configuration, as the repo works fine on a normal linux install (and also in a github codespace using the same devcontainer.json, but I believe using Linux as the host OS instead of Windows).

Steps To Reproduce

  1. Clone the roslyn repo
  2. Open in VSCode, make sure to have the devcontainer extension and docker installed.
  3. Run the 'rebuild and reopen in devcontainer' command image
  4. Wait for a bit for the sln to load, note the project system fault pop-up.

Expected Behavior

No project system fault pop up

Environment Information

dibarbet commented 1 month ago

possibly related to https://github.com/microsoft/vscode-dotnettools/issues/849 (cc @tmeschter )

tmeschter commented 1 month ago

Moving to area-nuget for initial investigate as the ResolvePackageAssets tasks is failing during a design-time build.