Skip to content

System.IO: Allow recursive file system enumeration to continue when directory link's target does not exist #58612

Open

Description

@fitdev

Perhaps this should be considered holistically as part of .Net 7's improved and more integrated support of file system links into various APIs, but at the least it would be nice to add:

public class EnumerationOptions {

  public bool IgnoreUnresolvableLinkTargets { get; set; } // when false preserves current (DotNet 6) behavior, i.e. throws DirectoryNotFoundException when target cannot be found

}

to prevent throwing of DirectoryNotFoundException when a symlink / junction is encountered during enumeration which has invalid (non-existing) target, as often it is valuable to continue enumeration regardless, plus it will parallel existing IgnoreInaccessible option.

Activity

  1. ghost added
    untriaged
    on Sep 3, 2021
  2. iSazonov commented on Sep 4, 2021

    @iSazonov
    Contributor

    I'd qualify this as a bug and re-use EnumerationOptions.IgnoreInaccessible to mask the exception.

    /cc @carlossanlop @jozkee

  3. removed
    untriaged
    on Sep 10, 2021
  4. added this to the 7.0.0 milestone on Sep 10, 2021
  5. modified the milestones: 7.0.0, Future on Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions