I don't understand why I get UnauthorizedAccessException on call to instantiate StreamWriter class.
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
using (StreamWriter sw = new StreamWriter(path, false ))
{
// some processing here
}
I ran it from Visual Studio with VS been launched as Administrator. I then run application itself as Administrator. I tried it on a Windows 7 and a Windows 2012 R2 machine and same result. I feel like I am doing something silly here. Can any one point out what that may be?