Luc said:
you can try
if (Args.IsTerminating) Environment.Exit (0) ;
where Args is your UnhandledExceptionEventArgs
Be aware that this technique does not scale to services or multiple
appdomains, and it will also prevent you from diagnosing the unhandled
exception under a debugger (you can set a breakpoint on the event callback,
but that isn't convenient at all). Finally, the usual step of writing an
error to the event log will be skipped.
I also suggest passing a non-zero value to Environment.Exit(), since
processes that check the exit status (if any) will usually interpret a zero
exit status as success, which is a tad misleading.
In short, I'm not at all happy that this actually works.