-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory.EnumerateFiles
does not respect per-directory case-sensitivity setting
#39370
Comments
Thanks for the details. Changing the default behavior of The related issue you shared #34235 has the API proposal to detect sensitivity for the folder. Feel free to also propose adding an API that sets the directory sensitivity at the global level, as you did in your code by modifying the registry. If there isn't anything else, I can close this issue as a duplicate of #34235 and we can continue the conversation there. |
I don't want |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This issue will now be closed since it had been marked |
See also #34235. Area
System.IO
.Description
Summary
After creating
file.txt
andFILE.txt
in a directory configured to be case-sensitive, runningDirectory.EnumerateFiles
against it with a pattern off*
returns two elements instead of one, whereFindFirstFileEx
returns just the one.Test result
Enable
NtfsEnableDirCaseSensitivity
globally (optional, recommended)Have to elevate Visual Studio or review/enable/disable/reset opting into case-sensitivity (global setting) from elevated PowerShell before running the test:
Manually set the current directory to be case-sensitive
Not required, for demonstration purposes:
Useful links
Perhaps these:
XUnit test
Create project:
Add references:
Test:
Configuration
Regression?
No. Haven't checked, but no.
Opinion
There is an overload of
Directory.EnumerateFiles
which takesEnumerationOptions
that can have itsMatchCasing
property set toMatchCasing.CaseSensitive
, but it might be more convenient, useful and correct to auto-detect case-sensitivity on behalf of the caller on a directory-by-directory basis through the use of perhapsNtQueryInformationFile
once per directory during enumeration. Such behavior can today not be specified in any way.It is slightly disappointing to see the complexity of the imlementation of
EnumerateFiles
and similar, doing pattern patching and calling intoNtXxx
instead of more regular Win32 API surface, since that complicates implementing any feature like this.The text was updated successfully, but these errors were encountered: