Hello. I was wondering if its possible? Basically my program has a ThreadPool and that ThreadPool
works on many different methods. Its very important to me that no pop up's ever occur; I have a
"try/catch" block around my main but any exception that the ThreadPool creates crash's the
application (and produces a pop up). ((For example Java has the "unhandledExcep tion(...)" method in
the "ThreadGrou p" class that you can simply override)). Does C# have something like this?
Things I've Tried:
http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemwind owsformsapplica tionclassthread exceptiontopic. asp
This has almost exactly what I wanted (I thought...). I add the following to my main (and the
class)
CustomException Handler eh = new CustomException Handler();
Application.Thr eadException += new ThreadException EventHandler(eh .OnThreadExcept ion);
internal class CustomException Handler {
public void OnThreadExcepti on(object sender, ThreadException EventArgs t) {
MessageBox.Show ("IsThisWorking ?");
Application.Exi t();
}
}
But then I have the ThreadPool invoke a method that simply throws an excpetion and it still crash's
my program... No MessageBox is shown either. Can someone tell me what I'm missing?
Some more information: Basically I know I can put "try/catch" blocks around all the methods that
the ThreadPool can invoke on but it just seems ugly and theres a lot of methods (this is what I am
currently doing). Also I don't care if I can post any messages to the user or anything when an
uncaught exception occures (simply having the application exit would be great so if there's a way
for my program to just disable the "XXXX has encountered a problem and needs to close. We are sorry
for the inconvenience." Then that would also be a great solution for me if someone knows how I can
set my program to do that...
Best Regards,
Never Best
--
----------------------------------------------
Posted with NewsLeecher v3.0 Final
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------