Temporarily fixes the error "GetFullVsVersionString must be called on the UI thread". A proper fix has been submitted to NuGet.
If opening the NuGet Package Manager fails with the following error shown in the logs:
LegacySitePackage failed for package [NuGetPackage]Source: Microsoft.VisualStudio.Composition
Description: An exception was thrown while initializing part "NuGet.PackageManagement.VisualStudio.VSSolutionManager". Microsoft.VisualStudio.Composition.CompositionFailedException: An exception was thrown while initializing part "NuGet.PackageManagement.VisualStudio.VSSolutionManager". ---> System.Runtime.InteropServices.COMException: GetFullVsVersionString must be called on the UI thread. at Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(String callerMemberName) at NuGet.PackageManagement.VisualStudio.VSVersionHelper.GetFullVsVersionString() at NuGet.PackageManagement.VisualStudio.VSSolutionManager..ctor() --- End of inner exception stack trace ---
Then it is because another component in Visual Studio may have caused NuGet to instantiate in a in a background thread and trigger this error. This has been confirmed to happen in some cases with Xamarin, for example.
The bug report has been filed at https://github.com/NuGet/Home/issues/3419 and a fix will most likely be available in a future NuGet release. A PR was sent at https://github.com/NuGet/NuGet.Client/pull/871
If you are not facing this error, you do NOT need this extension.