protected override void OnStart(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.Sleep(10000); throw new Exception(); } void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { }
I connected the debugger to the above code in my Windows service, setting a breakpoint in CurrentDomain_UnhandledException, but it never got caught. An exception appears, saying that it is raw, and then the service stops. I even tried putting some code in an event handler if it was optimized.
Are you setting up unhandled exception handling in a Windows service?
c # exception-handling windows-services unhandled-exception
Mike Pateras Mar 16 '10 at 17:54 2010-03-16 17:54
source share