title: Directory.Exists (Dir) function not working as expected
body: <p>In my code I need to check if a directory exists, and if it ddoesn't, create it.</p>
  
  <p>Unfortunately even though the <code>Directory.Exists</code> returns false, the directory exists and an execption is thrown.</p>
  
  <p>here is the code I am using:</p>
  
  <pre><code>if (!Directory.Exists(emailAttachmentsPath))
  {
      Directory.CreateDirectory(emailAttachmentsPath);
  }
  </code></pre>
  
  <p>even though that directory exists on disk, the function returns false and I get an error.</p>
  
  <p>Is there something I am missing?</p>