diff --git a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs index 6fd30317d7f06..7a4c0c7481710 100644 --- a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs +++ b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using System.Tests; using Microsoft.DotNet.RemoteExecutor; using Xunit; @@ -267,5 +268,19 @@ public void ValidateThrowingWhenUsingCustomUnspecifiedLcid() AssertExtensions.Throws("culture", () => new RegionInfo(4096)); } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows8x))] + public void BuiltInRegionListTest() + { + // Ensure we can create all region info objects from the built-in list + Dictionary regionNames = (Dictionary)typeof(RegionInfo).Assembly.GetType("System.Globalization.CultureData").GetProperty("RegionNames", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); + + foreach (var kvp in regionNames) + { + RegionInfo ri1 = new RegionInfo(kvp.Key); + RegionInfo ri2 = new RegionInfo(kvp.Value == "" ? kvp.Key : kvp.Value); // invariant culture + Assert.Equal(ri1.Name, ri2.Name); + } + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs index 63db5cdf58c12..bd69203950249 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs @@ -164,7 +164,7 @@ internal sealed partial class CultureData { "AL", "sq-AL" }, { "AM", "hy-AM" }, { "AO", "pt-AO" }, - { "AQ", "en-A" }, + { "AQ", "en-AQ" }, { "AR", "es-AR" }, { "AS", "en-AS" }, { "AT", "de-AT" }, @@ -189,7 +189,7 @@ internal sealed partial class CultureData { "BR", "pt-BR" }, { "BS", "en-BS" }, { "BT", "dz-BT" }, - { "BV", "nb-B" }, + { "BV", "nb-BV" }, { "BW", "en-BW" }, { "BY", "be-BY" }, { "BZ", "en-BZ" }, @@ -202,7 +202,7 @@ internal sealed partial class CultureData { "CI", "fr-CI" }, { "CK", "en-CK" }, { "CL", "es-CL" }, - { "CM", "fr-C" }, + { "CM", "fr-CM" }, { "CN", "zh-CN" }, { "CO", "es-CO" }, { "CR", "es-CR" }, @@ -245,13 +245,13 @@ internal sealed partial class CultureData { "GP", "fr-GP" }, { "GQ", "es-GQ" }, { "GR", "el-GR" }, - { "GS", "en-G" }, + { "GS", "en-GS" }, { "GT", "es-GT" }, { "GU", "en-GU" }, { "GW", "pt-GW" }, { "GY", "en-GY" }, { "HK", "zh-HK" }, - { "HM", "en-H" }, + { "HM", "en-HM" }, { "HN", "es-HN" }, { "HR", "hr-HR" }, { "HT", "fr-HT" }, @@ -372,7 +372,7 @@ internal sealed partial class CultureData { "SZ", "ss-SZ" }, { "TC", "en-TC" }, { "TD", "fr-TD" }, - { "TF", "fr-T" }, + { "TF", "fr-TF" }, { "TG", "fr-TG" }, { "TH", "th-TH" }, { "TJ", "tg-Cyrl-TJ" },