Skip to content

Path functions behaving differently on UNC device paths than implied from documentation #95619

Open

Description

Description

File path formats on Windows systems states:

For device UNCs, the server/share portion forms the volume. For example, in \\?\server1\utilities\\filecomparer\, the server/share portion is server1\utilities. This is significant when calling a method such as Path.GetFullPath(String, String) with relative directory segments; it is never possible to navigate past the volume.

The way this reads to me is that \\?\server1\utilities\\ should be considered the "root" of \\?\server1\utilities\\filecomparer\.

Specifically, the documentation states

  • "the server/share portion forms the volume"
  • "in [...] the server/share portion is server1\utilities"
  • "...it is never possible to navigate past the volume"

This seems to not be respected:

Reproduction Steps

> dotnet fsi

Microsoft (R) F# Interactive version 12.4.0.0 for F# 7.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> open System.IO;;
> Path.GetFullPath("""..\..""", """\\?\server1\utilities\\filecomparer\""");;
val it: string = "\\?\server1\"

Expected behavior

> Path.GetFullPath("""..\..""", """\\?\server1\utilities\\filecomparer\""");;
val it: string = "\\?\server1\utilities\\"

> Path.GetPathRoot("""\\?\server1\utilities\\filecomparer\""");;
val it: string = "\\?\server1\utilities\\"

> Path.GetDirectoryName("""\\?\server1\utilities\\""");;
val it: string = <null>

Actual behavior

> Path.GetFullPath("""..\..""", """\\?\server1\utilities\\filecomparer\""");;
val it: string = "\\?\server1\"

> Path.GetPathRoot("""\\?\server1\utilities\\filecomparer\""");;
val it: string = "\\?\server1\"

> Path.GetDirectoryName("""\\?\server1\utilities\\""");;
val it: string = "\\?\server1\utilities"

Regression?

I don't know how to test old .NET versions, I'm not a long-time .NET user.

Known Workarounds

No response

Configuration

> dotnet --version
7.0.100
> Get-ComputerInfo -Property "Os*"

OsName                                     : Microsoft Windows 10 Home
OsType                                     : WINNT
OsOperatingSystemSKU                       : WindowsHome
OsVersion                                  : 10.0.19045
OsArchitecture                                          : 64-bit
OsLanguage                                              : en-US

I would be pretty sure it's Windows (Path)-specific.

Other information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-System.IObreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions