I am using Contentment with Umbraco v10. When I use the Contentment DataList editor with data source as .NET countries or .NET Currencies, I got the folowing error:
System.ArgumentException: Culture ID 4096 (0x1000) is a neutral culture; a region cannot be created from it. (Parameter 'culture')
Having a closer look at the code I can see the CountriesDataListSource at this point:
return CultureInfo
.GetCultures(CultureTypes.SpecificCultures)
.Select(x => new RegionInfo(x.LCID))
.DistinctBy(x => x.TwoLetterISORegionName)
.Where(x => x.TwoLetterISORegionName.Length == 2) // NOTE: Removes odd "countries" such as Caribbean (029), Europe (150), Latin America (419) and World (001).
.OrderBy(x => x.EnglishName)
.Select(x => new DataListItem
{
Name = x.EnglishName,
Value = x.TwoLetterISORegionName
});
Apparently GetCultures() is returning neutral cultures that then break the code when trying to create the RegionInfo.
Has anyone experienced this, or have any clue as how to solve this?
Apparently, trying to get the region by the country code only was causing the available specific cultures to be neutral cultures too. Not sure I understand why... maybe someone can come up with a reasonable explanation.
Contentment country list error
I am using Contentment with Umbraco v10. When I use the Contentment DataList editor with data source as .NET countries or .NET Currencies, I got the folowing error:
Having a closer look at the code I can see the CountriesDataListSource at this point:
Apparently GetCultures() is returning neutral cultures that then break the code when trying to create the RegionInfo.
Has anyone experienced this, or have any clue as how to solve this?
Thanks.
Found the issue:
inside a Render Controller we had:
Changed it to:
Apparently, trying to get the region by the country code only was causing the available specific cultures to be neutral cultures too. Not sure I understand why... maybe someone can come up with a reasonable explanation.
probably because US is not a valid culture code.
It is not, although the RegionInfo method was working properly.
is working on a reply...