Call to System.IO.Path.Combine¶
ID: cs/path-combine
Kind: problem
Security severity:
Severity: recommendation
Precision: very-high
Tags:
- reliability
Query suites:
- csharp-security-and-quality.qls
Click to see the query in the CodeQL repository
Path.Combine
may silently drop its earlier arguments if its later arguments are absolute paths. E.g. Path.Combine("C:\\Users\\Me\\Documents", "C:\\Program Files\\") == "C:\\Program Files"
.
Recommendation¶
Use Path.Join
instead.
References¶
Microsoft Learn, .NET API browser, Path.Combine.
Microsoft Learn, .NET API browser, Path.Join.