开发者

Silverlight 4 / .NET 4 Debugging resource strings

开发者 https://www.devze.com 2023-03-05 09:21 出处:网络
I recently encountered a strange thing. On some of my company\'s servers when an exception message is printed out (yes, bad, I know. It\'s for debugging), the actual message isn\'t displayed. Instead

I recently encountered a strange thing. On some of my company's servers when an exception message is printed out (yes, bad, I know. It's for debugging), the actual message isn't displayed. Instead it displays the key for an external string resource and says that "Debugging resource strings are unavailable"

After some research I've come up with the following: In release mode, Silverlight does not package the xap with the dlls containing the actual error messages in order to save space.

I've found workarounds for OLD versions, but nothing for 4. It seems like there are Developer versions of the SL 2 and 3 runtime which will resolve the errors automatically, but I ca开发者_运维技巧nnot find one for SL 4.

So my question is this:

What the heck do I need to do to my SL 4 app / computer to let me see the full, detailed errors when it's in release mode?


You can download the developer runtime (which contains the full exception strings) from the GetStarted page - http://www.silverlight.net/getstarted/ - search for "Developer Runtimes for Windows and OSX", it's near the bottom of the page.


Though it is too late to reply, it may help somebody else. We have a web application using Silverlight 4, installed in various test environments. This web application consumes more than one WCF services. All but one of the test environment sites consistently failed with message "Debugging Resource strings are unavailable". Agreeably the real exception was swallowed. Being a Silverlight application, there was no logging, and it always appeared that there was something failing in the Silverlight component. I connected the application in my development environment to that particular test environment, and found out that the problem was in fact in one of the WCF services. I fixed the problem at the service end and the SL component stopped having this problem.

Why was the WCF failing?

The WCF service had the following code in the constructor:

public MyService()
    {
        //Create an instance of Data Lookup service asycnchronously.
        if (_dataLookupSrvc == null)
        {
            try
            {
                System.Threading.Tasks.Task.Factory.StartNew(() => _dataLookupSrvc = new LookupDataService.LookupDataService());
            }
            catch (Exception ex)
            {
                _log.Error<Exception>(ex);
            }
        }
    }

Somebody moved the underlying LookupDataService.dll from the service folder causing the constructor to fail, but not right away. As the LookupDataService instance was created in anonymous method, the exception logging in this method never took place. Once the LookupDataService.dll was dropped in the service folder, the "Debugging Resource strings are unavailable" message went away.

It was a fun wild goose chase!


Have you already checked the event viewer on the machine where the application crashed? Start->Run. eventvwr

0

精彩评论

暂无评论...
验证码 换一张
取 消