diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs index ba2b279425dd68..7513730ee04169 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs @@ -196,7 +196,6 @@ public void AdjustScale() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void ConvertToPrecScale() { Assert.Equal(new SqlDecimal(6464.6m).Value, SqlDecimal.ConvertToPrecScale(_test1, 5, 1).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs index 3ac24fb705c54c..7fa294f8fe95d4 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs @@ -38,7 +38,7 @@ public static class SqlStringSortingTest private static readonly UnicodeEncoding s_unicodeEncoding = new UnicodeEncoding(bigEndian: false, byteOrderMark: false, throwOnInvalidBytes: true); [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] [InlineData("ja-JP", 0x0411)] // Japanese - Japan [InlineData("ar-SA", 0x0401)] // Arabic - Saudi Arabia [InlineData("de-DE", 0x0407)] // German - Germany diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs index 0aa18b8b18f2ae..56f8fa51b06ca2 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs @@ -56,7 +56,6 @@ public SqlStringTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void Constructor_Value_Success() { const string value = "foo"; @@ -220,7 +219,6 @@ public void CompareToSqlTypeException() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void CompareTo() { Assert.True(_test1.CompareTo(_test3) < 0); @@ -261,7 +259,6 @@ public void CompareTo() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); @@ -278,7 +275,6 @@ public void EqualsMethods() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void Greaters() { // GreateThan () @@ -293,7 +289,6 @@ public void Greaters() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void Lessers() { // LessThan() @@ -309,7 +304,6 @@ public void Lessers() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void NotEquals() { Assert.True(SqlString.NotEquals(_test1, _test2).Value); @@ -320,7 +314,6 @@ public void NotEquals() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void Concat() { _test1 = new SqlString("First TestString"); @@ -332,7 +325,6 @@ public void Concat() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void Clone() { SqlString testSqlString = _test1.Clone(); @@ -352,7 +344,6 @@ public void CompareOptionsFromSqlCompareOptions() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void UnicodeBytes() { Assert.Equal((byte)105, _test1.GetNonUnicodeBytes()[1]); @@ -549,7 +540,6 @@ public void Conversions() // OPERATORS [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void ArithmeticOperators() { SqlString testString = new SqlString("...Testing..."); @@ -558,7 +548,6 @@ public void ArithmeticOperators() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void ThanOrEqualOperators() { // == -operator diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs index edffac427928fd..a2bf6004072980 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs @@ -222,7 +222,6 @@ public void CultureName_Set(AssemblyName assemblyName, string originalCultureNam } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] public void CultureName_Set_Invalid_ThrowsCultureNotFoundException() { var assemblyName = new AssemblyName("Test"); diff --git a/src/native/libs/System.Globalization.Native/pal_locale.m b/src/native/libs/System.Globalization.Native/pal_locale.m index c777687e3e1955..6d13c807bec95d 100644 --- a/src/native/libs/System.Globalization.Native/pal_locale.m +++ b/src/native/libs/System.Globalization.Native/pal_locale.m @@ -786,13 +786,21 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) } } +static NSString* GetBaseName(NSString *localeIdentifier) +{ + NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]; + NSString *languageCode = [locale objectForKey:NSLocaleLanguageCode]; + return languageCode; +} + const char* GlobalizationNative_GetDefaultLocaleNameNative(void) { @autoreleasepool { if (NSLocale.preferredLanguages.count > 0) { - return strdup([NSLocale.preferredLanguages[0] UTF8String]); + NSString *preferredLanguage = [NSLocale.preferredLanguages objectAtIndex:0]; + return strdup([GetBaseName(preferredLanguage) UTF8String]); } else { @@ -813,7 +821,7 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) localeName = currentLocale.localeIdentifier; } - return strdup([localeName UTF8String]); + return strdup([GetBaseName(localeName) UTF8String]); } } }