This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Windows ;
23using System . Threading ;
34using System . Runtime . InteropServices ;
4- using GitHub . Helpers ;
55using GitHub . Services ;
66using GitHub . VisualStudio ;
77using GitHub . InlineReviews . Services ;
@@ -23,9 +23,12 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
2323 var usageTracker = ( IUsageTracker ) await GetServiceAsync ( typeof ( IUsageTracker ) ) ;
2424 var serviceProvider = ( IGitHubServiceProvider ) await GetServiceAsync ( typeof ( IGitHubServiceProvider ) ) ;
2525
26- await ThreadingHelper . SwitchToMainThreadAsync ( ) ;
27- var gitExt = serviceProvider . GetService < IVSGitExt > ( ) ;
28- new PullRequestStatusBarManager ( gitExt , usageTracker , serviceProvider ) ;
26+ // NOTE: ThreadingHelper.SwitchToMainThreadAsync() doesn't return until a solution is loaded. Using Dispatcher.Invoke instead.
27+ Application . Current . Dispatcher . Invoke ( ( ) =>
28+ {
29+ var gitExt = serviceProvider . GetService < IVSGitExt > ( ) ;
30+ new PullRequestStatusBarManager ( gitExt , usageTracker , serviceProvider ) ;
31+ } ) ;
2932 }
3033 }
3134}
Original file line number Diff line number Diff line change 1111using GitHub . VisualStudio ;
1212using GitHub . Models ;
1313using GitHub . Logging ;
14- using GitHub . Helpers ;
1514using GitHub . Extensions ;
1615using Serilog ;
17- using Task = System . Threading . Tasks . Task ;
1816
1917namespace GitHub . InlineReviews . Services
2018{
@@ -44,17 +42,15 @@ void OnActiveRepositoriesChanged()
4442 {
4543 if ( gitExt . ActiveRepositories . Count > 0 )
4644 {
47- StartShowingStatus ( ) . Forget ( ) ;
4845 gitExt . ActiveRepositoriesChanged -= OnActiveRepositoriesChanged ;
46+ Application . Current . Dispatcher . Invoke ( ( ) => StartShowingStatus ( ) ) ;
4947 }
5048 }
5149
52- async Task StartShowingStatus ( )
50+ void StartShowingStatus ( )
5351 {
5452 try
5553 {
56- await ThreadingHelper . SwitchToMainThreadAsync ( ) ; // Switch from VSGitExt to Main thread
57-
5854 // Create just in time on Main thread.
5955 pullRequestSessionManager = serviceProvider . GetService < IPullRequestSessionManager > ( ) ;
6056
You can’t perform that action at this time.
0 commit comments