I have a console app in C# that runs endlessly and looks something like this:
class Program
{
static void Main(string[] args)
{
while(tru
A console app is going to kill all threads when the window is closed. Always. There is no way around that. The console window is directly linked to the process.
You may wish to use a Windows application which you will have more fine grained control over the main application loop. This could be a Windows Service or a WinForm/WPF type of application (which doesn't even really have to have a UI if you don't want).
If you want a Windows Application that still shows the console - this is a bit wonky, but you can find an example of how to do that here.