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

Commit 4638bfb

Browse files
authored
Merge pull request #1522 from github/fixes/1520-VS2017-deadlock
Call MenuCommandService.AddCommand on Main thread
2 parents 804f3b3 + a087725 commit 4638bfb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Windows;
88
using GitHub.Api;
99
using GitHub.Extensions;
10+
using GitHub.Helpers;
1011
using GitHub.Info;
1112
using GitHub.Logging;
1213
using GitHub.Models;
@@ -76,6 +77,9 @@ async Task InitializeMenus()
7677
return;
7778
}
7879

80+
// IMenuCommandService.AddCommand uses IServiceProvider.GetService and must be called on Main thread.
81+
await ThreadingHelper.SwitchToMainThreadAsync();
82+
7983
foreach (var menu in menus.Menus)
8084
serviceProvider.AddCommandHandler(menu.Guid, menu.CmdId, (s, e) => menu.Activate());
8185

0 commit comments

Comments
 (0)