Repository navigation
Fix scan failures caused by cleanup errors - #1905
Merged
Greg Villicana (grvillic) merged 1 commit intoOct 30, 2026
Merged
Greg Villicana (grvillic) merged 1 commit into
Greg Villicana (grvillic) merged 1 commit into
Conversation
Handle I/O and access errors during cleanup inventory and PipReport report deletion without aborting scans. Skip artifact cleanup when inventory is incomplete, and log the path, exception type, and message without exception stack traces. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 993305b5-0b71-4bbb-9d82-c123b1da01d7
Michael Pysson (mpysson)
requested review from
Jason Paulos (jasonpaulos)
and
a balanced review from Copilot
October 30, 2026 00:17
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Missing regression tests for cleanup inventory errors and generated pip-report deletion failures leave scan continuity and exception-handling boundaries insufficiently verified.
2 open issues
What changed in this PR
This PR prevents optional cleanup I/O and permission errors from aborting Component Detection scans while leaving other exception types unsuppressed.
Changes:
- Handle inventory failures and skip cleanup when the inventory is incomplete.
- Handle failures when deleting generated PipReport files.
- Log affected paths, exception types, and messages at debug level without stack traces.
| File | Description |
|---|---|
src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs |
Handles I/O and permission errors during generated-report deletion. |
src/Microsoft.ComponentDetection.Contracts/FileComponentDetectorWithCleanup.cs |
Extends inventory error handling to I/O failures and updates debug logging. |
Review effort: Balanced
Greg Villicana (grvillic)
approved these changes
Oct 30, 2026
Greg Villicana (grvillic)
enabled auto-merge (squash)
October 30, 2026 00:21
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Prevent optional cleanup failures from aborting Component Detection scans.
Problem
Cleanup inventories the files and directories around a manifest before and after detector processing. If a directory disappears or enumeration encounters another I/O error, the exception can escape and fail the scan.
PipReport also deletes generated report files in a
finallyblock. An I/O or permission error during deletion can escape that block, aborting the scan even after components have been recorded.Solution
IOExceptionandUnauthorizedAccessExceptionduring cleanup inventory (FileComponentDetectorWithCleanup.cs:163–171).PipReportComponentDetector.cs:348–360).Other exception types are not suppressed by these cleanup handlers. The existing
reportFile.ExistsandreportFile.Delete()implementation is preserved.