[Breaking change]: drive's current directory paths used for file system entry enumeration return paths without a separator in between #39186
Labels
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 8
Work items for the .NET 8 release
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
in-pr
This issue will be closed (fixed) by an active pull request.
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Description
File system entries obtained using a path argument in the shape of a "drive's current directory" e.g.
C:
were incorrectly formed by combining directory path + separator + entry name. We now avoid adding the separator with such paths to return the correct path for the entries.Version
.NET 8 GA
Previous behavior
Notice the enumerated entries are shown as if they were in the drive's root.
New behavior
Using above code snippet, the output for .NET 9 is the following.
Type of breaking change
Reason for change
Users were reporting that this behavior was not correct, and it was also a regression from .NET Framework.
Recommended action
Windows users relying on enumeration of paths like
C:
should re-evaluate their application's IO operations. IMO, this is an unusual scenario unlikely to be used in production. Most users wanting to enumerate the current directory would useEnvironment.CurrentDirectory
instead.Feature area
Core .NET libraries
Affected APIs
Associated WorkItem - 206388
The text was updated successfully, but these errors were encountered: