Bug 22857 - DirectoryInfo.EnumerateFileSystemInfos with SearchOption.AllDirectories does not return all subdirectories
Summary: DirectoryInfo.EnumerateFileSystemInfos with SearchOption.AllDirectories does ...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-09-11 02:53 UTC by Udo Liess
Modified: 2014-09-11 05:21 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED FIXED

Description Udo Liess 2014-09-11 02:53:22 UTC
/*
DirectoryInfo.EnumerateFileSystemInfos with SearchOption.AllDirectories does not return all subdirectories!

Output on Ubuntu 14.04.1 with Mono 3.2.8+dfsg-4ubuntu1:
EnumerateFileSystemInfos: 12b
GetFileSystemInfos:       12ab

Output on Windows7 64bit with .NET 4.5:
EnumerateFileSystemInfos: 12ab
GetFileSystemInfos:       12ab

Output on Windows7 64bit with Mono 3.2.3:
EnumerateFileSystemInfos: 12b
GetFileSystemInfos:       12ab
*/

using System;
using System.IO;

class Test
{
	public static void Main(string[] args)
	{
		var dirInfo = new DirectoryInfo("testdir");
		if (dirInfo.Exists)
			dirInfo.Delete(true);
		dirInfo.CreateSubdirectory("1").CreateSubdirectory("a");
		dirInfo.CreateSubdirectory("2").CreateSubdirectory("b");
		Console.Write("EnumerateFileSystemInfos: ");
		foreach (var info in dirInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories))
			Console.Write(info.Name);
		Console.WriteLine();
		Console.Write("GetFileSystemInfos:       ");
		foreach (var info in dirInfo.GetFileSystemInfos("*", SearchOption.AllDirectories))
			Console.Write(info.Name);
		Console.WriteLine();
	}
}
Comment 1 Marek Safar 2014-09-11 05:21:56 UTC
Fixed in master