Home Dashboard Directory Help
Search

System.IO functions don't support paths in the form of \\?\Volume{GUID}\ by thaimin


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 640815
Opened: 2/1/2011 12:43:02 PM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

Most System.IO functions that take path names do not accept paths in the form \\?\Volume{GUID}\ but the similar native functions do support these. This is the only way to access partitions that do not have any mapped paths. These paths work fine in Explorer.

Some functions that don't actually look at the entire path work correctly (such as Path.GetExtension or Path.Combine) but most throw an exception.

I know that this at least effects the following, however it probably effects many more:
Directory.Exists
File.Copy
File.GetCreationTimeUtc
File.GetLastAccessTimeUtc
File.GetLastWriteTimeUtc
File.Exists
File.ReadAllBytes
File.SetCreationTimeUtc
File.SetLastAccessTimeUtc
File.SetLastWriteTimeUtc
File.WriteAllBytes
Path.GetFullPath
Details
Sign in to post a comment.
Posted by Raphaël P on 4/26/2012 at 8:41 PM
Unfortunately, I don't think this problem only deserves a "this is by design" answer. This "design" prevents dotnet programs to access drives in many server scenarios (and even home scenarios I think: didn't a Windows home server version got rid of drive letters altogether?). The only alternative is to rewrite a lot of parts of System.IO. This is not only very expensive but also bugprone (lot of pinvoke code with many edge-cases to deal with).

Besides the given answer mention an obsolete blogpost (2007) for a similar problem (long names support) that has been fixed since then. Finally, while the reference to the LongPath library on Codeplex was a well-intended move, it is far to be a good enough code base developers could use to decently support guid-prefixed paths (3 classes, 10 public methods, no unit tests).

Just as you had to support long names, you now have to support
Posted by Microsoft on 4/4/2011 at 10:23 AM
Hello thaimin,
Thank you for your post. This behavior is by design with System.IO. Please see the following blog post and sample codeplex code which you can modify to support \\?\Volume{GUID}\ paths

1) BCL Blog post series on long path support
http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

2) Long Path support library on BCL CodePlex
http://bcl.codeplex.com/wikipage?title=Long%20Path&referringTitle=Home
Posted by Microsoft on 2/1/2011 at 7:07 PM
Thanks for your feedback.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 2/1/2011 at 12:59 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.