I noticed in one of my application that calling Console.WriteLine() doesn't work every time.
Meaning, that the written string isn't terminated with a line break and the next call to Console.WriteLine() will be printed on the same line.
To test the behaviour, I have written the following reproducible app
@Wyck has contributed simpler code to replicate the issue:
for (var i = 0; i < 30; i++) 
Console.WriteLine(i.ToString().PadRight(100 + i, 'a'));
Here my original code with some bloat to it:
internal class Program
{
    static void Main(string[] args)
    {
        var rnd = new Random();
        for (var i = 0; i < 200; i++)
        {
            Thread.Sleep(rnd.Next(0, 10));
            var str = i.ToString().PadRight(rnd.Next(90, 130), 'a');
            switch (rnd.Next(0, 3))
            {
                case 0:
                    ConsoleEx.WriteLineInfo(str);
                    break;
                case 1:
                    ConsoleEx.WriteLineWarning(str);
                    break;
                case 2:
                    ConsoleEx.WriteLineError(str);
                    break;
            }
        }
        Console.ReadKey();
    }
}
internal static class ConsoleEx
{
    #region Static Public Methods
    public static void WriteLine(string str, ConsoleColor foregroundColor)
    {
        //var oldForegroundColor = Console.ForegroundColor;
        //Console.ForegroundColor = foregroundColor;
        Console.WriteLine(str);
        //Console.ForegroundColor = oldForegroundColor;
    }
    public static void WriteLineError(string str) => WriteLine(str, ConsoleColor.Red);
    public static void WriteLineInfo(string str) => WriteLine(str, ConsoleColor.Green);
    public static void WriteLineWarning(string str) => WriteLine(str, ConsoleColor.Yellow);
    #endregion
}
Things I noticed
- I could only replicate the issue by actually executing the generated *.exe, so never saw the issue while debugging.
 - using redirect 
ConsoleApp.exe > output.txtdoesn't seem to replicate the issue - changing the 
ForegroundColordoesn't seem to contribute to the error 
there for I believe it is maybe related to the Windows-Terminal Version I am using 1.16.10262.0
Here a screenshot of the issue:
Every number should be on a separate line, since all outputs are called with Console.WriteLine().
Is there something I can do in C#, or should I head over to https://github.com/microsoft/terminal/issues and report a bug?



