Open
Description
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:
- Create files
a.txt
andb.txt2
in a directory. - Run
Directory.EnumerateFiles(dir, "*.txt", SearchOption.AllDirectories)
- 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.