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

Commit e25391a

Browse files
committed
Add using to avoid crash in Release mode
Somehow putting the `repo` object in a `using` avoids the following issue: #1306
1 parent c8a228c commit e25391a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/GitHub.App/Services/PullRequestService.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ public IObservable<string> GetPullRequestTemplate(ILocalRepositoryModel reposito
8888

8989
public IObservable<bool> IsWorkingDirectoryClean(ILocalRepositoryModel repository)
9090
{
91-
var repo = gitService.GetRepository(repository.LocalPath);
92-
return Observable.Return(!repo.RetrieveStatus().IsDirty);
91+
// The `using` appears to resolve this issue:
92+
// https://github.com/github/VisualStudio/issues/1306
93+
using (var repo = gitService.GetRepository(repository.LocalPath))
94+
{
95+
return Observable.Return(!repo.RetrieveStatus().IsDirty);
96+
}
9397
}
9498

9599
public IObservable<Unit> Pull(ILocalRepositoryModel repository)

0 commit comments

Comments
 (0)