Global Exception Handling

One of the most requested features from the .NET Compact Framework team was the ability to catch unhandled run-time exceptions globally in a single place. This has always been possible in the full .NET Framework, but is not fully possible in .NET Compact Framework version 1.0. Before we look at those, though, and more important before we show how version 2.0 of the .NET Compact Framework delivers on the popular request, it is worth evaluating what the purpose of global exception handling (GEH) really is.

The purpose of GEH is to log all unhandled exceptions and not to allow any of them to escape to the user. You will recall this is the second rule of exception handling as established in the section titled "Runtime Exceptions" ...

Get Microsoft® Mobile Development Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.