Silverlight 4 / .NET 4 Debugging resource strings

后端 未结 3 1537
误落风尘
误落风尘 2020-12-30 23:20

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

3条回答
  •  离开以前
    2020-12-30 23:38

    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(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!

提交回复
热议问题