As my project is growing, i've found myself needing to employ a new thread to carry out a loop task for the lifespan of my program. It all works seemingly well except for when I exit it.
It dosent close cleanly. By that I mean I have to press SHIFT+F5 to have it fully close, it seems to exit but I tried editing it and got the message "I cannot edit while the app is running".
Without the new thread starting I have no problem closing it.
If I start my app but do not start the new thread (which for the moment is triggered by a button click event) the app exits gracefully.
I have this line in the output window, which I cannot find a solution to via a search
"A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll"
As always I appreciate any help or advice.
Visual studio 2010