Skip to content

Commit

Permalink
Fixed bug, thanks @Greooo (#244 (comment))
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Jan 20, 2016
1 parent 2462778 commit 197fde4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion buildConfig.fsx
Expand Up @@ -36,7 +36,7 @@ let projectDescription_roslyn = "RazorEngine.Roslyn - Roslyn support for RazorEn
// !!!!!!!!!!!!!!!!!!!
// UPDATE RELEASE NOTES AS WELL!
// !!!!!!!!!!!!!!!!!!!
let version_razor4 = "4.2.6-beta1"
let version_razor4 = "4.2.7-beta1"
let version_roslyn = "3.5.5-beta1"
let version_roslyn_razor4 = "4.0.5-beta1"

Expand Down
6 changes: 5 additions & 1 deletion doc/ReleaseNotes.md
@@ -1,4 +1,8 @@
### 3.7.6 / 4.2.6-beta1
### 3.7.7 / 4.2.7-beta1

* Fixed bug, thanks @Greooo (https://github.com/Antaris/RazorEngine/issues/244#issuecomment-173322177)

### 3.7.6 / 4.2.6-beta1

* Fix https://github.com/Antaris/RazorEngine/pull/348

Expand Down
27 changes: 19 additions & 8 deletions src/source/RazorEngine.Core/Compilation/CrossAppDomainCleanUp.cs
Expand Up @@ -262,8 +262,10 @@ private bool DoCleanUp()
{
bool success = true;
string item;
var failedFiles = new Queue<string>();
while (_toCleanup.TryDequeue(out item))
{
Exception error = null;
if (File.Exists(item))
{
try
Expand All @@ -272,13 +274,11 @@ private bool DoCleanUp()
}
catch (IOException exn)
{
success = false;
_printer.PrintError("Could not delete {0}: {1}", item, exn.ToString());
error = exn;
}
catch (UnauthorizedAccessException exn)
{
success = false;
_printer.PrintError("Could not delete {0}: {1}", item, exn.ToString());
error = exn;
}
}
if (Directory.Exists(item))
Expand All @@ -289,16 +289,27 @@ private bool DoCleanUp()
}
catch (IOException exn)
{
success = false;
_printer.PrintError("Could not delete {0}: {1}", item, exn.ToString());
error = exn;
}
catch (UnauthorizedAccessException exn)
{
success = false;
_printer.PrintError("Could not delete {0}: {1}", item, exn.ToString());
error = exn;
}
}

if (error != null)
{
success = false;
failedFiles.Enqueue(item);
_printer.PrintError("Could not delete {0}: {1}", item, error.ToString());
}
}

while (failedFiles.Count > 0)
{
_toCleanup.Enqueue(failedFiles.Dequeue());
}

return success;
}

Expand Down

0 comments on commit 197fde4

Please sign in to comment.