I have this method:
static public void WriteErrorToFile(string ErrorMassege, string HelpLink)
string text = DateTime.Now.ToString() + ":" + Environment.NewLine + ErrorMassege + Environment.NewLine;
text += "Help link: " + HelpLink + Environment.NewLine;
text += Environment.NewLine;
UnauthorizedAccessException: Access to the path 'C:\Program Files
(x86)\Microsoft Visual Studio 14.0\Common7\IDE\errors.txt' is denied.
the problem is that the WPF designer has to execute your code to see what data is available to it on the viewModel the DesignerProperties contains a method GetIsInDesignMode that you can use to disable logic when your code is being executed by the designer