Strange(?) console app behavior

Basically, after running the console app for 11minutes in debug mode, it suddenly stops working. For the first 11minutes it correctly loops and displays the messages, but at exactly 11minutes the console app deletes all text and only displays black. Any idea what causes this?

working

at 11 minutes

class Program { static void Main(string[] args) { IrcBot bot = new IrcBot("irc.twitch.tv", 6667, "nickname", "password"); bot.JoinRoom("channel"); Thread t; t = new Thread(new ThreadStart(bot.ReadMessageLoop)); t.Start(); } } class IrcBot { private string userName; private string channel; private TcpClient tcpClient; private StreamReader inputStream; private StreamWriter outputStream; public IrcBot(string ip, int port, string userName, string password) { this.userName = userName; tcpClient = new TcpClient(ip, port); inputStream = new StreamReader(tcpClient.GetStream()); outputStream = new StreamWriter(tcpClient.GetStream()); outputStream.WriteLine("PASS " + password); outputStream.WriteLine("NICK " + userName); outputStream.WriteLine("USER " + userName + " 8 * :" + userName); outputStream.Flush(); } public void JoinRoom(string channel) { this.channel = channel; outputStream.WriteLine("JOIN #" + channel); outputStream.Flush(); } public void SendIrcMessage(string message) { outputStream.WriteLine(message); outputStream.Flush(); } public void SendChatMessage(string message) { SendIrcMessage(":" + userName + "!" + userName + "@" + userName + ".tmi.twitch.tv PRIVMSG #" + channel + " :" + message); } public string ReadMessage() { string message = inputStream.ReadLine(); return message; } public void ReadMessageLoop() { while (tcpClient.Connected == true) { string message = inputStream.ReadLine(); Console.WriteLine(message); } } } 

by KARMAGAMER via /r/csharp

Leave a Reply