title: Is this a bug in DirectoryInfo.GetDirectories(string searchPattern)?
body: <p>When calling <a href="http://msdn.microsoft.com/en-us/library/f3e2f6e5.aspx" rel="nofollow noreferrer">DirectoryInfo.GetDirectories(".")</a> on an instance of a DirectoryInfo class which points to a valid folder (excluding drive roots), the result is a DirectoryInfo array whose first (and only) element points to a invalid directory named the same as itself, below itself.</p>
  
  <p>For example:</p>
  
  <pre><code>static void Main(string[] args)
  {
      DirectoryInfo di = new DirectoryInfo("c:\\temp");
      DirectoryInfo[] dis = di.GetDirectories(".");
      Console.WriteLine(dis[0].FullName);
  }
  </code></pre>
  
  <p>Prints out a non-existent directory:</p>
  
  <pre><code>c:\temp\temp
  </code></pre>
  
  <p>I understand that in Windows, a "." refers to the current directory.  That might be acceptable to me if the method returned "c:\temp", but returning a fake subdirectory with the same name seems like absolutely the wrong behavior.  </p>
  
  <p><strong>I should be able to assert that any DirectoryInfo object returned from this function actually exists....  right?!</strong></p>
  
  <p>I decompiled the class using .NET Reflector, but it leads to this method</p>
  
  <pre><code>internal static string[] InternalGetFileDirectoryNames(string path, string userPathOriginal, string searchPattern, bool includeFiles, bool includeDirs, SearchOption searchOption)"
  </code></pre>
  
  <p>Which is a BEAST and I don't feel like walking through the logic in my head.  It's clearly a bug IMHO.</p>
  
  <p>FYI - a "*" works as expected, before someone asks.</p>