Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 1468 [details]
Source file showing the error
If I search for subdirectories in a tree with the DirectoryInfo.GetDirectories() method and SearchOption.AllDirectories set, it simply doesn't work.
My attached test file creates a directory tree in /tmp. Searching for a subdirectory on the second level with DirectoryInfo.GetDirectories() fails, using the corresponding method Directory.GetSubDirectories works as expected.
The output of test.exe is
Directories found with DirectoryInfo: 0
Directories found with Directory: 1
I have look through the source code of DirectoryInfo.cs on github and found that, while DirectoryInfo.GetDirectories(string searchpattern) simply calls the corresponding method in Directory, DirectoryInfo.GetDirectories(string searchpattern, SearchOption searchOption) tries to re-implement this feature in a very weird and non-working way.
I have created a patch in github, which is more or less a copy/paste of DirectoryInfo.GetDirectories(string searchpattern):
The bugfix has been merged to the master branch by Marek Safar yesterday: