Globalization, Localization And Why My Application Stopped Launching

Posted by Paulo Morgado on ASP.net Weblogs See other posts from ASP.net Weblogs or by Paulo Morgado
Published on Tue, 29 May 2012 00:20:00 GMT Indexed on 2012/05/30 16:42 UTC
Read the original article Hit count: 641

When I was localizing a Windows Phone application I was developing, I set the argument on the constructor of the AssemblyCultureAttribute for the neutral culture (en-US in this particular case) for my application.

As it was late at night (or early in the dawn Smile) I went to sleep and, on the next day, the application wasn’t launching although it compiled just fine.

I’ll have to confess that it took me a couple of nights to figure out what I had done to my application.

Have you figured out what I did wrong?

The documentation for the AssemblyCultureAttribute states that:

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.

So, what I did was marking the once main assembly as a satellite assembly for the en-US culture which made it impossible to find its entry point.

To set the the neutral culture for the assembly resources I should haveused (and eventually did) the NeutralResourcesLanguageAttribute. According to its documentation:

The NeutralResourcesLanguageAttribute attribute informs the ResourceManager of the application's default culture, and also informs the ResourceManager that the default culture's resources are found in the main application assembly. When looking up resources in the same culture as the default culture, the ResourceManager automatically uses the resources located in the main assembly instead of searching for a satellite assembly. This improves lookup performance for the first resource you load, and can reduce your working set.

© ASP.net Weblogs or respective owner

Related posts about .NET

Related posts about CodeProject