Skip to content

Stop "Purge verified files" from killing the tray - #775

Merged
SimonCropp merged 2 commits into
mainfrom
fix-file-purger-kills-tray
Aug 21, 2026
Merged

Stop "Purge verified files" from killing the tray#775
SimonCropp merged 2 commits into
mainfrom
fix-file-purger-kills-tray

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Two things had to be true for a purge to take the process down, and both were.

Inner ran on a bare Thread with no try/catch, so anything it threw was an unhandled exception on a non-UI thread — process gone, along with every pending move, every pending delete, and the whole inline queue when this tray owns it.

And it reliably threw. Directory.GetFiles with SearchOption.AllDirectories is the compatibility enumeration: IgnoreInaccessible is false and reparse points are followed. The folder dialog invites the user to pick a profile folder or a drive root, and both hold a deny-ACL junction — Application Data, $Recycle.Bin — so the scan hit UnauthorizedAccessException before it had looked at one file.

Wrap the thread body, and enumerate with EnumerationOptions that ignore what cannot be read and skip reparse points. The scan is now extracted as Find so a test can point it at a directory with a denied subdirectory, which is the shape that failed.

Two things had to be true for a purge to take the process down, and both were.

Inner ran on a bare Thread with no try/catch, so anything it threw was an
unhandled exception on a non-UI thread — process gone, along with every pending
move, every pending delete, and the whole inline queue when this tray owns it.

And it reliably threw. Directory.GetFiles with SearchOption.AllDirectories is
the compatibility enumeration: IgnoreInaccessible is false and reparse points
are followed. The folder dialog invites the user to pick a profile folder or a
drive root, and both hold a deny-ACL junction — Application Data, $Recycle.Bin —
so the scan hit UnauthorizedAccessException before it had looked at one file.

Wrap the thread body, and enumerate with EnumerationOptions that ignore what
cannot be read and skip reparse points. The scan is now extracted as Find so a
test can point it at a directory with a denied subdirectory, which is the shape
that failed.
@SimonCropp SimonCropp added this to the 20.0.0 milestone Aug 21, 2026
@SimonCropp
SimonCropp merged commit 9a30540 into main Aug 21, 2026
8 checks passed
@SimonCropp
SimonCropp deleted the fix-file-purger-kills-tray branch August 21, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant