Search

Inconsistent behavior of FullName when provided path ends with a backslash by davidgvh

Resolved
as Won't Fix Help for as Won't Fix

1
0
Sign in
to vote
Type: Bug
ID: 777308
Opened: 1/23/2013 1:41:11 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
DirectoryInfo.FullName displays the simplified path name, but does not remove trailing directory separators. FullName will always display paths without trailing directory separators if referenced through GetDirectories or through Parent.

Similar fixed issue:
https://connect.microsoft.com/VisualStudio/feedback/details/614862/inconsistent-behavior-for-directory-getparent
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.0

Steps to reproduce

1) Add a backslash to the end of any path passed to the DirectoryInfo constructor.
2) Output the FullName property of the instance.
3) Using the Parent property, find the directory using GetDirectories().
4) Output the FullName property of the found directory.

Example:
DirectoryInfo path = new DirectoryInfo(@"C:\foo\bar\..\");

Console.WriteLine(path.FullName); // Writes C:\foo\

DirectoryInfo found = path.Parent.GetDirectories(path.Name, SearchOption.TopDirectoryOnly)[0];

Console.WriteLine(found.FullName); // Writes C:\foo

Product Language

English

Operating System

Windows 8

Operating System Language

English

Actual results

The output of above code:
C:\foo\
C:\foo

Expected results

The expected output of the above code:
C:\foo
C:\foo
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/11/2013 at 12:06 PM
Thank you for your feedback. We are not going to be able to address this issue in our next release due to other priorities.

Regards,
Immo Landwerth
.NET Framework Team
Posted by davidgvh on 1/28/2013 at 6:37 AM
Why will this not be fixed?
Posted by Microsoft on 1/23/2013 at 10:55 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/23/2013 at 1:50 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.