Skip to content

Fix escaping of UNC project paths containing spaces - #38719

Open
innwayyy wants to merge 1 commit into
dotnet:mainfrom
innwayyy:innwayyy/fixPathEscaping
Open

Fix escaping of UNC project paths containing spaces#38719
innwayyy wants to merge 1 commit into
dotnet:mainfrom
innwayyy:innwayyy/fixPathEscaping

Conversation

@innwayyy

@innwayyy innwayyy commented Jul 30, 2026

Copy link
Copy Markdown

Fixes #38675

dotnet-ef incorrectly escaped backslashes in UNC project paths when generating the dotnet msbuild argument list. As a result, paths starting with \\FILESERVER were passed as \\\\FILESERVER.

This change preserves the UNC prefix while continuing to quote paths containing spaces.

A regression test was added that fails before the fix and passes after it.

  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
Summary of the changes

- Detail 1
- Detail 2

Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

- Preserve consecutive backslashes unless quoting requires escaping
- Add regression coverage for UNC paths containing spaces

Fixes dotnet#38675
@innwayyy
innwayyy requested a review from a team as a code owner July 30, 2026 07:44
@innwayyy

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

@AndriySvyryd AndriySvyryd self-assigned this Jul 30, 2026
@AndriySvyryd
AndriySvyryd requested a review from Copilot July 30, 2026 18:53
@AndriySvyryd AndriySvyryd added this to the 12.0.0 milestone Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect escaping of backslashes in dotnet-ef argument-string generation for quoted (space-containing) UNC paths, ensuring the leading \\SERVER prefix is preserved when invoking dotnet msbuild.

Changes:

  • Adjusted Exe.ToArguments to emit pending backslashes verbatim when they are not escaping a " or the closing quote.
  • Updated the existing argument-escaping unit test expectation to match correct backslash handling.
  • Added a regression test covering UNC paths with spaces to prevent reintroducing the \\\\SERVER behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/dotnet-ef/Exe.cs Fixes backslash emission logic so quoted UNC paths keep the \\ prefix (no unintended doubling).
test/dotnet-ef.Tests/ExeTest.cs Updates existing expectation and adds a targeted regression test for UNC-prefix handling.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet-ef fails to retrieve metadata for UNC project paths containing spaces

3 participants