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

Commit 04fed2c

Browse files
committed
Lock VSGitExt.RefreshActiveRepositories
Wait on a lock in `VSGitExt.RefreshActiveRepositories` so that `ActiveRepositoriesChanged` notifications are raised in the correct order. Fixes #1493
1 parent 54bd6d5 commit 04fed2c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/GitHub.TeamFoundation.14/Services/VSGitExt.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class VSGitExt : IVSGitExt
2424
readonly IGitHubServiceProvider serviceProvider;
2525
readonly IVSUIContext context;
2626
readonly ILocalRepositoryModelFactory repositoryFactory;
27+
readonly object refreshLock = new object();
2728

2829
IGitExt gitService;
2930
IReadOnlyList<ILocalRepositoryModel> activeRepositories;
@@ -98,12 +99,15 @@ void RefreshActiveRepositories()
9899
{
99100
try
100101
{
101-
log.Debug(
102-
"IGitExt.ActiveRepositories (#{Id}) returned {Repositories}",
103-
gitService.GetHashCode(),
104-
gitService?.ActiveRepositories.Select(x => x.RepositoryPath));
102+
lock (refreshLock)
103+
{
104+
log.Debug(
105+
"IGitExt.ActiveRepositories (#{Id}) returned {Repositories}",
106+
gitService.GetHashCode(),
107+
gitService?.ActiveRepositories.Select(x => x.RepositoryPath));
105108

106-
ActiveRepositories = gitService?.ActiveRepositories.Select(x => repositoryFactory.Create(x.RepositoryPath)).ToList();
109+
ActiveRepositories = gitService?.ActiveRepositories.Select(x => repositoryFactory.Create(x.RepositoryPath)).ToList();
110+
}
107111
}
108112
catch (Exception e)
109113
{

0 commit comments

Comments
 (0)