Use Ordinal when searching for collation keyword
authorMatt Ellis <matell@microsoft.com>
Wed, 23 Sep 2015 06:47:59 +0000 (23:47 -0700)
committerMatt Ellis <matell@microsoft.com>
Wed, 23 Sep 2015 06:54:15 +0000 (23:54 -0700)
IndexOf by default is culture specific, which could lead to us doing
the wrong thing depending on the current culture and also can cause
problems where we need to access CultureData while we are still building
up culture information, causing infinite recursion.

Some collection tests were triggering the latter case and failing after
we merged in the ICU changes.

src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs

index 4241577..336db74 100644 (file)
@@ -3,6 +3,7 @@
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 //
 
+using System;
 using System.Collections.Generic;
 using System.Diagnostics.Contracts;
 using System.Runtime.InteropServices;
@@ -69,7 +70,7 @@ namespace System.Globalization
             this.sWindowsName = StringBuilderCache.GetStringAndRelease(sb); // the name passed to subsequent ICU calls
 
             // Replace the ICU collation keyword with an _
-            index = realNameBuffer.IndexOf(ICU_COLLATION_KEYWORD);
+            index = realNameBuffer.IndexOf(ICU_COLLATION_KEYWORD, StringComparison.Ordinal);
             if (index >= 0)
             {
                 this.sName = this.sWindowsName.Substring(0, index) + "_" + alternateSortName;