C#: Fix the cs/path-combine code quality issues in the extractor.#21996
Draft
michaelnebel wants to merge 3 commits into
Draft
C#: Fix the cs/path-combine code quality issues in the extractor.#21996michaelnebel wants to merge 3 commits into
cs/path-combine code quality issues in the extractor.#21996michaelnebel wants to merge 3 commits into
Conversation
cs/path-combine code quality issues in the extractor.
16e853c to
3364c20
Compare
Contributor
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
| } | ||
|
|
||
| return Path.GetFullPath(Path.Combine(projDir?.FullName ?? string.Empty, Path.DirectorySeparatorChar == '/' ? file.Replace("\\", "/") : file)); | ||
| return Path.GetFullPath(Path.Join(projDir?.FullName ?? string.Empty, Path.DirectorySeparatorChar == '/' ? file.Replace("\\", "/") : file)); |
Contributor
Author
There was a problem hiding this comment.
I will look into what can happen in this particular case.
Contributor
Author
There was a problem hiding this comment.
This is a good point as the .csproj files can contain both relative and absolute paths.
Contributor
Author
There was a problem hiding this comment.
For the same reason, I have also looked through all other cases and tried to decide when we actually "want" to support the dropping semantics.
27c1900 to
03b525b
Compare
hvitved
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note, that the reason why
Path.Combineis discouraged is because it is considered "vulnerable" to path injection attacks. Arguments prior to an argument with a rooted path are dropped. For that reasonPath.Joinis preferred overPath.Combine(asPath.Joindoesn't drop any arguments). However, when replacing the uses ofPath.CombinewithPath.Joinwe need to re-write the cases where we actually rely on the "dropping" semantics ofPath.Combine- but then it will also be more obvious that we are not accidentally dropping any arguments.DCA looks good.