diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/StringSegment.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/StringSegment.cs
index b97c498f0953815a465d55ecd8c863a5b278a9b4..e680b4566205917a567c59c73e6f8b4237fcc6e6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/StringSegment.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/StringSegment.cs
@@ -110,7 +110,6 @@ namespace Microsoft.AspNetCore.Razor
             return Equals(other, StringComparison.Ordinal);
         }
 
-
         /// <summary>
         /// Indicates whether the current object is equal to another object of the same type.
         /// </summary>
@@ -160,15 +159,7 @@ namespace Microsoft.AspNetCore.Razor
         /// <param name="comparisonType">One of the enumeration values that specifies the rules to use in the comparison.</param>
         /// <returns><code>true</code> if the specified <see cref="string"/> is equal to the current <see cref="StringSegment"/>; otherwise, <code>false</code>.</returns>
         public bool Equals(string text, StringComparison comparisonType)
-        {
-            var textLength = text.Length;
-            if (!HasValue || Length != textLength)
-            {
-                return false;
-            }
-
-            return string.Compare(Buffer, Offset, text, 0, textLength, comparisonType) == 0;
-        }
+            => Equals(new StringSegment(text), comparisonType);
 
         /// <inheritdoc />
         public override int GetHashCode()
@@ -225,10 +216,7 @@ namespace Microsoft.AspNetCore.Razor
         /// <param name="comparisonType">One of the enumeration values that specifies the rules to use in the comparison.</param>
         /// <returns><code>true</code> if <paramref name="text"/> matches the beginning of this <see cref="StringSegment"/>; otherwise, <code>false</code>.</returns>
         public bool StartsWith(string text, StringComparison comparisonType)
-        {
-            var textLength = text.Length;
-            return string.Compare(Buffer, Offset, text, 0, textLength, comparisonType) == 0;
-        }
+            => StartsWith(new StringSegment(text), comparisonType);
 
         public bool StartsWith(StringSegment text, StringComparison comparisonType)
         {
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/StringSegmentTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/StringSegmentTest.cs
index 4b202656e09f1468e8c746fcbe4f7aa6f27dd064..4d203c30d9a20e91ba10becd0cac1458e0230621 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/StringSegmentTest.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/StringSegmentTest.cs
@@ -248,6 +248,48 @@ namespace Microsoft.AspNetCore.Razor.Language
             Assert.Equal(expectedResult, result);
         }
 
+        [Fact]
+        public void StringSegment_Equals_NullString()
+        {
+            // Arrange
+            var stringSegment = new StringSegment("text");
+            var @string = (string)null;
+
+            // Act
+            var result = stringSegment.Equals(@string, StringComparison.Ordinal);
+
+            // Assert
+            Assert.False(result);
+        }
+
+        [Fact]
+        public void StringSegment_DefaultValue_Equals_NullString()
+        {
+            // Arrange
+            var stringSegment = StringSegment.Empty;
+            var @string = (string)null;
+
+            // Act
+            var result = stringSegment.Equals(@string, StringComparison.Ordinal);
+
+            // Assert
+            Assert.False(result);
+        }
+
+        [Fact]
+        public void StringSegment_DefaultValue_Equals_EmptyString()
+        {
+            // Arrange
+            var stringSegment = StringSegment.Empty;
+            var @string = string.Empty;
+
+            // Act
+            var result = stringSegment.Equals(@string, StringComparison.Ordinal);
+
+            // Assert
+            Assert.True(result);
+        }
+
         [Fact]
         public void StringSegment_StaticEquals_Valid()
         {
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TagHelperMatchingConventionsTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TagHelperMatchingConventionsTest.cs
index c32b87a58ff71f803db40dc9544b6233775475cd..c3602b8f629f8fb5620ae47b6668b8bd9b29c486 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TagHelperMatchingConventionsTest.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TagHelperMatchingConventionsTest.cs
@@ -1,7 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System;
+using System.Collections.Generic;
 using Xunit;
 
 namespace Microsoft.AspNetCore.Razor.Language
@@ -154,5 +155,39 @@ namespace Microsoft.AspNetCore.Razor.Language
             // Assert
             Assert.Equal(expectedResult, result);
         }
+
+        [Fact]
+        public void CanSatisfyBoundAttribute_IndexerAttribute_ReturnsFalseIsNotMatching()
+        {
+            // Arrange
+            var tagHelperBuilder = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
+            var builder = new DefaultBoundAttributeDescriptorBuilder(tagHelperBuilder, TagHelperConventions.DefaultKind);
+            builder.AsDictionary("asp-", typeof(Dictionary<string, string>).FullName);
+
+            var boundAttribute = builder.Build();
+
+            // Act
+            var result = TagHelperMatchingConventions.CanSatisfyBoundAttribute("style", boundAttribute);
+
+            // Assert
+            Assert.False(result);
+        }
+
+        [Fact]
+        public void CanSatisfyBoundAttribute_IndexerAttribute_ReturnsTrueIfMatching()
+        {
+            // Arrange
+            var tagHelperBuilder = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
+            var builder = new DefaultBoundAttributeDescriptorBuilder(tagHelperBuilder, TagHelperConventions.DefaultKind);
+            builder.AsDictionary("asp-", typeof(Dictionary<string, string>).FullName);
+
+            var boundAttribute = builder.Build();
+
+            // Act
+            var result = TagHelperMatchingConventions.CanSatisfyBoundAttribute("asp-route-controller", boundAttribute);
+
+            // Assert
+            Assert.True(result);
+        }
     }
 }