marți, 6 septembrie 2011

Exception messages in .NET Compact Framework

The .NET Compact Framework team decided not to include libraries that contain error message strings by default since these would occupy more space and are in most cases not meant for the end users.
As developers, we need to these messages for debugging purposes, specially when we are not using Visual Studio. Whenever an exception occurs, the log entry for it would look like this: "An error message cannot be displayed because an optional resource assembly containing it cannot be found". This post of the .NET Compact Framework team explains what we need to do in order to enable descriptive exception messages on our Windows Mobile/ CE based device.
Basically what you need to do is copy the System_SR_[Language].CAB  file from your computer to the device and then double click it to install the .cab. If your language of choice is English, you need to copy the System_SR_ENU.cab, installed by default in C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\Diagnostics.
After installing this .cab file on the mobile device, you will start seeing descriptive exception messages, that are far more helpful.

Learn more on overall Compact Framework development in C# from Programming .NET Compact Framework 3.5 (2nd Edition) by Paul Yao and David Durant.

Niciun comentariu:

Trimiteți un comentariu