VSIX 安装程序给出错误 "Object reference not set to an instance of an object."

VSIX Installer gives error "Object reference not set to an instance of an object."

正如标题所说,每当我尝试为 Visual Studio 2019 安装扩展时,VSIX 安装程序都会给出错误消息:Object reference not set to an instance of an object。我发现了一些类似的帖子,但没有什么与这里发生的事情很相似。我试过在 Appdata/Local 中删除某些文件夹,在控制台中尝试过 运行 devenv /resetuserdata。虽然似乎没有任何效果,所以我很好奇是否有其他人遇到过这个问题以及关于如何解决它的任何想法?

Picture of VSIX with Error Message

安装日志:

1/11/2021 12:59:18 PM - -------------------------------------------
1/11/2021 12:59:18 PM - vsixinstaller.exe version:
1/11/2021 12:59:18 PM - 16.8.3036
1/11/2021 12:59:18 PM - -------------------------------------------
1/11/2021 12:59:18 PM - Command line parameters:
1/11/2021 12:59:18 PM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\vsixinstaller.exe,/appidinstallpath:F:\VSCODEIDE\Common7\IDE\devenv.exe,/skuName:Community,/skuVersion:16.8.30804.86,/appidname:Microsoft Visual Studio Community 2019,/culture:en-US,/noep,C:\Users\xxxxxxx\AppData\Local\Temp\VSIXpg4jcyqq.vsix
1/11/2021 12:59:18 PM - -------------------------------------------
1/11/2021 12:59:18 PM - Microsoft VSIX Installer
1/11/2021 12:59:18 PM - -------------------------------------------
1/11/2021 12:59:18 PM - System.NullReferenceException: Object reference not set to an instance of an object.
   at VSIXInstaller.SetupExtensions.GetLaunchableInstances(IQuery query)
   at VSIXInstaller.SupportedSKUs.EnumerateIsolatedInstalls(Action`1 callback)
   at VSIXInstaller.SupportedSKUs.AddInstalledLocationBasedSKUs(IntPtr userToken)
   at VSIXInstaller.SupportedSKUs.InitializeSupportedSKUs(IntPtr userToken)
   at VSIXInstaller.ExtensionService.InitializeSupportedSKUs(ICommandLineData cmdLineData, IntPtr duplicatedUserToken)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

在这里添加一个答案,让更多的社区成员处理类似的问题。

感谢 ErikEJ 分享解决方案。

因为你的VS坏了,你可以repair vs from vs_installer实际解决你的问题。