title: GetDirectories fails to enumerate subfolders of a folder with #255 name
body: <p>My application is C# 3.5 runs on Windows 7 Ultimate, 64 bit. It goes through all folder subfolders to perform its job. However, it fails (falls into the infinite loop until StackOverflow.com exception) if run against the folder which name is only one symbol which is #255.</p>
  
  <p>To reproduce, you can do the following: </p>
  
  <ol>
  <li>run Windows Explorer create C:\Temp folder in this folder </li>
  <li>create new folder and rename it with Alt-255 (using numeric keypad)</li>
  <li>create subfolders "first" and "second" there</li>
  <li>create subfolders "1" and "2" under Temp</li>
  </ol>
  
  <p>So you now have:</p>
  
  <ul>
  <li>C:\1</li>
  <li>C:\2</li>
  <li>C:\ \first</li>
  <li>C:\ \second</li>
  </ul>
  
  <p>For such C:\Temp folder with a subfolder with the name #255 (or more #255 symbols) the following code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.IO;
  
  class Program
  {
    public static string[] GetDirectories(string pathToTraverse)
    {
      List&lt;string&gt; result = new List&lt;string&gt;();
  
      foreach (DirectoryInfo subFolder in new DirectoryInfo(pathToTraverse).GetDirectories())
      {
        result.Add(subFolder.FullName);
      }
      return result.ToArray();
    }
  
    public static void TraverseFolders(string folderToTraverse)
    {
      foreach (string subFolder in GetDirectories(folderToTraverse))
      {
        Console.WriteLine(subFolder);
  
        TraverseFolders(subFolder);
      }
    }
  
    static void Main(string[] args)
    {
      TraverseFolders(@"C:\Temp");
    }
  }
  </code></pre>
  
  <p>will never end and will give you result like:</p>
  
  <p>C:\Temp\ <br>
  C:\Temp\1<br>
  C:\Temp\2<br>
  C:\Temp\ <br>
  C:\Temp\1<br>
  C:\Temp\2<br>
  C:\Temp\ <br>
  C:\Temp\1<br>
  C:\Temp\2<br>
  C:\Temp\ <br></p>
  
  <p>So how do I correctly enumerate such folder subfolders?</p>