13 years C/C++/C# programing, focus on embedded and mobile device development.

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

There has been some confusion about the error message: "Could not find resource assembly". Basically, this means that there is some exception that has happened in the program. The error did not happen because it could not find the resource assembly. The resource assembly that it is searching for contains exception messages (strings) that would be helpful in debugging what went wrong with the program.

  Since the user is never expected to see this error message if the program works as expected and all exceptions are handled appropriately, it was decided (due to size constraints) that the resource assembly that has these error strings are never put on a user's device. Thus the main target audience of these error strings are developers who would like to debug issues. Hence, when you do an F5 deploy onto the device, the System.SR.dll assembly which have these error strings are copied to the device and the developer can see the error messages. But in case .Net Compact Framework is installed from a redistributable or you are using .Net Compact Framework that come with the device (as a user of the device would be doing), the System.SR.dll is not present on the device. Hence, if the application did come upon an exceptional condition that wasn't handled by the application, this "Could not find resource assembly" message would be shown to the user.

If you are not using Visual Studio F5 deploy to the device and would still like to see the exception messages, you can achieve this by taking the System_SR_[Language].CAB  where [Language] corresponds to the language in which you want to see the error message to appear and clicking on the cab file to install it. For more information on how to do this, see the following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_evtuv/html/etconerrormessagecannotloadresourceassembly.asp

PS: I made the same mistake again and again. Last time when in scanomat project, i find this problem from customer's feedback, it takes too much time to find and fix this bug. Arround one year later when in the new project, i met the same bug again, but luckly i remembered it quickly.

Installation of the System_SR_[Language].CAB  is very easy, the link given above is invalid now, you can find the file in "C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\Diagnostics", for any language.

posted on 2007-08-23 16:54  woaiusd  阅读(542)  评论(0编辑  收藏  举报