Skip to content

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

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.

Activity

  1. added
    breaking-change
    on Jan 21, 2022
  2. added
    ⌚ Not Triaged
    🏁 Release: .NET 7
    source incompatible
    on Jan 21, 2022
  3. slask commented on Jan 21, 2022

    @slask
    Author

    The PR with the fix: dotnet/runtime#63051
    Original issue: dotnet/runtime#62606

  4. added
    🚧 Hold for related PR
    and removed
    ⌚ Not Triaged
    on Jan 22, 2022
  5. removed
    🚧 Hold for related PR
    on Feb 8, 2022
  6. jeffhandley commented on May 5, 2022

    @jeffhandley
    Member

    We decided to revert this breaking change, and the change back will be included in .NET 7 Preview 5. Here's the context for that decision: dotnet/runtime#62606 (comment)

    @gewarren, I will submit a PR to add additional API docs around the FullPath and OldFullPath properties to explain their behavior more accurately. Should the breaking change doc hat was added be deleted or should it be retained and updated to state the change was reverted?

  7. gewarren commented on May 6, 2022

    @gewarren
    Collaborator

    @jeffhandley Thanks for the update. Once Preview 5 ships, I think we can delete the breaking change article, since anyone upgrading to .NET 7 for the first time will likely use the latest preview version (right?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 7breaking-changesource incompatible

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions