diff --git a/src/Microsoft.AspNet.Mvc.Razor/TagHelperContentWrapperTextWriter.cs b/src/Microsoft.AspNet.Mvc.Razor/TagHelperContentWrapperTextWriter.cs
index 1baca26ced..9b8ae174dd 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/TagHelperContentWrapperTextWriter.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/TagHelperContentWrapperTextWriter.cs
@@ -2,16 +2,17 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.IO;
using System.Text;
+using Microsoft.AspNet.Html.Abstractions;
+using Microsoft.AspNet.Mvc.ViewFeatures;
using Microsoft.AspNet.Razor.TagHelpers;
namespace Microsoft.AspNet.Mvc.Razor
{
///
- /// implementation which writes to a instance.
+ /// implementation which writes to a instance.
///
- public class TagHelperContentWrapperTextWriter : TextWriter
+ public class TagHelperContentWrapperTextWriter : HtmlTextWriter
{
///
/// Initializes a new instance of the class.
@@ -63,6 +64,12 @@ namespace Microsoft.AspNet.Mvc.Razor
Content.AppendHtml(value.ToString());
}
+ ///
+ public override void Write(IHtmlContent value)
+ {
+ Content.Append(value);
+ }
+
///
public override string ToString()
{
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/ViewFeatures/StringCollectionTextWriter.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/ViewFeatures/StringCollectionTextWriter.cs
index 2190eb44a3..cf04bfe499 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/ViewFeatures/StringCollectionTextWriter.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/ViewFeatures/StringCollectionTextWriter.cs
@@ -176,17 +176,17 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
}
///
- /// If the specified is a the contents
+ /// If the specified is a the contents
/// are copied. It is just written to the otherwise.
///
/// The to which the content must be copied/written.
/// The to encode the copied/written content.
public void CopyTo(TextWriter writer, HtmlEncoder encoder)
{
- var targetStringCollectionWriter = writer as StringCollectionTextWriter;
- if (targetStringCollectionWriter != null)
+ var htmlTextWriter = writer as HtmlTextWriter;
+ if (htmlTextWriter != null)
{
- targetStringCollectionWriter._content.Append(Content);
+ htmlTextWriter.Write(Content);
}
else
{
@@ -195,7 +195,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
}
///
- /// If the specified is a the contents
+ /// If the specified is a the contents
/// are copied. It is just written to the otherwise.
///
/// The to which the content must be copied/written.