1

I have following code to detect whether culture name represents valid culture (I check it to proceed for report rendering in given culture).

try
{
    this.Culture = new CultureInfo(cultureName);
}
catch (CultureNotFoundException)
{
    // on exception default culture will be used
}

When culture is found, it is set to Culture and later used in report rendering. It works fine in most cases, but if I provide "en-NL" as culture name, the code throws exception on localhost (culture is not found) which is fine (report is rendered with invariant culture).

But if I deploy it remotely on Azure, culture is found and rendering of report fails (because it cannot find such culture).

I tried this code on dotnetfiddle. And there it also returns culture name. But LCID is 4096.

I googled what 4096 stands for and realized it is LOCALE_CUSTOM_UNSPECIFIED - so some culture created by user.

The question is why it behaves differently. I have .NET 4.5 installed on local and Azure too.

Another question is whether I can handle it in a way that if LCID is 4096 I rather use invariant culture to avoid the risk culture does not really exist.

NOTE: I do not think it is duplicate of this question. I think it has nothing with case-sensitivity, it is about not recognizing particular culture locally and recognizing it on another server.

michal.jakubeczy
  • 8,221
  • 1
  • 59
  • 63
  • Possible duplicate of [Culture-Invariant case-sensitive string comparison returns different results on different machines](https://stackoverflow.com/questions/25727349/culture-invariant-case-sensitive-string-comparison-returns-different-results-on) – Feras Al Sous Jul 23 '18 at 13:33
  • I am affraid the link you provided does not solve my problem. It may be I suppose OS related - on my PC I have Windows 7 and this culture 'en-NL' was introduced in Windows 10. – michal.jakubeczy Jul 23 '18 at 13:38

0 Answers0