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

Commit cb26608

Browse files
committed
Use JoinableTaskFactory from parent AsyncPackage
1 parent 0504119 commit cb26608

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/GitHub.VisualStudio/UI/GitHubPane.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public GitHubPane() : base(null)
8080

8181
protected override void Initialize()
8282
{
83-
viewModelTask = ThreadHelper.JoinableTaskFactory.RunAsync(InitializeAsync);
83+
// Using JoinableTaskFactory from parent AsyncPackage. That way if VS shuts down before this
84+
// work is done, we won't risk crashing due to arbitrary work going on in background threads.
85+
var asyncPackage = (AsyncPackage)Package;
86+
viewModelTask = asyncPackage.JoinableTaskFactory.RunAsync(InitializeAsync);
8487
}
8588

8689
public Task<IGitHubPaneViewModel> GetViewModelAsync() => viewModelTask.JoinAsync();

0 commit comments

Comments
 (0)