With https://github.com/dotnet/coreclr/pull/579, I added to IndexOfOrdinal a check for value.Length == 0, to avoid returning bad data in that case. But in doing so, and in neglecting to add a similar check to LastIndexOfOrdinal (which is currently implemented in terms of IndexOfOrdinal), I introduced an infinite loop into LastIndexOfOrdinal when value.Length == 0. Fixing by adding a similar special-case.
Contract.Assert(value != null);
// TODO: Implement This Fully.
+
+ if (value.Length == 0)
+ {
+ return startIndex;
+ }
+
if (ignoreCase)
{
source = source.ToUpper(CultureInfo.InvariantCulture);