I've got an application which uses a custom exception handler and to avoid
unhandled exceptions I've got a try{}catch (Exception){} block around the
main Application.Run(...).
Works all good on my machine, whenever something unexpected happens the
exception get caught, logged and it shows a nicer message.
Unfortunately for some reason, this only works on my machine! If i deploy my
project to some other computer I get the .net unhandled exception screen!
how can that be? shouldn't that try/catch catch _everything_?? I'm catching
different types, but the last catch block catches (Exception ex)! How can
anything get around that?
Any suggestions?
Thanks very much.
Cheers
Andreas van de Sand
Instead of using a try/catch block around the static Run method, why not
attach to the ThreadException event on the Application? It should give you
a consistent way to catch unhandled exceptions on the UI thread.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Andreas van de Sand" <vinc...@gmail.com> wrote in message
news:%23vV8RV%23nGH...@TK2MSFTNGP05.phx.gbl...
thanks very much, exactly what I needed!
Still don't know why I didn't get all exceptions via try/catch, but I guess
it's a lot better this way anyway...
thanks again, much appreciated.
Cheers
Andreas
"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guard.caspershouse.com> wrote in
message news:u68yRm%23nGH...@TK2MSFTNGP04.phx.gbl...
--
Thanks,
Viktar Z.