XamlStyler icon indicating copy to clipboard operation
XamlStyler copied to clipboard

The package 'StylerPackage' did not load correctly

Open YannChv opened this issue 1 year ago • 1 comments

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.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>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.0_4094c831\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:

  • OS: Windows 11 professional 22H2
  • Visual Studio: Microsoft Visual Studio Professional 2022 (64 bits) - LTSC 17.2 Version 17.2.23
  • XAML Styler: XAML Styler for Visual Studio 2022 3.2311.2

Thank you,

YannChv avatar Feb 08 '24 08:02 YannChv

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.

Chris-zixuan avatar Mar 12 '24 07:03 Chris-zixuan

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.

mrlacey avatar Apr 03 '24 19:04 mrlacey

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 :)

YannChv avatar Apr 04 '24 06:04 YannChv

Should be fixed with 3.2404.2 update.

grochocki avatar Apr 08 '24 01:04 grochocki