Skip to content

Reject directories for FileInfo existing validation#2816

Closed
marko1olo wants to merge 1 commit into
dotnet:mainfrom
marko1olo:fix-fileinfo-existing-directory-validation
Closed

Reject directories for FileInfo existing validation#2816
marko1olo wants to merge 1 commit into
dotnet:mainfrom
marko1olo:fix-fileinfo-existing-directory-validation

Conversation

@marko1olo

Copy link
Copy Markdown

Fixes #2723.

Summary:

  • Makes AcceptExistingOnly() for FileInfo require an existing file, not an existing directory.
  • Keeps DirectoryInfo validation directory-specific and FileSystemInfo validation accepting either files or directories.
  • Adds focused regression coverage for Argument<FileInfo>, Option<FileInfo>, and enumerable FileInfo paths, plus FileSystemInfo file/directory acceptance coverage.

Checks:

  • git diff --check HEAD~1 HEAD

Attempted but blocked:

  • dotnet test src\System.CommandLine.Tests\System.CommandLine.Tests.csproj --filter "FullyQualifiedName~ParsingValidationTests+FileExistence" --no-restore
  • Blocker: global.json requests .NET SDK 11.0.100-preview.4.26210.111, while this machine has SDK 10.0.202.

AI assistance disclosure:

  • OpenAI Codex assisted with this change; the commit includes Co-authored-by: OpenAI Codex <codex@openai.com>.

Co-authored-by: OpenAI Codex <codex@openai.com>
@marko1olo marko1olo closed this by deleting the head repository Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AcceptExistingOnly for FileInfo accepts existing directories

1 participant