static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e) { ConsoleColor colorBefore = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(e.ExceptionObject.ToString()); Console.ForegroundColor = colorBefore; _chatServer1?.ShutDown(); wh.Set(); Environment.Exit(1); }