dotnet workload crashes if projects are moved
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
I moved some project folders around on my hard drive, and now various `dotnet workload` commands crash with an error trying to look in the *prior* location of projects to find `global.json` instead of where they actually are now.
### Steps to reproduce
1. Create a project using some workloads with versions specified in a `global.json` file
2. Install the workloads using `dotnet workload install`
3. Move the project to a different folder on your hard drive
4. Try to update using `dotnet workload update` or even just clean up using `dotnet workload clean`
### Expected behavior
The commands would work as normal.
### Actual behavior
Commands fail with the error `Unhandled exception: Failed to get global.json GC roots Could not find a part of the path 'D:\old\path\global.json'.`
### Is this a regression?
Not sure, I don't have access to older SDK versions to try this.
### Are there any workarounds?
I don't know where it's magically finding this old path in the first place, so I don't know how to try to work around this. I tried searching all over my hard drive and found nothing.
### dotnet --info output
```console
.NET SDK:
Version: 10.0.401
Commit: e34a38d2ae
Workload version: 10.0.400
MSBuild version: 18.9.11+e34a38d2a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.401\
.NET workloads installed:
[wasm-tools]
Installation Source: SDK 10.0.400, VS 18.10.12201.205
Manifest Version: 10.0.111/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.workload.mono.toolchain.current\10.0.111\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net8]
Installation Source: SDK 10.0.400, VS 18.10.12201.205
Manifest Version: 10.0.111/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.workload.mono.toolchain.net8\10.0.111\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net9]
Installation Source: SDK 10.0.400, VS 18.10.12201.205
Manifest Version: 10.0.111/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.workload.mono.toolchain.net9\10.0.111\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
Host:
Version: 10.0.12
Architecture: x64
Commit: 95017c711e
.NET SDKs installed:
10.0.401 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
D:\Source\vyne-api\feature-flags\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
### IDE version
No IDE, just the command line
### Other details
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.