sandercox / AutoSortVcxprojFilters

Automatically sort Visual Studio 2013/2015 .vcxproj.filters XML files
Other
4 stars 6 forks source link

"The 'AutoSortPackage' package did not load correctly." warning when opening VS #3

Closed GaineyRoy closed 4 years ago

GaineyRoy commented 4 years ago

Installed product versions

Description

A warning appears when opening Visual Studio with the my last solution. The warning mentions that the package didn't load correctly but the extensions works as expected.

Steps to recreate

  1. Opens Visual Studio
  2. Opens a project
  3. Waits a couple of second and you should get the following warning :

image

Here's the content of the log file as mention in the previous screenshot :

658 Information VisualStudio Begin package load [AutoSortPackage] {01A71080-33CD-4769-883B-07242C7C6C3E} 659 Error VisualStudio SetSite failed for package [AutoSortPackage]Source: 'Microsoft.VisualStudio.Shell.14.0' Description: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType) at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType) at System.ComponentModel.Design.MenuCommandService.GetService(Type serviceType) at System.ComponentModel.Design.MenuCommandService.EnsureVerbs() at System.ComponentModel.Design.MenuCommandService.FindCommand(Guid guid, Int32 id) at System.ComponentModel.Design.MenuCommandService.FindCommand(CommandID commandID) at System.ComponentModel.Design.MenuCommandService.AddCommand(MenuCommand command) at AutoSortVcxprojFilters.SortAllCommand..ctor(Package package) in C:\projects\autosortvcxprojfilters\AutoSortVcxprojFilters\SortAllCommand.cs:line 52 at AutoSortVcxprojFilters.AutoSortPackage.<InitializeAsync>d__4.MoveNext() in C:\projects\autosortvcxprojfilters\AutoSortVcxprojFilters\AutoSortPackage.cs:line 87 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass16_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) at Microsoft.VisualStudio.Services.VsTask.GetResult() {01A71080-33CD-4769-883B-07242C7C6C3E}
80131509
660 Error VisualStudio End package load [AutoSortPackage] {01A71080-33CD-4769-883B-07242C7C6C3E}
80131509

Current behavior

A warning is shown each time I open my first project in Visual Studio.

Expected behavior

I would expect the extension to work without any warning in Visual Studio.

sandercox commented 4 years ago

Fixed.