Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,16 @@ public void TestGetCultureInfo_PredefinedOnly_ReturnsSame()
Assert.Equal(CultureInfo.GetCultureInfo("en-US"), CultureInfo.GetCultureInfo("en-US", predefinedOnly: true));
}

[ConditionalTheory(nameof(PredefinedCulturesOnlyIsDisabled))]
[InlineData(0x0001)]
[InlineData(0x7c5C)]
[InlineData(0x03_0404)] // with sort id
[InlineData(0x007F)] // LOCALE_INVARIANT
public void TestCultureInfo_Ctor_Int32_ReturnsInvariant(int culture)
{
Assert.Equal(new CultureInfo(culture), CultureInfo.InvariantCulture);
}

private static byte[] GetExpectedInvariantOrdinalSortKey(ReadOnlySpan<char> input)
{
MemoryStream memoryStream = new MemoryStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,16 @@ internal static CultureData GetCultureData(int culture, bool bUseUserOverride)

if (GlobalizationMode.Invariant)
{
if (!GlobalizationMode.PredefinedCulturesOnly)
{
if (culture is < 1 or > 0xf_ffff)
{
throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);
}

return Invariant;
}

// LCID is not supported in the InvariantMode
throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupportedInInvariantMode);
}
Expand Down