Skip to content

[Breaking change]: FileSystemEventArgs.FullPath returns a truly fully qualified path #27916

@slask

Description

@slask

Description

Initially the FullPath property of FileSystemEventArgs and RenamedEventArgs returned whatever directory path it was passed in from FileSystemWatcher. That could mean even a relative path, that does not match with the true intent and name of the FullPath and OldFullPath properties on the event args classes.

Version

.NET 7 Preview 1
Reverted in .NET 7 Preview 5

Previous behavior

FullPath and OldFullPath simply mirror what is was passed into FileSystemWatcher initially, which can include a relative path.

New behavior

The FullPath and OldFullPath will now return a fully qualified path even when FileSystemWatcher is initialized with a relative path.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

To align the actual result with the intent and name of the FullPath/OldFullPath properties from the event args.

Recommended action

The users will have to check their usage of FullPath and OldFullPath when dealing with FileSystemEventArgs and RenamedEventArgs objects and make sure they account for the path change.

Feature area

Core .NET libraries

Affected APIs

Only the FullPath and OldFullPath properties are affected.

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 7Work items for the .NET 7 releasebreaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions