Attempting to Install an extension to VS2019 results in a NullReferenceException

两盒软妹~` 提交于 2020-05-16 08:56:45

问题


I've not been able to add extensions to my VS 2019 since its release. I recently updated to Version 16.4.3 but I still get the same error when I try to add extensions.

Error Dialog

I've tried to do the following but it still fails with an error dialog above.

  • Install from the Extension Manager in Visual Studio;
  • Download extension from MarketPlace and double-clicking to install;
  • Install using VSIXInstaller.exe Commandline in VS 2019 Developer Command Prompt admin mode.

This is what I get from the install log.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.Setup.Cache.Instance.get_SupportsExtensions()
   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)

Every VS2019 extension I've tried to install so far has given me this error. Installing extensions to VS2017 is no different.


回答1:


l wonder if you face this issue only in VS2019 but does work in VS2017.

Besides, you can try these steps:

1) delete all extension cache files under the path C:\Users\Admin\AppData\Local\Microsoft\VisualStudio\16.0_xxxx(the version of VS)\ComponentModelCache

2) Disable any other third-party extensions and then install this extension to check whether it is caused by other extenisons.

3) If you cannot install this extension in VS2019 but can work in VS2017. You can try to open the installation package xxxxp.vsix with zip

First, open extension.vsixmanifest and change to this:

<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[15.0,)" />
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />

Second, please also change "Microsoft.VisualStudio.Component.CoreEditor":"[15.0,16.0)" in catalog.json file to [15.0,).

In addition, please share the info about how this issue appear and whether it works in other version of VS. And any other useful info should also be informed. If you have any errors related to this issue, please feel free to let us know.



来源:https://stackoverflow.com/questions/59852334/attempting-to-install-an-extension-to-vs2019-results-in-a-nullreferenceexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!