[SOLVED] Visual Studio 2019 has errors after cleaning the VS extensions folder in the Temp directory, cannot even install VS installer

vkatsarelias

Reputable
Feb 11, 2018
50
2
4,545
I was cleaning up useless files from my disk when I came across the dreaded Temp folder. It had all the extensions used by the Visual Studio installer to add Xamarin functionality to Visual Studio (as I was testing it), as well as probably some older ones (e.g. C++). I searched to find out if deleting them was safe or not and here a Microsoft person said it was OK to remove the .vsix files in that drectory but not anywhere else. So, I proceeded to delete them.

Fast forward a couple days, I opened a solution I wanted to work on and I was presented with errors.

L3VP1.png


The stack trace (as given from VS itself) is this:

System.Runtime.InteropServices.COMException : A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo) at Microsoft.ServiceHub.Utility.Shared.Common.StartProcess(ProcessStartInfo startInfo,EventHandler onExited,EventHandler onDisposed) at async Microsoft.ServiceHub.Client.HubControllerClient.StartAsync(<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.LaunchOrFindControllerAsync(<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.GetLocationServiceAsync(<Unknown Parameters>) at async Microsoft.ServiceHub.Utility.Shared.ServiceHubRetry.ExecuteAsync[TReturnType](<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.ServiceHub.Utility.Shared.ServiceHubRetry.ExecuteAsync[TReturnType](<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.GetThisAsRemoteServiceBrokerAsync(<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.<Reset>b__54_0(<Unknown Parameters>) at async Microsoft.VisualStudio.Threading.AsyncLazy`1.<>c__DisplayClass13_0.<GetValueAsync>b__0[T](<Unknown Parameters>) at async Microsoft.VisualStudio.Threading.ThreadingTools.WithCancellationSlow[T](<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.GetPipeAsync(<Unknown Parameters>) at async Microsoft.ServiceHub.Client.HubClient.RequestServiceAsync(<Unknown Parameters>) at async Microsoft.CodeAnalysis.Remote.ServiceHubRemoteHostClient.RequestServiceAsync(<Unknown Parameters>) at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

I can't even open VS Installer to repair it, let alone re-installing the installer itself.


VS Installer error info (taken directly from Event Viewer):

Error Information AppInsightsEvent Name = vs/setup/bootstrapper/error Description = Generic Error TelemetrySession = 'c62216e8-62fa-4ff0-878d-52901aed9dc6' Started = True OptIn=True IsInitialized = True Cloned = False WatsonEventType = VisualStudioNonFatalErrors2 UTC time = 2021-06-04T21:18:15 Exception: Microsoft.VisualStudio.Setup.Bootstrapper.BootstrapperException Unable to launch the installer. Error: A device attached to the system is not functioning Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.StartProcess(String exeDir, String exeName, String args) Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.ExecuteCore() Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.<>c__DisplayClass24_0.<Execute>b__0(Object s) Inner Exception: System.ComponentModel.Win32Exception A device attached to the system is not functioning System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) System.Diagnostics.Process.Start() System.Diagnostics.Process.Start(ProcessStartInfo startInfo) Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.StartProcess(String exeDir, String exeName, String args) WerReportAddDump PID=15648 vs_setup_bootstrapper WerDumpTypeMiniDump

I tried uninstalling both from the Programs and Features menu, but it instead told me that it may have already been uninstalled, though the folders are still present. I have also tried Microsoft's InstallCleanup.exe guide, but the executable is nowhere to be found.

I even tried to look at Process Monitor to see what is wrong, but I cannot figure anything out other than a locked file as I'm not that advanced.

Dnn1t.png


Is there any way I can repair Visual Studio, or at least uninstall it and reinstall it?
 
Solution
If my assumption is correct, then you're on Windows 10. If so, unfortunately people learn the hard way with how Windows 10 behaves when you do something it doesn't like. If you asked around before deleting, I'd have suggested that the only way you clear up space from your boot drive was to use Disk Cleanup from Start or right click C drive and then tick the boxes you want then click on OK.

Did you manually locate
C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe and then run the tool in an elevated command, i.e, Right click installer>Run as Administrator.

If all those efforts haven't worked, you might want to prepare yourself for backing up all critical content from your OS drive and...

Lutfij

Titan
Moderator
If my assumption is correct, then you're on Windows 10. If so, unfortunately people learn the hard way with how Windows 10 behaves when you do something it doesn't like. If you asked around before deleting, I'd have suggested that the only way you clear up space from your boot drive was to use Disk Cleanup from Start or right click C drive and then tick the boxes you want then click on OK.

Did you manually locate
C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe and then run the tool in an elevated command, i.e, Right click installer>Run as Administrator.

If all those efforts haven't worked, you might want to prepare yourself for backing up all critical content from your OS drive and reinstall the OS and then Visual Studio 2019.
 
Solution

vkatsarelias

Reputable
Feb 11, 2018
50
2
4,545
If my assumption is correct, then you're on Windows 10. If so, unfortunately people learn the hard way with how Windows 10 behaves when you do something it doesn't like. If you asked around before deleting, I'd have suggested that the only way you clear up space from your boot drive was to use Disk Cleanup from Start or right click C drive and then tick the boxes you want then click on OK.

Did you manually locate
C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe and then run the tool in an elevated command, i.e, Right click installer>Run as Administrator.

If all those efforts haven't worked, you might want to prepare yourself for backing up all critical content from your OS drive and reinstall the OS and then Visual Studio 2019.

Windows 10 is that sensitive?! Man, I didn't know... But the issue is that this only happens with Visual Studio Installer and the devenv.exe itself. No other program, even a .NET one I wrote a month prior has any issues (apart from ILSpy), which probably requires Visual Studio functionality.

As for the reinstallation, I don't think I want to go through the hassle of doing so again, as the installation is only 6 months old. Thanks for your time, by the way.
 

vkatsarelias

Reputable
Feb 11, 2018
50
2
4,545
it said "Unable to launch the installer. Error: A device attached to the system is not functioning"
try repairing your windows installation? sfcscan etc?

Sorry for the late reply. I did run SFC, but nothing changed. I even ran DISM multiple times (both from Windows Update and from a local ISO I have available), but to no avail. I have to note though that I did not restart Windows because I couldn't at the time.
 
Last edited:

vkatsarelias

Reputable
Feb 11, 2018
50
2
4,545
I ran sfc /scannow and DISM.exe. SFC did find and replace corrupt system files, however nothing changed because I did not restart Windows. After a restart, the Visual Studio installer and Visual Studio itself work perfectly fine again!

(Note: If you encounter the same issue, you have to repair Visual Studio through the installer after the SFC scan and DISM.)
 
Last edited:
  • Like
Reactions: rgd1101