Skip to content

MockDirectory.EnumerateFiles search pattern behaves differently from Directory.EnumerateFiles in .NET 5+ #895

Description

@Gav-Brown

In .NET 5 the behaviour of the file extension search pattern changed from .NET Framework.
See EnumerateFiles, specifically the table entry

book.xls, book.xlsx | *.xls | book.xls | book.xls, book.xlsx

To Reproduce
Steps to reproduce the behaviour:

  1. Create files a.txt and b.txt2 in a directory.
  2. Run Directory.EnumerateFiles(dir, "*.txt", SearchOption.AllDirectories)
  3. Compare .NET 5 or 6 behaviour to MockDirectory

Expected behaviour
Only a.txt should be returned.

Actual behaviour
Both a.txt and b.txt2 are returned.

Can also just use *.t as search pattern which should return no files in a folder of .txt files etc.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testinghelpersIssues that address the testing helpersstate: ready to pickIssues that are ready for being worked ontype: bugIssues that describe misbehaving functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions