Skip to content

Commit 2d97bfb

Browse files
author
Samir Boulema
committed
fix: Crash in VS 2022 after start, making it unusable #76
1 parent bea5957 commit 2d97bfb

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

TGit/Helpers/FileHelper.cs

+22-13
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,33 @@ public static string GetMSysGit()
3333
/// <returns>Path to the base repository/solution dir</returns>
3434
public static async Task<string> GetSolutionDir()
3535
{
36-
var solution = await VS.Solutions.GetCurrentSolutionAsync();
36+
try
37+
{
38+
var solution = await VS.Solutions.GetCurrentSolutionAsync();
3739

38-
var filePath = solution?.FullPath;
40+
var filePath = solution?.FullPath;
3941

40-
if (string.IsNullOrEmpty(filePath))
41-
{
42-
return string.Empty;
43-
}
42+
if (string.IsNullOrEmpty(filePath))
43+
{
44+
return string.Empty;
45+
}
4446

45-
if (File.Exists(filePath))
46-
{
47-
var path = Path.GetDirectoryName(filePath);
48-
return await FindGitdir(path);
49-
}
47+
if (File.Exists(filePath))
48+
{
49+
var path = Path.GetDirectoryName(filePath);
50+
return await FindGitdir(path);
51+
}
52+
53+
if (Directory.Exists(filePath))
54+
{
55+
return await FindGitdir(filePath);
56+
}
5057

51-
if (Directory.Exists(filePath))
58+
return string.Empty;
59+
}
60+
catch (Exception)
5261
{
53-
return await FindGitdir(filePath);
62+
// No open solution
5463
}
5564

5665
return string.Empty;

TGit/Options/General.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using Community.VisualStudio.Toolkit;
22
using System.ComponentModel;
3+
using System.Runtime.InteropServices;
34

45
namespace SamirBoulema.TGit
56
{
67
internal partial class OptionsProvider
78
{
9+
[ComVisible(true)]
810
public class GeneralOptions : BaseOptionPage<General> { }
911
}
1012

TGit/TGit.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,15 @@
351351
</ItemGroup>
352352
<ItemGroup>
353353
<PackageReference Include="Community.VisualStudio.Toolkit.15">
354-
<Version>15.0.339</Version>
354+
<Version>15.0.445</Version>
355355
</PackageReference>
356356
<PackageReference Include="Community.VisualStudio.VSCT">
357357
<Version>16.0.29.6</Version>
358358
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
359359
<PrivateAssets>all</PrivateAssets>
360360
</PackageReference>
361361
<PackageReference Include="Microsoft.VSSDK.BuildTools">
362-
<Version>17.0.5232</Version>
362+
<Version>17.1.4057</Version>
363363
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
364364
<PrivateAssets>all</PrivateAssets>
365365
</PackageReference>

0 commit comments

Comments
 (0)