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

Commit e7c1f4d

Browse files
committed
Use UIThreadNormalPriority with logging
1 parent 6166b0d commit e7c1f4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/GitHub.InlineReviews/PullRequestStatusBarPackage.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using System;
22
using System.Threading;
33
using System.Runtime.InteropServices;
4-
using GitHub.Helpers;
4+
using GitHub.Logging;
55
using GitHub.Services;
66
using GitHub.VisualStudio;
77
using GitHub.InlineReviews.Services;
88
using Microsoft.VisualStudio.Shell;
9+
using Serilog;
910
using Task = System.Threading.Tasks.Task;
1011

1112
namespace GitHub.InlineReviews
@@ -15,6 +16,8 @@ namespace GitHub.InlineReviews
1516
[ProvideAutoLoad(Guids.UIContext_Git, PackageAutoLoadFlags.BackgroundLoad)]
1617
public class PullRequestStatusBarPackage : AsyncPackage
1718
{
19+
static readonly ILogger log = LogManager.ForContext<PullRequestStatusBarPackage>();
20+
1821
/// <summary>
1922
/// Initialize the PR status UI on Visual Studio's status bar.
2023
/// </summary>
@@ -24,7 +27,12 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
2427
var serviceProvider = (IGitHubServiceProvider)await GetServiceAsync(typeof(IGitHubServiceProvider));
2528
var barManager = new PullRequestStatusBarManager(usageTracker, serviceProvider);
2629

27-
await ThreadingHelper.SwitchToMainThreadAsync();
30+
log.Information("SwitchToMainThreadAsync");
31+
await JoinableTaskFactory
32+
.WithPriority(VsTaskRunContext.UIThreadNormalPriority)
33+
.SwitchToMainThreadAsync();
34+
35+
log.Information("StartShowingStatus");
2836
barManager.StartShowingStatus();
2937
}
3038
}

0 commit comments

Comments
 (0)