Most probably the line
System.IO.StreamReader file = new System.IO.StreamReader("\\log.txt");
is the cause of the error. You cannot safely assume that the current directory is the one where the log file resides. Always specify the full path.
string logFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.txt")
System.IO.StreamReader file = new System.IO.StreamReader(logFie);
The current directory can change at any time when the user is selecting a directory in a FileOpenDialog or FileSaveDialog. It's not automatically the applications directory. Also the applications directory will be \SolutionFolder\ProjectFolder\bin\Debug
when debugging. Is this the directory you are looking for?