Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,18 @@ await Assert.ThrowsAsync<InvalidOperationException>(

public void Dispose()
{
// Best-effort cleanup of the per-test key directory; only the failures a
// filesystem delete can actually produce are worth swallowing.
// Best-effort cleanup of the per-test key directory. A failure must not fail
// the test run, but it is never silent: the leftover path and the reason go to
// the test output, because an empty catch discards the one piece of evidence
// anyone debugging a full temp disk would need.
try
{
Directory.Delete(_keyDirectory, recursive: true);
}
catch (IOException)
{
}
catch (UnauthorizedAccessException)
catch (Exception exception) when (exception is IOException or UnauthorizedAccessException)
{
Console.Error.WriteLine(
$"Test cleanup left '{_keyDirectory}' behind: {exception.Message}");
}
}
}