I have this method:
static public void WriteErrorToFile(string ErrorMassege, string HelpLink)
{
string text = DateTime.Now.ToString() + ":" + Environment.NewLine + ErrorMassege + Environment.NewLine;
if (!string.IsNullOrWhiteSpace(HelpLink))
{
text += "Help link: " + HelpLink + Environment.NewLine;
}
text += Environment.NewLine;
File.AppendAllText("errors.txt", text);
}
I call this method every time some expception occurred, but then the designer in Visual Studio 2015 crashes with massege:
UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\errors.txt' is denied.
If that mean something to you I call this function in MyViewModel what is datacontext of my page. If I delete errors.txt
file then everything is normal again. Anyone knows why this happen and what is the soulution?