From d2a96e87d2e94d72ea510dd3befd66d76ca6f4b6 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 14 Oct 2025 11:37:43 +0200 Subject: [PATCH 1/9] do ASCII path first --- .../src/System/Globalization/TextInfo.cs | 119 +++++++++++------- .../src/System/String.Manipulation.cs | 4 +- 2 files changed, 77 insertions(+), 46 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index 83686710940462..410e45fd2e9d3d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -177,18 +177,19 @@ public string ToLower(string str) return InvariantModeCasing.ToLower(str); } - return ChangeCaseCommon(str); + return ChangeCaseCommon(this, str); } - internal void ToLower(ReadOnlySpan source, Span destination) + internal static string ToLowerInvariant(string str) { - if (GlobalizationMode.Invariant) - { - InvariantModeCasing.ToLower(source, destination); - return; - } + ArgumentNullException.ThrowIfNull(str); - ChangeCaseCommon(source, destination); + return ChangeCaseCommon(null, str); + } + + internal void ToLower(ReadOnlySpan source, Span destination) + { + ChangeCaseCommon(this, source, destination); } private unsafe char ChangeCase(char c, bool toUpper) @@ -221,18 +222,18 @@ internal static char ToUpperOrdinal(char c) internal void ChangeCaseToLower(ReadOnlySpan source, Span destination) { Debug.Assert(destination.Length >= source.Length); - ChangeCaseCommon(source, destination); + ChangeCaseCommon(this, source, destination); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void ChangeCaseToUpper(ReadOnlySpan source, Span destination) { Debug.Assert(destination.Length >= source.Length); - ChangeCaseCommon(source, destination); + ChangeCaseCommon(this, source, destination); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private unsafe void ChangeCaseCommon(ReadOnlySpan source, Span destination) where TConversion : struct + private static unsafe void ChangeCaseCommon(TextInfo? instance, ReadOnlySpan source, Span destination) where TConversion : struct { Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(typeof(TConversion) == typeof(ToUpperConversion) || typeof(TConversion) == typeof(ToLowerConversion)); @@ -245,7 +246,8 @@ private unsafe void ChangeCaseCommon(ReadOnlySpan source, Spa bool toUpper = typeof(TConversion) == typeof(ToUpperConversion); // JIT will treat this as a constant in release builds int charsConsumed = 0; - if (IsAsciiCasingSameAsInvariant) + // instance being null indicates the invariant culture where IsAsciiCasingSameAsInvariant is always true. + if (instance == null || instance.IsAsciiCasingSameAsInvariant) { OperationStatus operationStatus = toUpper ? Ascii.ToUpper(source, destination, out charsConsumed) @@ -258,14 +260,34 @@ private unsafe void ChangeCaseCommon(ReadOnlySpan source, Spa } } - fixed (char* pSource = &MemoryMarshal.GetReference(source)) - fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) + if (GlobalizationMode.Invariant) { - ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, pDestination + charsConsumed, destination.Length - charsConsumed, toUpper); + // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: + // 1) GlobalizationMode.Invariant is substitable by ILLink (so the other branch can be trimmed away when true) + // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. + Debug.Assert(instance == null); + + if (toUpper) + { + InvariantModeCasing.ToUpper(source, destination); + } + else + { + InvariantModeCasing.ToLower(source, destination); + } + } + else + { + fixed (char* pSource = &MemoryMarshal.GetReference(source)) + fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) + { + instance!.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, + pDestination + charsConsumed, destination.Length - charsConsumed, toUpper); + } } } - private unsafe string ChangeCaseCommon(string source) where TConversion : struct + private static unsafe string ChangeCaseCommon(TextInfo? instance, string source) where TConversion : struct { Debug.Assert(typeof(TConversion) == typeof(ToUpperConversion) || typeof(TConversion) == typeof(ToLowerConversion)); bool toUpper = typeof(TConversion) == typeof(ToUpperConversion); // JIT will treat this as a constant in release builds @@ -286,7 +308,9 @@ private unsafe string ChangeCaseCommon(string source) where TConver // If this culture's casing for ASCII is the same as invariant, try to take // a fast path that'll work in managed code and ASCII rather than calling out // to the OS for culture-aware casing. - if (IsAsciiCasingSameAsInvariant) + // + // instance being null indicates the invariant culture where IsAsciiCasingSameAsInvariant is always true. + if (instance == null || instance.IsAsciiCasingSameAsInvariant) { // Read 2 chars (one 32-bit integer) at a time @@ -341,31 +365,42 @@ private unsafe string ChangeCaseCommon(string source) where TConver source.AsSpan(0, (int)currIdx).CopyTo(resultSpan); // and re-run the fast span-based logic over the remainder of the data - ChangeCaseCommon(source.AsSpan((int)currIdx), resultSpan.Slice((int)currIdx)); + ChangeCaseCommon(instance, source.AsSpan((int)currIdx), resultSpan.Slice((int)currIdx)); return result; } } NotAscii: { - // We reached non-ASCII data *or* the requested culture doesn't map ASCII data the same way as the invariant culture. - // In either case we need to fall back to the localization tables. - - string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count - - if (currIdx > 0) + if (GlobalizationMode.Invariant) { - // copy existing known-good data into the result - Span resultSpan = new Span(ref result.GetRawStringData(), result.Length); - source.AsSpan(0, (int)currIdx).CopyTo(resultSpan); + // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: + // 1) GlobalizationMode.Invariant is substitable by ILLink (so the other branch can be trimmed away when true) + // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. + Debug.Assert(instance == null); + return toUpper ? InvariantModeCasing.ToUpper(source) : InvariantModeCasing.ToLower(source); } - - // and run the culture-aware logic over the remainder of the data - fixed (char* pResult = result) + else { - ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); + // We reached non-ASCII data *or* the requested culture doesn't map ASCII data the same way as the invariant culture. + // In either case we need to fall back to the localization tables. + + string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count + + if (currIdx > 0) + { + // copy existing known-good data into the result + Span resultSpan = new Span(ref result.GetRawStringData(), result.Length); + source.AsSpan(0, (int)currIdx).CopyTo(resultSpan); + } + + // and run the culture-aware logic over the remainder of the data + fixed (char* pResult = result) + { + instance!.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); + } + return result; } - return result; } } } @@ -454,23 +489,19 @@ public string ToUpper(string str) { ArgumentNullException.ThrowIfNull(str); - if (GlobalizationMode.Invariant) - { - return InvariantModeCasing.ToUpper(str); - } + return ChangeCaseCommon(this, str); + } + + internal static string ToUpperInvariant(string str) + { + ArgumentNullException.ThrowIfNull(str); - return ChangeCaseCommon(str); + return ChangeCaseCommon(null, str); } internal void ToUpper(ReadOnlySpan source, Span destination) { - if (GlobalizationMode.Invariant) - { - InvariantModeCasing.ToUpper(source, destination); - return; - } - - ChangeCaseCommon(source, destination); + ChangeCaseCommon(this, source, destination); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs b/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs index 774f5c49d46e2f..7acc23d53c6535 100644 --- a/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs +++ b/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs @@ -2365,7 +2365,7 @@ public string ToLower(CultureInfo? culture) // Creates a copy of this string in lower case based on invariant culture. public string ToLowerInvariant() { - return TextInfo.Invariant.ToLower(this); + return TextInfo.ToLowerInvariant(this); } public string ToUpper() => ToUpper(null); @@ -2380,7 +2380,7 @@ public string ToUpper(CultureInfo? culture) // Creates a copy of this string in upper case based on invariant culture. public string ToUpperInvariant() { - return TextInfo.Invariant.ToUpper(this); + return TextInfo.ToUpperInvariant(this); } // Trims the whitespace from both ends of the string. Whitespace is defined by From 6e87af5bc1d42171731c8e46a2aefd74d0d52f95 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 14 Oct 2025 11:46:47 +0200 Subject: [PATCH 2/9] fix typo --- .../src/System/Globalization/TextInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index 410e45fd2e9d3d..be8cb2b4ff157f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -263,7 +263,7 @@ private static unsafe void ChangeCaseCommon(TextInfo? instance, Rea if (GlobalizationMode.Invariant) { // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: - // 1) GlobalizationMode.Invariant is substitable by ILLink (so the other branch can be trimmed away when true) + // 1) GlobalizationMode.Invariant is substitutable by ILLink (so the other branch can be trimmed away when true) // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. Debug.Assert(instance == null); @@ -375,7 +375,7 @@ private static unsafe string ChangeCaseCommon(TextInfo? instance, s if (GlobalizationMode.Invariant) { // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: - // 1) GlobalizationMode.Invariant is substitable by ILLink (so the other branch can be trimmed away when true) + // 1) GlobalizationMode.Invariant is substitutable by ILLink (so the other branch can be trimmed away when true) // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. Debug.Assert(instance == null); return toUpper ? InvariantModeCasing.ToUpper(source) : InvariantModeCasing.ToLower(source); From c349154c30523e2e12d201452ebbf18492ecde10 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 14 Oct 2025 12:23:50 +0200 Subject: [PATCH 3/9] cleanup --- .../src/System/Globalization/TextInfo.cs | 58 +++++++++---------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index be8cb2b4ff157f..77ba6d0988f41b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -262,11 +262,6 @@ private static unsafe void ChangeCaseCommon(TextInfo? instance, Rea if (GlobalizationMode.Invariant) { - // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: - // 1) GlobalizationMode.Invariant is substitutable by ILLink (so the other branch can be trimmed away when true) - // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. - Debug.Assert(instance == null); - if (toUpper) { InvariantModeCasing.ToUpper(source, destination); @@ -276,14 +271,15 @@ private static unsafe void ChangeCaseCommon(TextInfo? instance, Rea InvariantModeCasing.ToLower(source, destination); } } - else + + // instance being null means it's Invariant + instance ??= Invariant; + + fixed (char* pSource = &MemoryMarshal.GetReference(source)) + fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) { - fixed (char* pSource = &MemoryMarshal.GetReference(source)) - fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) - { - instance!.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, - pDestination + charsConsumed, destination.Length - charsConsumed, toUpper); - } + instance!.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, + pDestination + charsConsumed, destination.Length - charsConsumed, toUpper); } } @@ -374,33 +370,31 @@ private static unsafe string ChangeCaseCommon(TextInfo? instance, s { if (GlobalizationMode.Invariant) { - // We could have just checked instance for being null instead of GlobalizationMode.Invariant, but: - // 1) GlobalizationMode.Invariant is substitutable by ILLink (so the other branch can be trimmed away when true) - // 2) GlobalizationMode.Invariant triggers ICU load if it was not already loaded. Debug.Assert(instance == null); return toUpper ? InvariantModeCasing.ToUpper(source) : InvariantModeCasing.ToLower(source); } - else - { - // We reached non-ASCII data *or* the requested culture doesn't map ASCII data the same way as the invariant culture. - // In either case we need to fall back to the localization tables. - string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count + // We reached non-ASCII data *or* the requested culture doesn't map ASCII data the same way as the invariant culture. + // In either case we need to fall back to the localization tables. - if (currIdx > 0) - { - // copy existing known-good data into the result - Span resultSpan = new Span(ref result.GetRawStringData(), result.Length); - source.AsSpan(0, (int)currIdx).CopyTo(resultSpan); - } + string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count - // and run the culture-aware logic over the remainder of the data - fixed (char* pResult = result) - { - instance!.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); - } - return result; + if (currIdx > 0) + { + // copy existing known-good data into the result + Span resultSpan = new Span(ref result.GetRawStringData(), result.Length); + source.AsSpan(0, (int)currIdx).CopyTo(resultSpan); + } + + // instance being null means it's Invariant + instance ??= Invariant; + + // and run the culture-aware logic over the remainder of the data + fixed (char* pResult = result) + { + instance!.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); } + return result; } } } From d8b3582e8ef395c5d2a0e5e93e17cc5d407e66a0 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 14 Oct 2025 13:36:48 +0200 Subject: [PATCH 4/9] Fix tests --- .../System.Private.CoreLib/src/System/Globalization/TextInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index 77ba6d0988f41b..f44dfde4d9e375 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -235,7 +235,6 @@ internal void ChangeCaseToUpper(ReadOnlySpan source, Span destinatio [MethodImpl(MethodImplOptions.AggressiveInlining)] private static unsafe void ChangeCaseCommon(TextInfo? instance, ReadOnlySpan source, Span destination) where TConversion : struct { - Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(typeof(TConversion) == typeof(ToUpperConversion) || typeof(TConversion) == typeof(ToLowerConversion)); if (source.IsEmpty) @@ -288,7 +287,6 @@ private static unsafe string ChangeCaseCommon(TextInfo? instance, s Debug.Assert(typeof(TConversion) == typeof(ToUpperConversion) || typeof(TConversion) == typeof(ToLowerConversion)); bool toUpper = typeof(TConversion) == typeof(ToUpperConversion); // JIT will treat this as a constant in release builds - Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(source != null); // If the string is empty, we're done. From 5fa74a029ef0fd5203cf66cb6b6232e801aa1739 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 14 Oct 2025 19:00:35 +0200 Subject: [PATCH 5/9] Update TextInfo.cs --- .../System.Private.CoreLib/src/System/Globalization/TextInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index f44dfde4d9e375..6e5d973e4e5b8d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -368,7 +368,6 @@ private static unsafe string ChangeCaseCommon(TextInfo? instance, s { if (GlobalizationMode.Invariant) { - Debug.Assert(instance == null); return toUpper ? InvariantModeCasing.ToUpper(source) : InvariantModeCasing.ToLower(source); } From 0837c10d165504b2e496e708855f605ead0469f0 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 14 Oct 2025 22:36:24 +0200 Subject: [PATCH 6/9] Remove unnecessary null-forgiving operator from ChangeCaseCore --- .../src/System/Globalization/TextInfo.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index 6e5d973e4e5b8d..651196c2a3d545 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -269,6 +269,7 @@ private static unsafe void ChangeCaseCommon(TextInfo? instance, Rea { InvariantModeCasing.ToLower(source, destination); } + return; } // instance being null means it's Invariant @@ -277,7 +278,7 @@ private static unsafe void ChangeCaseCommon(TextInfo? instance, Rea fixed (char* pSource = &MemoryMarshal.GetReference(source)) fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) { - instance!.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, + instance.ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, pDestination + charsConsumed, destination.Length - charsConsumed, toUpper); } } @@ -389,7 +390,7 @@ private static unsafe string ChangeCaseCommon(TextInfo? instance, s // and run the culture-aware logic over the remainder of the data fixed (char* pResult = result) { - instance!.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); + instance.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); } return result; } From ee1718a59225f0e515667050bcadcb6baa383d20 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 14 Oct 2025 22:53:45 +0200 Subject: [PATCH 7/9] clean up --- .../src/System/Globalization/TextInfo.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index f44dfde4d9e375..1bb9c159ee9efa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -171,19 +171,12 @@ internal static char ToLowerInvariant(char c) public string ToLower(string str) { ArgumentNullException.ThrowIfNull(str); - - if (GlobalizationMode.Invariant) - { - return InvariantModeCasing.ToLower(str); - } - return ChangeCaseCommon(this, str); } internal static string ToLowerInvariant(string str) { ArgumentNullException.ThrowIfNull(str); - return ChangeCaseCommon(null, str); } @@ -480,14 +473,12 @@ internal static char ToUpperInvariant(char c) public string ToUpper(string str) { ArgumentNullException.ThrowIfNull(str); - return ChangeCaseCommon(this, str); } internal static string ToUpperInvariant(string str) { ArgumentNullException.ThrowIfNull(str); - return ChangeCaseCommon(null, str); } From 2be54e8b56ab2c5769c9bb1636886ef52ed6449e Mon Sep 17 00:00:00 2001 From: EgorBo Date: Wed, 15 Oct 2025 03:29:04 +0200 Subject: [PATCH 8/9] add a test --- .../InvariantGlobalizationTrue.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs index 27ab1b136b5a4f..0f4088093932ff 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs @@ -11,10 +11,31 @@ /// class Program { + private static string Str1 = "aaaaBBBB"; + private static string Str2 = "ccccDDDD"; + private static string Str3; + static int Main(string[] args) { const BindingFlags allStatics = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; + Str3 = Str1.ToLowerInvariant() + Str2.ToUpperInvariant(); + + Type textInfo = GetCoreLibType("System.Globalization.TextInfo"); + if (textInfo != null) + { + string[] methodsShouldBeGone = ["NlsChangeCase", "ChangeCaseCore", "ChangeCaseNative", "IcuChangeCase"]; + + foreach (MethodInfo method in textInfo.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) + { + if (methodsShouldBeGone.Contains(method.Name)) + { + Console.WriteLine($"Member '{method.Name}' was not trimmed from GlobalizationMode, but should have been."); + return -2; + } + } + } + try { CultureInfo.CurrentCulture = new CultureInfo("tr-TR"); @@ -40,7 +61,7 @@ static int Main(string[] args) return 100; } - + // Ensure the internal GlobalizationMode class is trimmed correctly. Type globalizationMode = GetCoreLibType("System.Globalization.GlobalizationMode"); From 643ecb17ca2299093f719d33d344ddd7242ffe7c Mon Sep 17 00:00:00 2001 From: EgorBo Date: Wed, 15 Oct 2025 03:30:44 +0200 Subject: [PATCH 9/9] cleanup --- .../TrimmingTests/InvariantGlobalizationTrue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs index 0f4088093932ff..0f121c9c943d81 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/InvariantGlobalizationTrue.cs @@ -26,7 +26,7 @@ static int Main(string[] args) { string[] methodsShouldBeGone = ["NlsChangeCase", "ChangeCaseCore", "ChangeCaseNative", "IcuChangeCase"]; - foreach (MethodInfo method in textInfo.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) + foreach (MethodInfo method in textInfo.GetMethods(BindingFlags.Instance | allStatics)) { if (methodsShouldBeGone.Contains(method.Name)) {