Skip to content

[Feature] .NET Core 2.1 System.IO API changes #1685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 3 tasks
JeremyKuhne opened this issue Feb 23, 2018 · 8 comments
Open
1 of 3 tasks

[Feature] .NET Core 2.1 System.IO API changes #1685

JeremyKuhne opened this issue Feb 23, 2018 · 8 comments
Labels
area-System.IO 🏁 Release: .NET Core 2.x Identifies work items for the .NET Core 2.x releases doc-update Update outdated articles Pri1 Indicates issues/PRs that are high priority Pri3 Indicates issues/PRs that are low priority
Milestone

Comments

@JeremyKuhne
Copy link
Member

.NET Core 2.1 System.IO API changes

There are a number of behavior changes to System.IO APIs in .NET Core 2.1 and new APIs. This issue summarizes the high level changes and links to relevant documents.

Still Needed:

  • Content Types
  • Table of Contents
  • Prioritization

General

APIs have been modified to better support cross platform code writing and substantially improve performance. Here is a summary of the API changes:

  1. Path validation has been simplified
  2. Span overloads have been added for a number of System.IO.Path APIs
  3. There is a new overload for Path.GetFullPath() that allows specifying a base path for resolving the path
  4. Directory enumeration results are more consistent cross-plat
  5. New enumeration options have been added
  6. A new extensible enumeration API has been added

Initial details are below. I'll be adding more links and details shortly.

Path Validation

To facilitate writing cross platform code, System.IO.Path APIs have had their preemptive error checking simplified. Notably:

  • Path.GetFullPath() only checks for embedded nulls, null strings, and empty strings
  • No IO APIs check for invalid characters
  • Path.GetDirectoryName() returns null for empty strings, instead of throwing
  • Search patterns are no longer validated beyond null check and rooting (they cannot return true from Path.IsPathRooted())

Span overloads

https://github.com/dotnet/corefx/issues/25539

Path.GetFullPath overload

https://github.com/dotnet/corefx/issues/25539

Enumeration API changes

https://github.com/dotnet/corefx/issues/25873

@mairaw
Copy link
Contributor

mairaw commented Feb 23, 2018

Thank you @JeremyKuhne! I'll be adding this to our .NET Core 2.1 project.

@mairaw mairaw changed the title .NET Core 2.1 System.IO API changes [Feature] .NET Core 2.1 System.IO API changes Feb 23, 2018
@JeremyKuhne
Copy link
Member Author

I put together some blog posts covering the details that can be used as a starting point:

https://blogs.msdn.microsoft.com/jeremykuhne/2018/03/08/system-io-in-net-core-2-1-sneak-peek/
https://blogs.msdn.microsoft.com/jeremykuhne/2018/03/09/custom-directory-enumeration-in-net-core-2-1/

@JeremyKuhne
Copy link
Member Author

When we do these updates we should clarify legacy behavior. https://github.com/dotnet/corefx/issues/26008 brought up the fact that we didn't do whitespace trimming on Unix platforms. Please sync with me to ensure that you've got accurate details across the platforms/versions. :)

@mairaw
Copy link
Contributor

mairaw commented Mar 15, 2018

Thanks @JeremyKuhne. We'll do and also ping you for reviews. 😄

@mairaw mairaw self-assigned this Jun 18, 2018
@mairaw mairaw removed their assignment Sep 4, 2018
@mairaw
Copy link
Contributor

mairaw commented Sep 4, 2018

Moving this to the backlog until we're actually ready to start working on this

jaredpar referenced this issue in jaredpar/roslyn Sep 14, 2018
In netcoreapp2.1 the behavior of the file system handling of invalid
characters changed. This broke the expectations of a number of our
tests.

https://github.com/dotnet/docs/issues/4483
@mairaw mairaw transferred this issue from dotnet/docs Jan 24, 2019
@dotnet-bot dotnet-bot added the untriaged New issue has not been triaged by the area owner label Jan 24, 2019
@mairaw mairaw added Pri1 Indicates issues/PRs that are high priority 🏁 Release: .NET Core 2.x Identifies work items for the .NET Core 2.x releases doc-update Update outdated articles and removed untriaged New issue has not been triaged by the area owner labels Jan 26, 2019
@mairaw mairaw added this to the Backlog milestone Jan 26, 2019
@carlossanlop
Copy link
Member

.NET Core 2.1 System.IO API changes - #1685

@KirkMunro
Copy link

Path.GetDirectoryName() also returns null for whitespace-only strings, instead of throwing as it did before.

@RussKie
Copy link
Member

RussKie commented Nov 1, 2020

Bump. The lack of updated docs is starting biting projects migrating from .NET Framework.

@PRMerger13 PRMerger13 added the Pri3 Indicates issues/PRs that are low priority label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO 🏁 Release: .NET Core 2.x Identifies work items for the .NET Core 2.x releases doc-update Update outdated articles Pri1 Indicates issues/PRs that are high priority Pri3 Indicates issues/PRs that are low priority
Projects
None yet
Development

No branches or pull requests

8 participants