zooba / indentguide

Indent Guides for Visual Studio
54 stars 18 forks source link

Package fails to load after upgrading to 17.1 #30

Open chrisjaquet opened 1 year ago

chrisjaquet commented 1 year ago

The Indent Guide package fails to load after VS automatically updates it to version 17.1. Version 17.0 still works if manually installed.

When clicking on the entry in "Options" for "Indent Guide" I get an error indicating that "The Indent Guides Package" failed to load correctly. The relevant details in the ActivityLog.xml file seem to be:

SetSite failed for package [Indent Guides Package]Source: 'IndentGuide' Description: Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at IndentGuide.IndentGuidePackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)
   at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass21_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I tried removing and reinstalling the extension but it gives the same error. Manually installing the old version of the extension (17.0) works until VS automatically updates it.

Let me know if there is more info I can provide to help debug this.

zooba commented 1 year ago

Can you provide your exact Visual Studio version?

At a guess, you've somehow not ended up with version 17.5 of the threading assembly, which is a core VS component. So maybe there's a way to update the extension faster than the rest of VS?

chrisjaquet commented 1 year ago

I wonder if that is indeed the case. I usually just let VS auto-update all the extensions as new ones are released. This extension broke a couple of weeks ago (if I remember correctly), but I only recently had time to start debugging.

I will check if there is a VS update (I am using VS2022 cloud) and report back, but I usually wait for VS to let me know there is an update before updating.

My current VS info (as per the about dialog) is:

Microsoft Visual Studio Professional 2022
Version 17.3.5
VisualStudio.17.Release/17.3.5+32922.545
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA092
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.3.376.3011
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.3.376.3011
Azure App Service Tools v3.0.0

C# Tools   4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Indent Guides   17
Indent Guides

Adds visual guides at each indentation level.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio

Visual Assist   10.9.2488.0
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c)1997-2022 Whole Tomato Software, LLC

Visual Basic Tools   4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VsVim   2.10.0.6
VsVim is a Vim emulator for Visual Studio
chrisjaquet commented 1 year ago

There was an indeed an update. Quite a big one since the current release is 17.6 and I was only on 17.3.5. After updating version 17.1 of the extension works. Thanks for the tip of checking if there is a VS update!

Is there a way to prevent the extension from installing on older (unsupported) versions of VS? We cannot always update to the latest version for technical reasons).

I see in the source.extension.vsixmanifest file some likely looking lines which make me wonder if it is possible to only allow the extension to install on 17.5 (or whatever version contains the threading assembly required) or higher:

<Installation>
    <InstallationTarget Version="[17.0,)" Id="Microsoft.VisualStudio.Community">
        <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
    <InstallationTarget Version="[17.0,)" Id="Microsoft.VisualStudio.Pro">
        <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
    <InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,)">
        <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
</Installation>
zooba commented 1 year ago

Is there a way to prevent the extension from installing on older (unsupported) versions of VS? We cannot always update to the latest version for technical reasons).

Yeah, this is what I was thinking. I'll leave this issue open in case I get time to update the package data, and in case anyone else needs to solve the problem.

In future I guess I'll be less aggressive about updating the dependencies, so the minimum version shouldn't move forward so much.