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

Commit d951127

Browse files
committed
Ensure menus complete initialization
We must await InitializeMenus to ensure that menus are ready. SwitchToMainThreadAsync doesn't exit until a solution has loaded.
1 parent acf2213 commit d951127

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Windows;
88
using GitHub.Api;
99
using GitHub.Extensions;
10-
using GitHub.Helpers;
1110
using GitHub.Info;
1211
using GitHub.Logging;
1312
using GitHub.Models;
@@ -56,7 +55,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
5655

5756
await GetServiceAsync(typeof(IUsageTracker));
5857

59-
InitializeMenus().Forget();
58+
// This package might be loaded on demand so we must await initialization of menus.
59+
await InitializeMenus();
6060
}
6161

6262
void LogVersionInformation()
@@ -76,8 +76,6 @@ async Task InitializeMenus()
7676
return;
7777
}
7878

79-
await ThreadingHelper.SwitchToMainThreadAsync();
80-
8179
foreach (var menu in menus.Menus)
8280
serviceProvider.AddCommandHandler(menu.Guid, menu.CmdId, (s, e) => menu.Activate());
8381

0 commit comments

Comments
 (0)