How to catch unhandled exceptions in windows services?

I am using the AppDomain.UnhandledException event to catch unhandled exceptions in WPF, Console, and WinForms applications.

But the same code does not work in Windows Services. What should I do?

+4
source share
1 answer

See my answer added to the related SO question .

There are several places in your service code where the thrown exception will not be โ€œunhandledโ€ even if you do not handle it, because the base class does this before it reaches the default handler for AppDomain.

+1
source

Source: https://habr.com/ru/post/1341288/


All Articles