WinCE: Is there a way to know what exception was thrown without having system.sr.dll installed?
-
14-12-2019 - |
Question
I have a wince application and am getting the following error message sometimes:
An error message cannot be displayed because an optional resource assembly containing it cannot be found
This is because I don't have the dll of exception messages installed (system.sr.dll). The problem is that I would like to make a multi-language image containing the error messages for all languages, but system.sr.dll is only in one language.
Is there a way to find out what exception was thrown without having system.sr.dll installed, then lookup the error message from a multi-language exception message dictionary that I have built? I'm not terribly familiar with debugging the device, so I'm not sure what I have to work with (if anything).
Thanks, Mark
Solution
Syste.SR.dll only contains the localized exception texts and I'd argue you shouldn't be showing that to a user anyway. Users don't understand obscure development-focused messages.
The Exceptions themselves are still typed, so you can still catch based on type information and display a meaningful message to the user. The meaning of an exception is very context-driven based on what the user, or your app, was trying to do at the point of the exception.
Something like this is generally useless and unfriendly for a user:
NullRefrenceException occurred at foo.bar.baz
You should be trapping it with a try/catch and then "converting" it to something specific to your app, like:
A valid customer name must be provided