Skip to content

Commit 56803b3

Browse files
committed
fix(core): temp-dir cleanup must not flip cancelled runs to failed
ReportRunner's finally block deleted the per-job temp dir but caught only IOException. On Windows a briefly-locked file throws UnauthorizedAccessException, which escaped finally and replaced an in-flight OperationCanceledException — so a cancelled job was recorded as Failed. Catch broadly: cleanup is best-effort and must never change the outcome. Fixes the two cancellation jobs tests.
1 parent d3543a1 commit 56803b3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/NeoReports.Core/Pipeline/ReportRunner.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,12 @@ await writer.InitializeAsync(
217217
if (Directory.Exists(tempDir))
218218
Directory.Delete(tempDir, recursive: true);
219219
}
220-
catch (IOException)
220+
catch (Exception)
221221
{
222-
// Best-effort cleanup; a leftover temp file must not fail a completed report.
222+
// Best-effort cleanup: a leftover temp file must never change the job's outcome.
223+
// Catch broadly (IOException, UnauthorizedAccessException when a file is briefly
224+
// locked on Windows, etc.) so cleanup cannot replace an in-flight cancellation
225+
// exception and turn a cancelled run into a failed one.
223226
}
224227
}
225228
}

0 commit comments

Comments
 (0)