Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1522 from github/fixes/1520-VS2017-deadlock
Browse files Browse the repository at this point in the history
Call MenuCommandService.AddCommand on Main thread
  • Loading branch information
jcansdale committed Mar 6, 2018
2 parents 804f3b3 + a087725 commit 4638bfb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/GitHub.VisualStudio/GitHubPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows;
using GitHub.Api;
using GitHub.Extensions;
using GitHub.Helpers;
using GitHub.Info;
using GitHub.Logging;
using GitHub.Models;
Expand Down Expand Up @@ -76,6 +77,9 @@ async Task InitializeMenus()
return;
}

// IMenuCommandService.AddCommand uses IServiceProvider.GetService and must be called on Main thread.
await ThreadingHelper.SwitchToMainThreadAsync();

foreach (var menu in menus.Menus)
serviceProvider.AddCommandHandler(menu.Guid, menu.CmdId, (s, e) => menu.Activate());

Expand Down

0 comments on commit 4638bfb

Please sign in to comment.