Skip to content

Commit d0fc7eb

Browse files
authored
Merge pull request #226 from dotnetprojects/bugfix/stackOverflowExceptionGitHandler
prevent stack overflow exception when TiaGitHandler cannot delete fil…
2 parents 0eed6bf + 860f338 commit d0fc7eb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

TiaGitHandler/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,7 @@ public static void DeleteDirectory(string path)
12341234
DeleteDir(path);
12351235
}
12361236

1237+
static int DeleteDirCounter = 0;
12371238
private static void DeleteDir(string dir)
12381239
{
12391240
try
@@ -1243,10 +1244,16 @@ private static void DeleteDir(string dir)
12431244
}
12441245
catch (IOException)
12451246
{
1247+
DeleteDirCounter++;
1248+
if (DeleteDirCounter > 10)
1249+
throw;
12461250
DeleteDir(dir);
12471251
}
12481252
catch (UnauthorizedAccessException)
12491253
{
1254+
DeleteDirCounter++;
1255+
if (DeleteDirCounter > 10)
1256+
throw;
12501257
DeleteDir(dir);
12511258
}
12521259
}

0 commit comments

Comments
 (0)