StreamWriter.Write doesn’t write to file; no exception thrown

StreamWriter is buffered by default, meaning it won’t output until it receives a Flush() or Close() call. You can change that by setting the AutoFlush property, if you want to. Otherwise, just do: StreamWriter tw = new StreamWriter(“C:\\mycode\\myapp\\logs\\log.txt”); // write a line of text to the file tw.Write(“test”); tw.Close(); //or tw.Flush();