|
24 | 24 |
|
25 | 25 | namespace GitHub.VisualStudio |
26 | 26 | { |
27 | | - [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] |
| 27 | + // Initialize menus on Main thread. |
| 28 | + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = false)] |
28 | 29 | [InstalledProductRegistration("#110", "#112", AssemblyVersionInformation.Version, IconResourceID = 400)] |
29 | 30 | [Guid(Guids.guidGitHubPkgString)] |
30 | 31 | [ProvideMenuResource("Menus.ctmenu", 1)] |
31 | 32 | // Only initialize when we're in the context of a Git repository. |
32 | | - [ProvideAutoLoad(Guids.UIContext_Git, PackageAutoLoadFlags.BackgroundLoad)] |
| 33 | + [ProvideAutoLoad(Guids.UIContext_Git)] |
33 | 34 | [ProvideToolWindow(typeof(GitHubPane), Orientation = ToolWindowOrientation.Right, Style = VsDockStyle.Tabbed, Window = EnvDTE.Constants.vsWindowKindSolutionExplorer)] |
34 | 35 | [ProvideOptionPage(typeof(OptionsPage), "GitHub for Visual Studio", "General", 0, 0, supportsAutomation: true)] |
35 | 36 | public class GitHubPackage : AsyncPackage |
@@ -71,9 +72,6 @@ async Task InitializeMenus() |
71 | 72 | var menuService = (IMenuCommandService)(await GetServiceAsync(typeof(IMenuCommandService))); |
72 | 73 | var componentModel = (IComponentModel)(await GetServiceAsync(typeof(SComponentModel))); |
73 | 74 |
|
74 | | - // IMenuCommandService.AddCommand uses IServiceProvider.GetService and must be called on Main thread. |
75 | | - await ThreadingHelper.SwitchToMainThreadAsync(); |
76 | | - |
77 | 75 | var exports = componentModel.DefaultExportProvider; |
78 | 76 | menuService.AddCommands( |
79 | 77 | exports.GetExportedValue<IAddConnectionCommand>(), |
|
0 commit comments