清理临时目录中的 VS 扩展文件夹后,Visual Studio 2019 出现错误,甚至无法安装 VS 安装程序

清理临时目录中的 VS 扩展文件夹后,Visual Studio 2019 出现错误,甚至无法安装 VS 安装程序

当我清理磁盘上的无用文件时,我偶然发现了可怕的 Temp 文件夹。它包含 Visual Studio 安装程序用于将 Xamarin 功能添加到 Visual Studio 的所有扩展(因为我正在测试它),以及可能一些较旧的扩展(例如 C++)。我搜索了一下,想知道删除它们是否安全,结果这里一位微软员工说,删除该目录中的 .vsix 文件是可以的,但是没有其他地方。所以,我决定删除它们。

几天后,我打开了一个我想研究的解决方案,然后出现错误

堆栈跟踪(由 VS 本身给出)如下:

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)

我甚至无法打开 VS 安装程序来修复它,更不用说重新安装安装程序本身了。VS 安装程序错误图像

VS 安装程序错误信息(直接从事件查看器获取):

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

我尝试从“程序和功能”菜单卸载这两个程序,但它却告诉我它可能已被卸载,尽管文件夹仍然存在。我也试过Microsoft 的 InstallCleanup.exe 指南,但可执行文件无处可寻。

有什么方法可以修复 Visual Studio,或者至少卸载它并重新安装它?

相关内容