StreamWriter throws "The filename, directory name, or volume label syntax is incorrect" on a path with DateTime
Initially I was using just TextWriter iterationLogger = new StreamWriter(Iteration log.txt"); which works fine, but I wanted to add a timestamp to the file and tried this: TextWriter iterationLogger = new StreamWriter($"{DateTime.Now} Iteration log.txt"); Then StremWritter throws "The filename, directory name, or volume label syntax is incorrect" I tried various arguments (append, encoding, @, $)… Read More StreamWriter throws "The filename, directory name, or volume label syntax is incorrect" on a path with DateTime