Stop "Purge verified files" from killing the tray - #775
Merged
Conversation
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.
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.
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.