Wednesday, November 20, 2013

How to Capture Unhandled Exceptions using Xamarin Android and C#

I looked and looked for a good way to catch unhandled exceptions in my android app that I wrote using Xamarin for Visual Studio. I am not interested in sending them to a webserver at this time, I just want to catch them and log them. I came across this post and became discouraged,

However, this is a solution I came up with to capture unhandled exceptions using Xamarin Android and C# that works for me so I thought I would share it.

Implementing the application class allowed for a global unhandled exception catcher.

The full source is available at


  1. Looks good, but I just created an ActivityBase and did my exception handling in it's OnCreate.

  2. This comment has been removed by the author.

  3. I am able to display a Toast Message when App is getting crashed. But I am not able to display a alert window.