Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Globalization, Localization And Why My Application Stopped Launching

5.00/5 (1 vote)
30 May 2012CPOL2 min read 7.8K  
Globalization, localization and why my application stopped launching

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.StatCounter

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 mark 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 neutral culture for the assembly resources, I should have used (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.


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)