You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CleanupPreScanService sizes both temp folders with Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories). Three defects follow from that one call, and the codebase already diagnosed and fixed all three elsewhere:
It aborts at the first unreadable subfolder.AllDirectories throws UnauthorizedAccessException out of MoveNext(), and the try sits outside the foreach — so the whole remaining walk for that path is abandoned and the headline reports whatever had been summed so far. Silently low, with no indication anything was skipped.
It follows reparse points. A junction inside %TEMP% is walked as if it were a real folder, so bytes living outside temp are counted as freeable. MeasureRecycleBin has the same call and the same exposure, where it is worse: deleting a junction puts a reparse point in the Recycle Bin, so the bin can size at tens of GB of live data.
TuneUpService.EnumerateFilesSkippingReparsePoints exists precisely for this and solves all three: per-directory try/catch that continues, reparse-point skip at the root and every child, and exclusion subtrees.
Expected behavior
The pre-scan measures what the cleanup would actually delete, using the same walker and the same two exclusions. An unreadable subfolder is skipped, not treated as the end of the tree.
Evidence
SysManager/SysManager/Services/CleanupPreScanService.cs — MeasureTemp and MeasureRecycleBin
ArchitectureTests.EveryTempTreeWalkerCall_PassesBothExtractionExclusions cannot see this: its walker-argument half is scoped to a hardcoded ["TuneUpService.cs", "DeepCleanupService.cs"], the same hardcoded-list weakness that let the third sweeper hide in CleanupViewModel for months.
Also in the same file: ICleanupPreScanService's doc offers "Unable to scan" as a possible TempLabel, which MeasureTemp cannot return — it catches per-path and always ends at Describe.
Problem
CleanupPreScanServicesizes both temp folders withDirectory.EnumerateFiles(path, "*", SearchOption.AllDirectories). Three defects follow from that one call, and the codebase already diagnosed and fixed all three elsewhere:AllDirectoriesthrowsUnauthorizedAccessExceptionout ofMoveNext(), and thetrysits outside theforeach— so the whole remaining walk for that path is abandoned and the headline reports whatever had been summed so far. Silently low, with no indication anything was skipped.%TEMP%is walked as if it were a real folder, so bytes living outside temp are counted as freeable.MeasureRecycleBinhas the same call and the same exposure, where it is worse: deleting a junction puts a reparse point in the Recycle Bin, so the bin can size at tens of GB of live data.SystemPaths.BundleExtractionRootandSystemPaths.OwnExtractionDirectory. The pre-scan does not, so the headline promises space that Clean TEMP will correctly leave alone.TuneUpService.EnumerateFilesSkippingReparsePointsexists precisely for this and solves all three: per-directory try/catch that continues, reparse-point skip at the root and every child, and exclusion subtrees.Expected behavior
The pre-scan measures what the cleanup would actually delete, using the same walker and the same two exclusions. An unreadable subfolder is skipped, not treated as the end of the tree.
Evidence
SysManager/SysManager/Services/CleanupPreScanService.cs—MeasureTempandMeasureRecycleBinSysManager/SysManager/Services/TuneUpService.cs—EnumerateFilesSkippingReparsePointsArchitectureTests.EveryTempTreeWalkerCall_PassesBothExtractionExclusionscannot see this: its walker-argument half is scoped to a hardcoded["TuneUpService.cs", "DeepCleanupService.cs"], the same hardcoded-list weakness that let the third sweeper hide inCleanupViewModelfor months.Also in the same file:
ICleanupPreScanService's doc offers "Unable to scan" as a possibleTempLabel, whichMeasureTempcannot return — it catches per-path and always ends atDescribe.Affected tab
Cleanup