Fixes FileDialog hiding hidden/system entries (dotfiles) after IgnoreInaccessible change#5581
Merged
Conversation
…Inaccessible change
The switch to EnumerateDirectories/EnumerateFileSystemInfos with
EnumerationOptions { IgnoreInaccessible = true } (from the #5544 follow-up)
kept the framework default AttributesToSkip = Hidden | System, so the file
dialog silently filtered out hidden/system entries — including dotfiles on
Unix, which .NET marks as Hidden. The GetDirectories ()/GetFileSystemInfos ()
calls it replaced never skipped them.
- Clear AttributesToSkip (FileAttributes.None) so hidden/system entries stay
visible while still ignoring inaccessible ones.
- Fall back to the eager listing methods when the IFileSystem implementation
throws NotSupportedException for the non-default AttributesToSkip (e.g.
System.IO.Abstractions.TestingHelpers MockFileSystem).
- Add regression tests covering the enumeration options, the fallback, and
hidden/system files via MockFileSystem.
Flagged by Codex review on #5580.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes the regression flagged by Codex review on #5580 (review comment): the
FileDialogchange that adoptedEnumerationOptions { IgnoreInaccessible = true }(follow-up to #5544) kept the framework defaultAttributesToSkip = Hidden | System, so the dialog silently stopped listing hidden/system entries — including dotfiles on Unix, which .NET marks asHidden. TheGetDirectories ()/GetFileSystemInfos ()calls it replaced never skipped them.Changes
FileDialogState: ClearAttributesToSkip(FileAttributes.None) on the sharedEnumerationOptionsso hidden/system entries remain visible while inaccessible ones are still ignored.IFileSystemimplementations that reject non-defaultAttributesToSkip:System.IO.Abstractions.TestingHelpersMockFileSystemthrowsNotSupportedExceptionfor anyAttributesToSkipother thanHidden | System(its default; not yet implemented upstream). Without the fallback that exception was swallowed and the dialog listed nothing for such file systems.AddReadableChildrennow catchesNotSupportedExceptionand falls back to the eagerGetDirectories ()/GetFileSystemInfos ()listing, which never skips hidden/system entries.Tests
FileDialog_MixedMode_EnumerationDoesNotSkipHiddenOrSystemEntries/FileDialog_DirectoryMode_EnumerationDoesNotSkipHiddenOrSystemEntries— capture theEnumerationOptionspassed to the enumeration calls and assertIgnoreInaccessible == trueandAttributesToSkip == FileAttributes.None.FileDialog_MixedMode_WhenEnumerationOptionsUnsupported_FallsBackToEagerListing/FileDialog_DirectoryMode_WhenEnumerationOptionsUnsupported_FallsBackToEagerListing— assert theNotSupportedExceptionfallback path lists entries.FileDialog_MixedMode_ListsHiddenAndSystemFiles— end-to-end viaMockFileSystemwithHiddenandSystemattributed files.All 17,544 UnitTestsParallelizable tests and 42 IntegrationTests FileDialog tests pass.
Note for the v2.4.17 release (#5580): this should be merged to
developand flowed into the release branch before shipping, since the regression is part of the pending release.🤖 Generated with Claude Code