@@ -41,8 +41,9 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
4141 await base . InitializeAsync ( cancellationToken , progress ) ;
4242 await GetServiceAsync ( typeof ( IUsageTracker ) ) ;
4343
44- // This package might be loaded on demand so we must await initialization of menus.
45- await InitializeMenus ( ) ;
44+ // Avoid delays when there is ongoing UI activity.
45+ // See: https://github.com/github/VisualStudio/issues/1537
46+ await JoinableTaskFactory . RunAsync ( VsTaskRunContext . UIThreadNormalPriority , InitializeMenus ) ;
4647 }
4748
4849 void LogVersionInformation ( )
@@ -59,21 +60,16 @@ async Task InitializeMenus()
5960 var componentModel = ( IComponentModel ) ( await GetServiceAsync ( typeof ( SComponentModel ) ) ) ;
6061 var exports = componentModel . DefaultExportProvider ;
6162
62- // Avoid delays when there is ongoing UI activity.
63- // See: https://github.com/github/VisualStudio/issues/1537
64- await JoinableTaskFactory . RunAsync ( VsTaskRunContext . UIThreadNormalPriority , async ( ) =>
65- {
66- await JoinableTaskFactory . SwitchToMainThreadAsync ( ) ;
67- menuService . AddCommands (
68- exports . GetExportedValue < IAddConnectionCommand > ( ) ,
69- exports . GetExportedValue < IBlameLinkCommand > ( ) ,
70- exports . GetExportedValue < ICopyLinkCommand > ( ) ,
71- exports . GetExportedValue < ICreateGistCommand > ( ) ,
72- exports . GetExportedValue < IOpenLinkCommand > ( ) ,
73- exports . GetExportedValue < IOpenPullRequestsCommand > ( ) ,
74- exports . GetExportedValue < IShowCurrentPullRequestCommand > ( ) ,
75- exports . GetExportedValue < IShowGitHubPaneCommand > ( ) ) ;
76- } ) ;
63+ await JoinableTaskFactory . SwitchToMainThreadAsync ( ) ;
64+ menuService . AddCommands (
65+ exports . GetExportedValue < IAddConnectionCommand > ( ) ,
66+ exports . GetExportedValue < IBlameLinkCommand > ( ) ,
67+ exports . GetExportedValue < ICopyLinkCommand > ( ) ,
68+ exports . GetExportedValue < ICreateGistCommand > ( ) ,
69+ exports . GetExportedValue < IOpenLinkCommand > ( ) ,
70+ exports . GetExportedValue < IOpenPullRequestsCommand > ( ) ,
71+ exports . GetExportedValue < IShowCurrentPullRequestCommand > ( ) ,
72+ exports . GetExportedValue < IShowGitHubPaneCommand > ( ) ) ;
7773 }
7874
7975 async Task EnsurePackageLoaded ( Guid packageGuid )
0 commit comments