Out of the blue our Azure web app is spewing out errors regarding a Culture that is not supported. We load up a list of countries to show on the front page but this is suddenly giving errors. The same code is used on other various web apps as well and they aren't having the problem.
The following code gives a problem.
private List<SelectListItem> Countries()
{
RegionInfo country = new RegionInfo(new CultureInfo("nl-BE", false).LCID);
List<SelectListItem> countryNames = new List<SelectListItem>();
foreach (CultureInfo cul in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
country = new RegionInfo(new CultureInfo(cul.Name, false).LCID);
countryNames.Add(new SelectListItem() { Text = country.DisplayName, Value = country.DisplayName });
}
return countryNames.GroupBy(x => x.Text).Select(x => x.FirstOrDefault()).ToList<SelectListItem>().OrderBy(x => x.Text).ToList();
}
I placed a try-catch in the for-each so I can pinpoint the cultures that are giving errors. The following cultures are suddenly returning errors:
<errors>
<LCID>4096</LCID>
<Name>ar-001</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>el-CY</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-BB</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-BS</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-HK</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-NL</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-SE</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>es-419</Name>
</errors>
Can someone help me with this issue? I can't seem to make sense on why this web app is suddenly giving these errors.
[system.Globalization.CultureInfo]::GetCultures('AllCultures')
to retrieve the supported cultures by accessing "Debug console > PowerShell" within KUDU . Then try to find whether you could find the above cultures. – Terminus[system.Globalization.CultureInfo]::GetCultures('AllCultures')
from Kudu console worked fine for me. @Lot I think the reason it didn't work for you is that Bruce's note includes some control characters that messes it up (assuming you copy/pasted). But it does work. – Abed