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

Commit 7a64b1f

Browse files
authored
Merge pull request #1311 from github/fixes/1306-retrieve-status-crash
Add using to avoid crash in Release mode
2 parents 554b193 + 39ec3b4 commit 7a64b1f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ public IObservable<IReadOnlyList<CommitMessage>> GetMessagesForUniqueCommits(
102102

103103
public IObservable<bool> IsWorkingDirectoryClean(ILocalRepositoryModel repository)
104104
{
105-
var repo = gitService.GetRepository(repository.LocalPath);
106-
var isClean = !IsFilthy(repo.RetrieveStatus());
107-
return Observable.Return(isClean);
105+
// The `using` appears to resolve this issue:
106+
// https://github.com/github/VisualStudio/issues/1306
107+
using (var repo = gitService.GetRepository(repository.LocalPath))
108+
{
109+
var isClean = !IsFilthy(repo.RetrieveStatus());
110+
return Observable.Return(isClean);
111+
}
108112
}
109113

110114
static bool IsFilthy(RepositoryStatus status)

0 commit comments

Comments
 (0)