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

Commit c2a74db

Browse files
committed
Catch registry exceptions and log them
1 parent 32a0bb9 commit c2a74db

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
<Compile Include="Helpers\NotificationAwareObject.cs" />
111111
<Compile Include="Services\Connection.cs" />
112112
<Compile Include="Services\ITeamExplorerServiceHolder.cs" />
113+
<Compile Include="Services\Logger.cs" />
113114
<Compile Include="Services\Services.cs" />
114115
<Compile Include="Services\VSServices.cs" />
115116
<Compile Include="Models\IConnection.cs" />

src/GitHub.VisualStudio/Services/Logger.cs renamed to src/GitHub.Exports/Services/Logger.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using GitHub.Info;
22
using System;
3-
using System.Collections.Generic;
43
using System.Diagnostics;
54
using System.Globalization;
65
using System.IO;
76
using System.Text;
8-
using System.Threading;
97

108
namespace GitHub.VisualStudio
119
{

src/GitHub.Exports/Services/VSServices.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public string GetLocalClonePathFromGitProvider()
6161
}
6262
catch (Exception ex)
6363
{
64-
Debug.Fail(ex.ToString());
64+
VsOutputLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error loading the default cloning path from the registry '{0}'", ex));
6565
}
6666
return ret;
6767
}
@@ -91,7 +91,15 @@ public string GetActiveRepoPath()
9191

9292
public IEnumerable<ISimpleRepositoryModel> GetKnownRepositories()
9393
{
94-
return PokeTheRegistryForRepositoryList();
94+
try
95+
{
96+
return PokeTheRegistryForRepositoryList();
97+
}
98+
catch (Exception ex)
99+
{
100+
VsOutputLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error loading the repository list from the registry '{0}'", ex));
101+
return Enumerable.Empty<ISimpleRepositoryModel>();
102+
}
95103
}
96104

97105
const string TEGitKey = @"Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl";

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@
225225
<Compile Include="Helpers\Colors.cs" />
226226
<Compile Include="Helpers\Constants.cs" />
227227
<Compile Include="Services\ConnectionManager.cs" />
228-
<Compile Include="Services\Logger.cs" />
229228
<Compile Include="Services\Program.cs" />
230229
<Compile Include="Services\SharedResources.cs" />
231230
<Compile Include="Settings.cs" />

0 commit comments

Comments
 (0)