dotnet / vscode-dotnet-runtime

VSCode Extension for Installing .NET via VS Code
MIT License
131 stars 243 forks source link

Add the ability to reinstall the local runtime #1671

Open JoeRobich opened 5 months ago

JoeRobich commented 5 months ago

Is your feature request related to a problem? Please describe.

In https://github.com/dotnet/vscode-csharp/issues/6889 we have a report of an error.

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/home/daniel/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.16~x64/shared/Microsoft.NETCore.App/7.0.16'.

In this case what appears to be a corrupt local install of the runtime is keeping the C# DevKit extension from starting.

A clear and concise description of what you want to happen. Include any alternative solutions you've considered.

I would like the ability to reinstall the local runtime.

Describe the solution you'd like

A VS Code command be added to the runtime extension allowing users to force a reinstall via the command palette.

  1. The command would remove the current local runtime installation
  2. It would then reinstall the runtime
  3. Lastly, it would prompt the user to reload the window. This would in turn reload all the extensions which may have been trying to use the corrupted runtime install.

This would be similar to how the C# extension prompts when option changes require a restart.

Image

Additional context

No response

nagilson commented 5 months ago

I think this is a good idea, and it is fairly low cost for us to implement. cc @baronfel for a design and @marcpopMSFT for opinions and priority.

marcpopMSFT commented 5 months ago

Do we have any idea how often the install is getting corrupted like this such that this ability would end up being used? I agree that it's bad if you get into this state but it's not clear to me how common this is

marcpopMSFT commented 5 months ago

Can the csharp extension detect this situation and delete the runtime folder (using TS code) and then request a new download?

JoeRobich commented 5 months ago

I wonder if there is something the extension could do to validate the installed runtime. Would shipping the most basic of hello world console apps with the extension and ensuring the application runs with expected output/exit code give us more confidence here? Would also be a place to add telemetry to track how often this occurs.

JoeRobich commented 5 months ago

Can the csharp extension detect this situation

@nagilson asked earlier whether this would be a command for users or an API for extensions. I asked for a command because I am not sure how the extension would identify this. Not sure what heuristics would be useful in making that determination. Certainly is easier for a human to look at the log and think it could be a bad install.

nagilson commented 5 months ago

The extension does some validation already, but it's pretty basic -- aka, it just checks if there is a dotnet exe in the expected install location with a correct folder structure. Shipping hello world is maybe good, but I worry it is prone to breakage across runtime versions. I would rather do something simple like test dotnet --info.

nagilson commented 5 months ago

If we have interest in doing this and get a design spec, I think this would be a good issue for @JL03-Yue to pick up on that would be more interesting to do.