sarsnake sarsnake - 5 months ago 42
C# Question

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

My code in C# ( MVC)

StreamWriter tw = new StreamWriter("C:\\mycode\\myapp\\logs\\log.txt");

// write a line of text to the file

The file is created but is empty. No exception is thrown. I have never seen this before and I am stuck here; I just need to write some debugging output.

Please advise.



System.IO.File.WriteAllText(@"path\te.txt", "text");