Skip to content

System.IO APIs throw exceptions for invalid paths only when used, not when normalizing #20004

@Youssef1313

Description

@Youssef1313

System.IO APIs throw exceptions for invalid paths only when used, not when normalizing

See https://docs.microsoft.com/en-us/archive/blogs/jeremykuhne/system-io-in-net-core-2-1-sneak-peek
See dotnet/runtime#38487 (comment)

I'll let a product team member writes this in a more organized way.

Version introduced

.NET Core 2.1

Old behavior

System.IO APIs used to throw exceptions for invalid paths when normalizing a path.

New behavior

System.IO APIs are no longer throwing exceptions when normalizing a path. They only throw exceptions when using the path.

Reason for change

Leaving this to the product team to write.

Recommended action

Leaving this to the product team to write.

Category

  • Core .NET libraries

Affected APIs

I don't have a complete list of the affected APIs.

Note

The API reference (for example, for FileInfo ctor) is outdated. It states that it will throw an exception for invalid paths.


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

breaking-changeIndicates a .NET Core breaking change

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions