Skip to content

Clarify MatchCasing does not affect directory path resolution#126185

Open
rtmongold wants to merge 5 commits into
dotnet:mainfrom
rtmongold:fix-matchcasing-docs
Open

Clarify MatchCasing does not affect directory path resolution#126185
rtmongold wants to merge 5 commits into
dotnet:mainfrom
rtmongold:fix-matchcasing-docs

Conversation

@rtmongold

Copy link
Copy Markdown

Closes #115356

Summary

This PR clarifies that EnumerationOptions.MatchCasing applies only to file name pattern matching and does not affect directory path resolution.

On case-sensitive file systems (e.g., Linux and macOS), directory paths must match the exact casing even if MatchCasing = CaseInsensitive.

Motivation

Users may assume that MatchCasing affects the full path when performing searches. In reality, it only applies to file name pattern matching, which can be misleading on case-sensitive systems. This update improves documentation to reduce confusion.

Changes

  • Updated XML doc comment in EnumerationOptions.cs (runtime repo)
  • Updated API XML (EnumerationOptions.xml) with <remarks> clarifying:
    • Scope is limited to file name matching
    • Directory paths are unaffected
    • Default behavior is platform-dependent
  • Optional example included in API XML to illustrate Linux behavior

Example (API docs)

Directory.GetFiles("/tmp/data", "*.TXT",
    new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive });

@rtmongold rtmongold left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the tab to spaces.

@rtmongold rtmongold force-pushed the fix-matchcasing-docs branch 3 times, most recently from 3d562c0 to a62ef2d Compare March 27, 2026 17:41
@rtmongold

Copy link
Copy Markdown
Author

This is a docs-only PR. The branch appears to go out of date frequently due to ongoing commits in main.

I’ve rebased to the latest main—happy to rebase again if needed, but it may require a maintainer rebase at merge time.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the EnumerationOptions.MatchCasing API documentation to clarify that it affects only name matching against the search pattern and does not change how directory paths are resolved on case-sensitive file systems.

Changes:

  • Updated the XML doc comment for EnumerationOptions.MatchCasing to scope it to pattern matching.
  • Added remarks stating directory path resolution is unaffected, and casing must still match on case-sensitive file systems.

Comment thread src/libraries/System.Private.CoreLib/src/System/IO/EnumerationOptions.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System/IO/EnumerationOptions.cs Outdated
@rtmongold

Copy link
Copy Markdown
Author

/ba-g networking failure in Helix (devicectl NSPOSIXErrorDomain 49)

@rtmongold

Copy link
Copy Markdown
Author

The WASM Helix job failed due to image pull (Exit Code -4).
This is a known flaky infra issue. Could someone rerun the job? /azp run

rtmongold and others added 3 commits April 3, 2026 02:10
…Options.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Options.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +80 to +84
/// This property affects only how entry names (file and directory names) are matched against the search pattern during enumeration.
/// It does not affect directory path resolution or traversal. On case-sensitive file systems
/// (common on Linux or when using a case-sensitive volume), directory paths must match the exact casing
/// regardless of this setting; on case-insensitive file systems, path resolution follows the behavior
/// of the underlying file system. The default is to match the platform defaults.

@jozkee jozkee Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// This property affects only how entry names (file and directory names) are matched against the search pattern during enumeration.
/// It does not affect directory path resolution or traversal. On case-sensitive file systems
/// (common on Linux or when using a case-sensitive volume), directory paths must match the exact casing
/// regardless of this setting; on case-insensitive file systems, path resolution follows the behavior
/// of the underlying file system. The default is to match the platform defaults.
/// Directory path resolution or traversal is always performed by the operating system's file system layer, independent of this property.
/// The default value is <see cref="MatchCasing.PlatformDefault"/>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.IO.EnumerationOptions.MatchCasing is potentially misleading

3 participants