`Path.Combine`, `HasExtension`, `GetFileName` docs still describe .NET Framework volume-separator (`:`) handling
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
打开 xml/System.IO/Path.xml,找到 issue 中提到的 Combine、HasExtension 和 GetFileName 重载的文档。将它们的备注和返回值文本与现代行为以及提供的 .NET Framework 示例进行比较。完成标准是所有受影响的措辞都描述当前的分隔符处理方式,并指出卷分隔符行为是 .NET Framework 特有的。
由索引模型根据 Issue 内容生成。
描述
Type of issue
Outdated article
Description
Several docs related to System.IO.Path APIs describe special handling of the volume separator (:) that modern .NET removed in .NET Core 2.1.
Path.Combine: the remarks for Combine(string, string), Combine(string, string, string), Combine(string, string, string, string) and Combine(params string[]) say a separator is appended only if the preceding path "is not a drive reference (that is, "C:" or "D:")" and does not end in DirectorySeparatorChar, AltDirectorySeparatorChar, or VolumeSeparatorChar. On .NET Core 2.1+ only DirectorySeparatorChar/AltDirectorySeparatorChar are checked, and no drive references:
| Call | .NET 10 | .NET Framework 4.x |
|---|---|---|
Path.Combine("C:", "foo") |
C:\foo |
C:foo |
Path.Combine("C:", "foo", "bar") |
C:\foo\bar |
C:foo\bar |
Path.Combine(new[] { "C:", "foo" }) |
C:\foo |
C:foo |
The fixed-arity overloads changed in dotnet/coreclr#15579, and the params string[] overload in dotnet/coreclr#16447. Discussion in dotnet/runtime#27535 confirms that the change was intentional.
The same PR, dotnet/coreclr#16447, has adjusted behavior of several other APIs in a similar manner (removed special treatment of :), invalidating some other remarks:
HasExtension(both overloads): return value and remarks say the search stops atVolumeSeparatorChar. It no longer does:Path.HasExtension(@"C:\a.b:c")istrueon .NET 10 andfalseon .NET Framework.GetFileName(both overloads): says the result is empty when the path ends in a volume separator. Only a drive root counts now:Path.GetFileName(@"C:\file.txt:stream")returnsfile.txt:streamon .NET 10 andstreamon .NET Framework;Path.GetFileName("foo:")returnsfoo:on .NET 10 and an empty string on .NET Framework. (The string overload's remarks already list onlyDirectorySeparatorChar/AltDirectorySeparatorChar, which contradicts its own return-value text.)
Proposal: describe the modern behavior (only DirectorySeparatorChar/AltDirectorySeparatorChar are treated as separators; a drive reference such as C: is still recognized at the start of a path, but not treated specifically by the affected APIs, e.g. Path.Combine). Add notes on the volume-separator behavior being specific .NET Framework only.
Page URL
Content source URL
https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.IO/Path.xml
Document Version Independent Id
fe224bbb-0eec-28fe-93e4-80a25b795e62
Platform Id
3916d1a3-5b50-d6c3-65d1-d12ac54cc834
Article author
@dotnet-bot
- 主要语言
- C#
- 星标
- 954
- 派生
- 1.7k
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 61
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/dotnet-api-docs 的其他 Issue
-
untriaged
难度 1/5 1 小时以内 新手友好度 90/100
dotnet/dotnet-api-docs#13200 ·
维护者通常 1 天内回复
-
"Notes to Inheritors" section (error): "ProcessDialogChar" should be "ProcessDialogKey"可能已有人在做 @33modeling 于 5 天前认领。 未关闭untriaged
难度 1/5 1 小时以内 新手友好度 88/100
dotnet/dotnet-api-docs#13186 ·
维护者通常 1 天内回复
-
area-System.Net.Http untriaged
难度 2/5 1-3 小时 新手友好度 74/100
dotnet/dotnet-api-docs#13153 · 1 条评论 ·
维护者通常 1 天内回复
-
TimeSpanConverter example is misleading, seems to suggest conversion from Ticks in string format, which is not correct可能已有人在做 @zjdangge 于 3 天前认领。 未关闭area-System.ComponentModel untriaged
难度 2/5 1-3 小时 新手友好度 88/100
dotnet/dotnet-api-docs#13135 · 2 条评论 ·
维护者通常 1 天内回复
-
dotnet-target-version untriaged
难度 1/5 1 小时以内 新手友好度 90/100
dotnet/dotnet-api-docs#13129 ·
维护者通常 1 天内回复
查看 dotnet/dotnet-api-docs 的全部 Issue
相似的 Issue
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 64/100
HicServices/RDMP#2398 ·
-
area-drawing platform/android t/bug
难度 2/5 1-3 小时 新手友好度 70/100
dotnet/maui#39676 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
is:bug is:FQNIssue
难度 2/5 1-3 小时 新手友好度 72/100
nunit/nunit3-vs-adapter#1527 ·
维护者通常 1 天内回复
-
MySQL: 3.10 Labels/Secrets uniqueness migrations hardcode database `Elsa`, so startup fails when the database has any other name可能已有人在做 @sfmskywalker 今天认领。 未关闭area:persistence bug elsa 3 persistence prio high triaged
难度 2/5 1-3 小时 新手友好度 78/100
elsa-workflows/elsa-core#9108 ·
维护者通常 1 天内回复