Skip to content
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

Fix building slnf with @ in the path #11421

Merged
merged 12 commits into from
Mar 10, 2025
Merged

Conversation

surayya-MS
Copy link
Member

@surayya-MS surayya-MS commented Feb 11, 2025

Context

Fixes #11050

If the path to the solution file contains @, it builds normally. But, if solution filter references this solution then the build fails:

{my-path-to}/bugtest%40commithash/Solution/Solution.sln : Solution file error MSB5026: The solution filter file at "{my-path-to}/bugtest@commithash/Solution/Test.slnf" specifies there will be a solution file at "{my-path-to}/bugtest%40commithash/Solution/Solution.sln", but that file does not exist.

same happens with other symbols like % and $.

See the issue description for more details.

Details

The problem occurs on this line:

return FileUtilities.GetFullPath(solution.GetProperty("path").GetString(), Path.GetDirectoryName(solutionFilterFile));

FileUtilities.GetFullPath changes @ to %40.

Specifically this happens here:

string fullPath = EscapingUtilities.Escape(NormalizePath(Path.Combine(currentDirectory, fileSpec)));

Changes

Added bool escape param to FileUtilities.GetFullPath to be able to skip escape for getting solution path from solution filter (.slnf) json

Testing

Added new test to cover this scenario

@Mik4sa
Copy link

Mik4sa commented Feb 15, 2025

Could this PR maybe also fix #11442?

@surayya-MS
Copy link
Member Author

Could this PR maybe also fix #11442?

This is probably not related. The bug that this PR fixes is not recent and existed before. The one you described looks like a regression. Nevertheless, we will fix it soon. Thanks for reporting!

@Mik4sa
Copy link

Mik4sa commented Feb 18, 2025

hmm too bad but thank you for your time and feedback :)
I'm looking forward to a fix :)

@surayya-MS surayya-MS merged commit 79c777a into dotnet:main Mar 10, 2025
10 checks passed
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.

Fatal crash if solution filter is built from within a path that contains an @ sign
5 participants