You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Paths: the parent of a one-segment relative path (or the directory of a bare file name) is "", so AsAbsolute() throws and IsDirectory is false #502
Several getters return the empty path to mean "the starting directory":
RelativeDirectoryPath.Parent (Semantics.Paths/Implementations/RelativeDirectoryPath.cs:64) runs string.Join(separator, segments, 0, 0) for a single-segment path, which gives "". The XML doc says so: "an empty path for a single-segment path".
RelativeFilePath.RelativeDirectoryPath (Implementations/RelativeFilePath.cs:39) and the directory getter in SemanticFilePath.cs (~L114) use Path.GetDirectoryName("a.txt") ?? "", which also gives "".
The type treats "" as the starting directory (Depth docs, ComputeParent), but the operations pass it straight to the BCL, which rejects it:
Path.GetFullPath("") throws ArgumentException. This hits RelativeDirectoryPath.AsAbsolute() (~L192), IRelativePath.AsAbsolute() (~L219) and DirectoryPath.cs:53.
Directory.Exists("") is false, so IsDirectory is wrong (SemanticPath.cs:53, SemanticDirectoryPath.cs:35).
On netstandard2.0, PathPolyfill.GetFullPath("", base) (Polyfills.cs:146) throws "Path cannot be empty." On net8+, Path.GetFullPath("", base) returns base. The same call behaves differently depending on the target framework.
Normalize() already writes the starting directory as ".", so Parent disagrees with it.
Observed (net10.0 build)
RelativeDirectoryPath.Create("src").Parent is '':
.AsAbsolute() throws ArgumentException: The value cannot be an empty string. (Parameter 'path').
.IsDirectory is False.
.GetContents() is empty, even though the working directory has contents.
RelativeFilePath.Create("a.txt").RelativeDirectoryPath.AsAbsolute() throws the same way.
The reasonable call file.RelativeDirectoryPath.AsAbsolute() crashes for any file in the current directory.
Suggested fix
Have Parent return "." when no segment is left, matching Normalize, and update its XML doc.
Map an empty GetDirectoryName result to "." in the relative directory-of-file getters.
Make PathPolyfill.GetFullPath return basePath for an empty path, matching the BCL on net8+.
Acceptance criteria
RelativeDirectoryPath.Create("src").Parent.AsAbsolute() equals the current directory, and IsDirectory is true.
RelativeFilePath.Create("a.txt").RelativeDirectoryPath.AsAbsolute() equals the current directory.
AsAbsolute(baseDir) on the starting directory returns baseDir on every target framework.
Priority: High. file.RelativeDirectoryPath.AsAbsolute() throws ArgumentException for any file in the current directory, a common call that has no workaround short of special-casing "". IsDirectory and GetContents() also give wrong answers without an error, and AsAbsolute(base) behaves differently on netstandard2.0 and net8+.
Area:Semantics.Paths: Implementations/RelativeDirectoryPath.cs (Parent, L65 on main), Implementations/RelativeFilePath.cs (L39, GetDirectoryName(...) ?? ""), SemanticFilePath.cs, Polyfills.cs (PathPolyfill.GetFullPath). Confirmed on main (be8aa23). Normalize() at L268 already uses "." for an empty result, so the fix lines the getters up with it.
Activity
matt-edmondson commentedon Oct 30, 2026
Triage
file.RelativeDirectoryPath.AsAbsolute()throwsArgumentExceptionfor any file in the current directory, a common call that has no workaround short of special-casing"".IsDirectoryandGetContents()also give wrong answers without an error, andAsAbsolute(base)behaves differently on netstandard2.0 and net8+.Semantics.Paths:Implementations/RelativeDirectoryPath.cs(Parent, L65 onmain),Implementations/RelativeFilePath.cs(L39,GetDirectoryName(...) ?? ""),SemanticFilePath.cs,Polyfills.cs(PathPolyfill.GetFullPath). Confirmed onmain(be8aa23).Normalize()at L268 already uses"."for an empty result, so the fix lines the getters up with it.""for a directory relative to itself on netstandard2.0. This is the same failure reached throughParentand the directory-of-file getters. RelativeDirectoryPath.Parent ignores..and.: the "parent" of..is""and the parent ofa/..isa, a child of the path itself #387 and DirectoryPath.Parent still treats . and .. as directory names: the parent of /home/user/.. is /home/user, and the parent of .. is "" #478 (closed) reworkedParentfor./..but kept the""result for one segment. Paths:dir.Parent / dir.Namenames a different directory when the path ends in..or., breaking the documented round trip #503 is a sibling issue in the same area and could ship in the same PR.Semantics.Paths. The open PRs are Return a POH from PH.ToPOH instead of a pOH dressed as a pH [major] #496 (POH), Bump ktsu.SourceGeneratorToolkit and ktsu.SourceGeneratorToolkit.Testing #501 (deps), and Add a SessionStart hook for Claude Code cloud sessions #483 (hook).Generated by Claude Code