Wernfried
Wernfried

Reputation: 206

Unhandled exception in UWP and headless apps

I've read a lot about catching unhandled exception in an UWP app. All suggest tu use AppDomain.UnhandledException. But what to do in a headless application, there is no AppDomain and also no UI-thread.

My app starts several threads, binds to several udp/tcp listeners and makes HTTP requests that may crash. I want to log theses crashes to stabilize the app.

Upvotes: 0

Views: 632

Answers (1)

Michael Xu
Michael Xu

Reputation: 4432

Unhandled exception detection is encapsulated in Application which is typically provided in initial XAML for App.xaml, so headless app can not detect unhandled exception.In fact, headless applications launch at machine startup and run continuously without any process lifetime management resource use limitations.They have a very simple execution model, and without process boundaries.If you want to catch exceptions in headless app,you should add try/catch in your each thread.You can refer here to get some more information.

Upvotes: 3

Related Questions