2

So I'm trying to install my Visual Studio extension in Visual Studio 2015 but I'm getting this install error when trying:

System.NullReferenceException: Object reference not set to an instance of an object

The strange thing is that I can run the extension in the experimental instance when debugging.

This is in the install log:

Beginning to install extension to Microsoft Visual Studio Professional 2015...
Install Error : System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CheckForValidDotNetFramework(IExtension extension)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CheckForInstallBlockers(InstallableExtensionImpl extension, IInstalledExtensionList modifiedInstalledExtensionsList, Boolean isNestedExtension, Boolean& olderVersionInstalled)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallInternal(InstallableExtensionImpl extension, Boolean perMachine, Boolean isNestedExtension, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, AsyncOperation asyncOp, UInt64 totalBytesToWrite, UInt64& totalBytesWritten, Boolean enforceCertificateCheckForUpgrade)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)

Things I already tried:

  • Repairing Visual Studio
  • Trying it on another PC (same error)
  • Trying to install it in safemode (devenv /safemode)
  • devenv /resetsettings
  • Trying to install via doubleclick on the vsix file instead of via a private extension gallery
  • Uninstalling the extension "Developer Analytics Tools"
  • Trying an older version of the code which I'm pretty sure once worked
  • Checking all references, clean, rebuild
  • Removing nuget packages and readding them (Newtonsoft.Json & 1 other)

Please help.

mYnDstrEAm
  • 751
  • 2
  • 8
  • 26
  • Does it work in debug mode? in addition, please try to rename or delete the file named 'MachineState.json' in your /Common7/IDE/Extensions/ folder? for more information, please refer to:http://stackoverflow.com/questions/41098661/failed-to-install-visual-studio-extensions-vsix – Zhanglong Wu - MSFT Apr 05 '17 at 01:33
  • Yes it worked in debug mode and renaming 'MachineState.json' didn't help. I was able to fix it just now (see below for how). – mYnDstrEAm Apr 05 '17 at 08:26

1 Answers1

0

Alright so now I inspected ExtensionManager.Implementation and from the CheckForValidDotNetFramework method I worked out that the Version range of the .NET Framework wasn't set for the extension. I could set it in source.extension.vsixmanifest under Dependencies where I entered [4.6.1] in Version range of the entry after changing the .NET framework to that on all projects.

It would have been helpful if the error message in the log said which object was null.

mYnDstrEAm
  • 751
  • 2
  • 8
  • 26