Description
Description
I know \\?\
means 'do not parse', but might I halfway misuse this repo for a Win32 question about this syntax and the behavior of .NET path API's with them?
Is it even valid to use \\?\.
unless there is something to talk to that is called exactly that? Like a device or file/directory that has such a weird name? Or should it in fact refer to the current directory and direct API's to maintain the \\?\
prefix to support long paths?
Also, I just give one example where path math isn't being done because the \\?\
prefix is present (presumably). Should this be and remain this way?
private const string PWD = "<PWD>";
[Theory]
[InlineData(@"\\?\.", @"\\?\" + PWD)]
[InlineData(@"\\?\C:\Users\..", @"\\?\C:\")]
public void GetFullPath(string path, string expected) {
if (expected is object) expected = expected.Replace(PWD, Environment.CurrentDirectory);
var actual = Path.GetFullPath(path);
Assert.Equal(expected, actual);
}
First result
Message:
Assert.Equal() Failure
↓ (pos 4)
Expected: \\?\C:\Users\(...)\b.Tests\b···
Actual: \\?\.
↑ (pos 4)
Second result
Message:
Assert.Equal() Failure
↓ (pos 7)
Expected: \\?\C:\
Actual: \\?\C:\Users\..
↑ (pos 7)
Configuration
Same on netcoreapp3.1
as on net5.0
> dotnet --list-sdks
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.400-preview-015178 [C:\Program Files\dotnet\sdk]
5.0.100-preview.5.20279.10 [C:\Program Files\dotnet\sdk]
Regression?
Might be intended behavior.
Opinion
It could be useful to be able to do path math with \\?\
with an increasing number of machines able to use long paths since recent versions of Windows.