Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug not stopping after form closing in Visual Studio

Visual Studio Debug does not stop when i close the form that i write in C#. How can i stop debug process when i close form. I added Application.Exit() method in the form closing event but it didn't work.

Thank you.

like image 252
sanchop22 Avatar asked Apr 13 '12 08:04

sanchop22


Video Answer


1 Answers

Try this from here

If (System.Windows.Forms.Application.MessageLoop)
{
  // Use this since we are a WinForms app
  System.Windows.Forms.Application.Exit()
}
Else
{
  // Use this since we are a console app
  System.Environment.Exit(1)
}

EDIT:

If there are running infinite threads then do

Thread myThread = new Thread(...);
myThread.IsBackground = true; //set your running thread to background
myThread.Start(...);

And you can see how to? from here

like image 52
coder Avatar answered Oct 27 '22 04:10

coder