Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Lipnin <v-maxlip@microsoft.com>2021-03-27 13:39:33 +0300
committerGitHub <noreply@github.com>2021-03-27 13:39:33 +0300
commit69cfb5fa61ab9b78c7c4f76812b8b84f165dc73d (patch)
treeb2dae27c84869418c53cfc0170b3c21ff89303bf
parenteb4c3116ebf3ac44f72232fc9315fa4947c04b44 (diff)
Fix the System.String.Replace throwing NotImplementedException (#20960) (#20978)mono-6.12.0.132
https://github.com/mono/mono/issues/20948
-rw-r--r--mcs/class/corlib/Test/System/StringTest.cs4
-rw-r--r--mcs/class/corlib/corefx/CompareInfo.cs2
2 files changed, 5 insertions, 1 deletions
diff --git a/mcs/class/corlib/Test/System/StringTest.cs b/mcs/class/corlib/Test/System/StringTest.cs
index eabaa07fe12..4407d4a71a7 100644
--- a/mcs/class/corlib/Test/System/StringTest.cs
+++ b/mcs/class/corlib/Test/System/StringTest.cs
@@ -3221,6 +3221,10 @@ public class StringTest
// Test replacing null characters (bug #67395)
Assert.AreEqual ("is this ok ?", "is \0 ok ?".Replace ("\0", "this"), "should not strip content after nullchar");
+
+ // System.String.Replace fails with NotImplementedException https://github.com/mono/mono/issues/20948
+ Assert.AreEqual ("Original", s1.Replace("o", "O", StringComparison.CurrentCulture), "Replace(string, string, StringComparison)");
+ Assert.AreEqual ("Original", s1.Replace("o", "O", false, CultureInfo.CurrentCulture), "Replace(string, string, bool, CultureInfo)");
}
[Test]
diff --git a/mcs/class/corlib/corefx/CompareInfo.cs b/mcs/class/corlib/corefx/CompareInfo.cs
index b8205f21ac5..08f6aa50355 100644
--- a/mcs/class/corlib/corefx/CompareInfo.cs
+++ b/mcs/class/corlib/corefx/CompareInfo.cs
@@ -86,7 +86,7 @@ namespace System.Globalization
unsafe int IndexOfCore (string source, string target, int startIndex, int count, CompareOptions options, int* matchLengthPtr)
{
if (matchLengthPtr != null)
- throw new NotImplementedException ();
+ *matchLengthPtr = target.Length;
return internal_index_switch (source, startIndex, count, target, options, true);
}