I have a thread:
Thread mthread = new Thread(new ThreadStart(thread_main));
mthread.Start();
It starts the function thread_main
void thread_main()
{
if (BotSuite.ImageLibrary.Template.Image(screendata, invdata).IsEmpty)
{
throw new Exception();
}
}
This exception should be caught in the main thread! I added a line in the button event handler.
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ErrorHandler);
it works great if the exception is in the main thread, but if it's in the mthread
nothing happens!
How can I fix that?