diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
index 956d5cb0fa..1ec061f64b 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
@@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.TagHelpers
var htmlContent = attribute.Value as IHtmlContent;
if (htmlContent != null)
{
- var htmlString = htmlContent as HtmlEncodedString;
+ var htmlString = htmlContent as HtmlString;
if (htmlString != null)
{
// No need for a StringWriter in this case.
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormatter.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormatter.cs
index ba9a0fb416..3e0fbfb317 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormatter.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormatter.cs
@@ -4,7 +4,7 @@
using System;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
{
@@ -14,18 +14,20 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
///
public class DistributedCacheTagHelperFormatter : IDistributedCacheTagHelperFormatter
{
-
///
public Task SerializeAsync(DistributedCacheTagHelperFormattingContext context)
{
- if (context == null)
+ if (context == null)
{
- throw new ArgumentNullException(nameof(context));
+ throw new ArgumentNullException(nameof(context));
}
-
- if (context.Html == null)
+
+ if (context.Html == null)
{
- throw new ArgumentNullException(nameof(context.Html));
+ throw new ArgumentException(
+ Resources.FormatPropertyOfTypeCannotBeNull(
+ nameof(DistributedCacheTagHelperFormattingContext.Html),
+ typeof(DistributedCacheTagHelperFormattingContext).FullName));
}
var serialized = Encoding.UTF8.GetBytes(context.Html.ToString());
@@ -35,11 +37,11 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
///
public Task DeserializeAsync(byte[] value)
{
- if (value == null)
+ if (value == null)
{
- throw new ArgumentNullException(nameof(value));
+ throw new ArgumentNullException(nameof(value));
}
-
+
var content = Encoding.UTF8.GetString(value);
return Task.FromResult(new HtmlString(content));
}
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormattingContext.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormattingContext.cs
index 19e8f908e6..3b1de01ff4 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormattingContext.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperFormattingContext.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
{
@@ -13,6 +13,6 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
///
/// Gets the instance.
///
- public HtmlString Html { get; set; }
+ public HtmlString Html { get; set; }
}
}
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/IDistributedCacheTagHelperFormatter.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/IDistributedCacheTagHelperFormatter.cs
index b1cce8ea88..6236b7d719 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/IDistributedCacheTagHelperFormatter.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/IDistributedCacheTagHelperFormatter.cs
@@ -2,15 +2,15 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
{
///
- /// An implementation of this interface provides a service to
+ /// An implementation of this interface provides a service to
/// serialize html fragments for being store by
///
- public interface IDistributedCacheTagHelperFormatter
+ public interface IDistributedCacheTagHelperFormatter
{
///
/// Serializes some html content.
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
index b73162131c..82a4bd40b3 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Properties/Resources.Designer.cs
index b55a638681..b754720a58 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Properties/Resources.Designer.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Properties/Resources.Designer.cs
@@ -154,6 +154,22 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
return string.Format(CultureInfo.CurrentCulture, GetString("FormTagHelper_CannotDetermineActionWithRouteAndActionOrControllerSpecified"), p0, p1, p2, p3, p4);
}
+ ///
+ /// The '{0}' property of '{1}' must not be null.
+ ///
+ internal static string PropertyOfTypeCannotBeNull
+ {
+ get { return GetString("PropertyOfTypeCannotBeNull"); }
+ }
+
+ ///
+ /// The '{0}' property of '{1}' must not be null.
+ ///
+ internal static string FormatPropertyOfTypeCannotBeNull(object p0, object p1)
+ {
+ return string.Format(CultureInfo.CurrentCulture, GetString("PropertyOfTypeCannotBeNull"), p0, p1);
+ }
+
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Resources.resx b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Resources.resx
index 0a18b28c89..b96ef38ef7 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Resources.resx
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Resources.resx
@@ -144,4 +144,7 @@
Cannot determine an '{4}' attribute for {0}. A {0} with a specified '{1}' must not have an '{2}' or '{3}' attribute.
+
+ The '{0}' property of '{1}' must not be null.
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
index ff74569057..e821afd48a 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
@@ -344,12 +344,12 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
private string GetAttributeValue(object value)
{
string stringValue;
- var htmlEncodedString = value as HtmlEncodedString;
- if (htmlEncodedString != null)
+ var htmlString = value as HtmlString;
+ if (htmlString != null)
{
// Value likely came from an HTML context in the .cshtml file but may still contain double quotes
// since attribute could have been enclosed in single quotes.
- stringValue = htmlEncodedString.Value;
+ stringValue = htmlString.Value;
stringValue = stringValue.Replace("\"", """);
}
else
@@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
RazorPage.WriteTo(writer, HtmlEncoder, value);
// Value is now correctly HTML-encoded but may still contain double quotes since attribute could
- // have been enclosed in single quotes and portions that were HtmlEncodedStrings are not re-encoded.
+ // have been enclosed in single quotes and portions that were HtmlStrings are not re-encoded.
var builder = writer.GetStringBuilder();
builder.Replace("\"", """);
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperContentExtensions.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperContentExtensions.cs
index 1e12731c17..cd6740bd8e 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperContentExtensions.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/TagHelperContentExtensions.cs
@@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
}
string stringValue;
- var htmlString = value as HtmlEncodedString;
+ var htmlString = value as HtmlString;
if (htmlString != null)
{
// No need for a StringWriter in this case.
diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/HtmlString.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/HtmlString.cs
deleted file mode 100644
index 45be758cc9..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/HtmlString.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNetCore.Html;
-
-namespace Microsoft.AspNetCore.Mvc.Rendering
-{
- ///
- public class HtmlString : HtmlEncodedString
- {
- ///
- /// Returns an with empty content.
- ///
- public static readonly HtmlString Empty = new HtmlString(string.Empty);
-
- ///
- /// Creates a new instance of .
- ///
- /// The HTML encoded value.
- public HtmlString(string input)
- : base(input)
- {
- }
- }
-}
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs
index ad1a176678..57cec0b647 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs
@@ -7,6 +7,7 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
index 1668c5ef6b..6ef2efc11a 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Reflection;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
@@ -223,7 +224,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
await formTagHelper.ProcessAsync(context, output);
Assert.Equal("form", output.TagName);
- Assert.Equal(TagMode.StartTagAndEndTag ,output.TagMode);
+ Assert.Equal(TagMode.StartTagAndEndTag, output.TagMode);
var attribute = Assert.Single(output.Attributes);
Assert.Equal(expectedAttribute, attribute);
Assert.Empty(output.PreContent.GetContent());
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs
index c089703a76..0f53b39a1b 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
@@ -142,7 +143,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
Assert.Equal(expectedOutput.TagName, output.TagName);
Assert.Equal(4, output.Attributes.Count);
- for(int i=0; i < expectedOutput.Attributes.Count; i++)
+ for (var i = 0; i < expectedOutput.Attributes.Count; i++)
{
var expectedAtribute = expectedOutput.Attributes[i];
var actualAttribute = output.Attributes[i];
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs
index 64348c3064..3dcbfb73bb 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs
index a493dab2c4..40e6eeb719 100644
--- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTest.cs
index ad329342ee..1d9da0fc0b 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTest.cs
@@ -212,8 +212,8 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
// Assert
Assert.Same(nested, buffer.Pages[0].Buffer[0].Value);
- Assert.Equal("Hello", Assert.IsType(nestedItems[0]).Value);
- Assert.Equal("Hello", Assert.IsType(destinationItems[0]).Value);
+ Assert.Equal("Hello", Assert.IsType(nestedItems[0]).Value);
+ Assert.Equal("Hello", Assert.IsType(destinationItems[0]).Value);
}
[Fact]
@@ -236,7 +236,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
// Assert
Assert.Empty(nestedItems);
Assert.Empty(buffer.Pages);
- Assert.Equal("Hello", Assert.IsType(destinationItems[0]).Value);
+ Assert.Equal("Hello", Assert.IsType(destinationItems[0]).Value);
}
[Fact]
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTextWriterTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTextWriterTest.cs
index ec9dc1ae72..0e2d2a7df6 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTextWriterTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/ViewBufferTextWriterTest.cs
@@ -7,7 +7,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.WebEncoders.Testing;
using Moq;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs
index aaefe9ccbb..13beb13337 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Moq;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs
index 8091aa225a..a4c0ca56ff 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Encodings.Web;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs
index 9f4b84c9bd..80af7b56e9 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.TestCommon;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlStringTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlStringTest.cs
index ca12331ccc..0d471eba0e 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlStringTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlStringTest.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
+using Microsoft.AspNetCore.Html;
using Microsoft.Extensions.WebEncoders.Testing;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
index fa6a194450..7cced922d8 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
@@ -9,11 +9,11 @@ using System.Reflection;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.TestCommon;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentTests.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentTests.cs
index 7de932ba39..7c64a74e52 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentTests.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentTests.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Text.Encodings.Web;
-using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/HtmlContentViewComponentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/HtmlContentViewComponentResultTest.cs
index edc27a4e1a..21f8f61c31 100644
--- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/HtmlContentViewComponentResultTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/HtmlContentViewComponentResultTest.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;