Xavalon / XamlStyler

Visual Studio extension to help format your XAML source code
Apache License 2.0
1.17k stars 128 forks source link

The package 'StylerPackage' did not load correctly #466

Closed YannChv closed 5 months ago

YannChv commented 7 months ago

Hello,

Description of the issue

I'm working on a WPF/c# project on Visual Studio 2022 and I was using this extension, it worked perfectly. But, since I have updated my version of Visual Studio, I'm no more able to use the extension. This update have been made since a long time, at least more than 4 months now. At the beginning, I was thinking about an incompatibility between the versions. But, I start to think that the issue is elsewhere. Everytime I open a xaml file or the extension options, I get this error message :

image The package 'StylerPackage' did not load correctly The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file ...

Here is the error message I have in the ActivityLog file: _SetSite failed for package [StylerPackage]Source: 'XamlStyler.Extension.Windows.VS2022' Description: Impossible de charger le fichier ou l'assembly 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ou une de ses dépendances. Le fichier spécifié est introuvable. System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ou une de ses dépendances. Le fichier spécifié est introuvable. Nom de fichier : 'Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' à Xavalon.XamlStyler.Extension.Windows.StylerPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress) à Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_0.<b__1>d.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) à Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) === Informations d'état de liaison préalable === JRN : DisplayName = Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) JRN : Appbase = file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/ JRN : PrivatePath initial = NULL Assembly appelant : XamlStyler.Extension.Windows.VS2022, Version=3.2311.2.0, Culture=neutral, PublicKeyToken=null. === JRN : cette liaison démarre dans le contexte de chargement de LoadFrom. AVT : l'image native ne sera pas détectée dans le contexte LoadFrom. Elle sera détectée uniquement dans le contexte de chargement par défaut, comme pour Assembly.Load(). JRN : utilisation du fichier de configuration de l'application : C:\Users\YCU\AppData\Local\Microsoft\VisualStudio\17.04094c831\devenv.exe.config JRN : utilisation du fichier de configuration d'hôte : JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. JRN : référence post-stratégie : Microsoft.VisualStudio.Threading, Version=17.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a JRN : la même liaison a été vue avant et a échoué avec hr = 0x80070002.

I have already tried to uninstall and reinstall the extension and my Visual Studio version. But the problem remains the same.

Version Info:

Thank you,

Chris-zixuan commented 5 months ago

I installed the same version of VS2022 on both my laptop and desktop, and both had the plugin installed. However, it can be used normally on a laptop, but not on a desktop. If you need me to provide information about the comparison of two computers, please let me know. I hope I can help fix this problem.

mrlacey commented 5 months ago

From the log above, it looks like you're using VS 17.2 but the extension is trying to load a version of a VS library from version 17.5

I'm not surprised that this causes an exception.

YannChv commented 5 months ago

Yes, it seems to be the root cause of the issue. I've seen that you have opened a PR. Thank you for the time you took on it !

I hope there will be a fix in the coming days :)

grochocki commented 5 months ago

Should be fixed with 3.2404.2 update.