With most applications its easy to get started on logging.
However this will not log unhandled exceptions from places you couldn’t forsee. So let’s log these just in case anything goes wrong.
Any exceptions which crash the application can be handled using the UnhandledException
event.
|
This will help you diagnose fatal errors. Unfortunately not all exceptions are fatal, and if you have any timers, unawaited async or unhandled task pool exceptions these can cause your application to behave unexpectedly without you knowing about it.
You can use the UnobservedTaskException to catch some of those ones:
|
If you know any other events or ways to get more of these unexpected errors please let me know!