Skip to content

Commit e1be204

Browse files
committed
Mitigate Submodule_RecognizedWithCorrectVersion instability
This works around https://github.com/patrickb8man/7z.NET/issues/2
1 parent 2ad35fe commit e1be204

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/NerdBank.GitVersioning.Tests/TestUtilities.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,18 @@ internal static ExpandedRepo ExtractRepoArchive(string repoArchiveName)
6666
ExtractEmbeddedResource($"repos.{repoArchiveName}.7z", archiveFilePath);
6767
try
6868
{
69-
var extractor = new SevenZipExtractor(archiveFilePath);
70-
extractor.ExtractAll(expandedFolderPath);
71-
return new ExpandedRepo(expandedFolderPath);
69+
for (int retryCount = 0; ; retryCount++)
70+
{
71+
try
72+
{
73+
var extractor = new SevenZipExtractor(archiveFilePath);
74+
extractor.ExtractAll(expandedFolderPath);
75+
return new ExpandedRepo(expandedFolderPath);
76+
}
77+
catch (System.ComponentModel.Win32Exception) when (retryCount < 2)
78+
{
79+
}
80+
}
7281
}
7382
finally
7483
{

0 commit comments

Comments
 (0)