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

Commit 2eb687c

Browse files
committed
Switch to UI thread in ActiveRepositoriesChanged.
`IVSGitExt.ActiveRepositoriesChanged` isn't notified on the UI thread which breaks things. Switch to the main thread when refreshing due to a notification from this.
1 parent 2a85875 commit 2eb687c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using GitHub.App;
1111
using GitHub.Extensions;
1212
using GitHub.Factories;
13+
using GitHub.Helpers;
1314
using GitHub.Logging;
1415
using GitHub.Models;
1516
using GitHub.Services;
@@ -493,7 +494,18 @@ protected override void Dispose(bool disposing)
493494
}
494495
}
495496

496-
void ActiveRepositoriesChanged() => Refresh().Forget();
497+
async void ActiveRepositoriesChanged()
498+
{
499+
try
500+
{
501+
await ThreadingHelper.SwitchToMainThreadAsync();
502+
await Refresh();
503+
}
504+
catch (Exception ex)
505+
{
506+
log.Error(ex, "Error refreshing in ActiveRepositoriesChanged.");
507+
}
508+
}
497509

498510
void SubscribeOperationError(ReactiveCommand<Unit> command)
499511
{

0 commit comments

Comments
 (0)