Skip to content

Commit

Permalink
fix: Crash in VS 2022 after start, making it unusable #76
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir Boulema committed May 11, 2022
1 parent bea5957 commit 2d97bfb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
35 changes: 22 additions & 13 deletions TGit/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,33 @@ public static string GetMSysGit()
/// <returns>Path to the base repository/solution dir</returns>
public static async Task<string> GetSolutionDir()
{
var solution = await VS.Solutions.GetCurrentSolutionAsync();
try
{
var solution = await VS.Solutions.GetCurrentSolutionAsync();

var filePath = solution?.FullPath;
var filePath = solution?.FullPath;

if (string.IsNullOrEmpty(filePath))
{
return string.Empty;
}
if (string.IsNullOrEmpty(filePath))
{
return string.Empty;
}

if (File.Exists(filePath))
{
var path = Path.GetDirectoryName(filePath);
return await FindGitdir(path);
}
if (File.Exists(filePath))
{
var path = Path.GetDirectoryName(filePath);
return await FindGitdir(path);
}

if (Directory.Exists(filePath))
{
return await FindGitdir(filePath);
}

if (Directory.Exists(filePath))
return string.Empty;
}
catch (Exception)
{
return await FindGitdir(filePath);
// No open solution
}

return string.Empty;
Expand Down
2 changes: 2 additions & 0 deletions TGit/Options/General.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Community.VisualStudio.Toolkit;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace SamirBoulema.TGit
{
internal partial class OptionsProvider
{
[ComVisible(true)]
public class GeneralOptions : BaseOptionPage<General> { }
}

Expand Down
4 changes: 2 additions & 2 deletions TGit/TGit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Community.VisualStudio.Toolkit.15">
<Version>15.0.339</Version>
<Version>15.0.445</Version>
</PackageReference>
<PackageReference Include="Community.VisualStudio.VSCT">
<Version>16.0.29.6</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools">
<Version>17.0.5232</Version>
<Version>17.1.4057</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 2d97bfb

Please sign in to comment.