diff --git a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeBasicWriter.cs b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeBasicWriter.cs
deleted file mode 100644
index c37acaad04..0000000000
--- a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeBasicWriter.cs
+++ /dev/null
@@ -1,212 +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 System;
-using System.Diagnostics;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using Microsoft.AspNetCore.Razor.Language.Intermediate;
-
-namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
-{
- internal class RedirectedRuntimeBasicWriter : RuntimeBasicWriter
- {
- private readonly string _textWriter;
-
- public RedirectedRuntimeBasicWriter(string textWriter)
- {
- _textWriter = textWriter;
- }
-
- public override string WriteCSharpExpressionMethod { get; set; } = "WriteTo";
-
- public override string WriteHtmlContentMethod { get; set; } = "WriteLiteralTo";
-
- public override string BeginWriteAttributeMethod { get; set; } = "BeginWriteAttributeTo";
-
- public override string EndWriteAttributeMethod { get; set; } = "EndWriteAttributeTo";
-
- public override string WriteAttributeValueMethod { get; set; } = "WriteAttributeValueTo";
-
- public override void WriteCSharpExpression(CSharpRenderingContext context, CSharpExpressionIRNode node)
- {
- IDisposable linePragmaScope = null;
- if (node.Source != null)
- {
- linePragmaScope = context.Writer.BuildLinePragma(node.Source.Value);
-
- var offset = WriteCSharpExpressionMethod.Length + "(".Length + _textWriter.Length + ", ".Length;
- context.Writer.WritePadding(offset, node.Source, context);
- }
-
- context.Writer.WriteStartMethodInvocation(WriteCSharpExpressionMethod);
- context.Writer.Write(_textWriter);
- context.Writer.WriteParameterSeparator();
-
- for (var i = 0; i < node.Children.Count; i++)
- {
- if (node.Children[i] is RazorIRToken token && token.IsCSharp)
- {
- context.Writer.Write(token.Content);
- }
- else
- {
- // There may be something else inside the expression like a Template or another extension node.
- context.RenderNode(node.Children[i]);
- }
- }
-
- context.Writer.WriteEndMethodInvocation();
-
- linePragmaScope?.Dispose();
- }
-
- public override void WriteHtmlContent(CSharpRenderingContext context, HtmlContentIRNode node)
- {
- const int MaxStringLiteralLength = 1024;
-
- var builder = new StringBuilder();
- for (var i = 0; i < node.Children.Count; i++)
- {
- if (node.Children[i] is RazorIRToken token && token.IsHtml)
- {
- builder.Append(token.Content);
- }
- }
-
- var content = builder.ToString();
-
- var charactersConsumed = 0;
-
- // Render the string in pieces to avoid Roslyn OOM exceptions at compile time: https://github.com/aspnet/External/issues/54
- while (charactersConsumed < content.Length)
- {
- string textToRender;
- if (content.Length <= MaxStringLiteralLength)
- {
- textToRender = content;
- }
- else
- {
- var charactersToSubstring = Math.Min(MaxStringLiteralLength, content.Length - charactersConsumed);
- textToRender = content.Substring(charactersConsumed, charactersToSubstring);
- }
-
- context.Writer
- .WriteStartMethodInvocation(WriteHtmlContentMethod)
- .Write(_textWriter)
- .WriteParameterSeparator()
- .WriteStringLiteral(textToRender)
- .WriteEndMethodInvocation();
-
- charactersConsumed += textToRender.Length;
- }
- }
-
- public override void WriteHtmlAttribute(CSharpRenderingContext context, HtmlAttributeIRNode node)
- {
- var valuePieceCount = node
- .Children
- .Count(child => child is HtmlAttributeValueIRNode || child is CSharpAttributeValueIRNode);
- var prefixLocation = node.Source.Value.AbsoluteIndex;
- var suffixLocation = node.Source.Value.AbsoluteIndex + node.Source.Value.Length - node.Suffix.Length;
- context.Writer
- .WriteStartMethodInvocation(BeginWriteAttributeMethod)
- .Write(_textWriter)
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Name)
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Prefix)
- .WriteParameterSeparator()
- .Write(prefixLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Suffix)
- .WriteParameterSeparator()
- .Write(suffixLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .Write(valuePieceCount.ToString(CultureInfo.InvariantCulture))
- .WriteEndMethodInvocation();
-
- context.RenderChildren(node);
-
- context.Writer
- .WriteStartMethodInvocation(EndWriteAttributeMethod)
- .Write(_textWriter)
- .WriteEndMethodInvocation();
- }
-
- public override void WriteHtmlAttributeValue(CSharpRenderingContext context, HtmlAttributeValueIRNode node)
- {
- var prefixLocation = node.Source.Value.AbsoluteIndex;
- var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length;
- var valueLength = node.Source.Value.Length;
- context.Writer
- .WriteStartMethodInvocation(WriteAttributeValueMethod)
- .Write(_textWriter)
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Prefix)
- .WriteParameterSeparator()
- .Write(prefixLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Content)
- .WriteParameterSeparator()
- .Write(valueLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .Write(valueLength.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .WriteBooleanLiteral(true)
- .WriteEndMethodInvocation();
- }
-
- public override void WriteCSharpAttributeValue(CSharpRenderingContext context, CSharpAttributeValueIRNode node)
- {
- const string ValueWriterName = "__razor_attribute_value_writer";
-
- var expressionValue = node.Children.FirstOrDefault() as CSharpExpressionIRNode;
- var linePragma = expressionValue != null ? context.Writer.BuildLinePragma(node.Source.Value) : null;
- var prefixLocation = node.Source.Value.AbsoluteIndex;
- var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length;
- var valueLength = node.Source.Value.Length - node.Prefix.Length;
- context.Writer
- .WriteStartMethodInvocation(WriteAttributeValueMethod)
- .Write(_textWriter)
- .WriteParameterSeparator()
- .WriteStringLiteral(node.Prefix)
- .WriteParameterSeparator()
- .Write(prefixLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator();
-
- if (expressionValue != null)
- {
- Debug.Assert(node.Children.Count == 1);
-
- RenderExpressionInline(context, expressionValue);
- }
- else
- {
- // Not an expression; need to buffer the result.
- context.Writer.WriteStartNewObject(TemplateTypeName);
-
- using (context.Push(new RedirectedRuntimeBasicWriter(ValueWriterName)))
- using (context.Writer.BuildAsyncLambda(endLine: false, parameterNames: ValueWriterName))
- {
- context.RenderChildren(node);
- }
-
- context.Writer.WriteEndMethodInvocation(false);
- }
-
- context.Writer
- .WriteParameterSeparator()
- .Write(valueLocation.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .Write(valueLength.ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator()
- .WriteBooleanLiteral(false)
- .WriteEndMethodInvocation();
-
- linePragma?.Dispose();
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeTagHelperWriter.cs b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeTagHelperWriter.cs
deleted file mode 100644
index f33cf7dfc7..0000000000
--- a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RedirectedRuntimeTagHelperWriter.cs
+++ /dev/null
@@ -1,59 +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.Razor.Language.Intermediate;
-
-namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
-{
- internal class RedirectedRuntimeTagHelperWriter : RuntimeTagHelperWriter
- {
- private readonly string _textWriter;
-
- public RedirectedRuntimeTagHelperWriter(string textWriter)
- {
- _textWriter = textWriter;
- }
-
- public override string WriteTagHelperOutputMethod { get; set; } = "WriteTo";
-
- public override void WriteExecuteTagHelpers(CSharpRenderingContext context, ExecuteTagHelpersIRNode node)
- {
- context.Writer
- .Write("await ")
- .WriteStartInstanceMethodInvocation(
- RunnerVariableName,
- RunnerRunAsyncMethodName)
- .Write(ExecutionContextVariableName)
- .WriteEndMethodInvocation();
-
- var tagHelperOutputAccessor = $"{ExecutionContextVariableName}.{ExecutionContextOutputPropertyName}";
-
- context.Writer
- .Write("if (!")
- .Write(tagHelperOutputAccessor)
- .Write(".")
- .Write(TagHelperOutputIsContentModifiedPropertyName)
- .WriteLine(")");
-
- using (context.Writer.BuildScope())
- {
- context.Writer
- .Write("await ")
- .WriteInstanceMethodInvocation(
- ExecutionContextVariableName,
- ExecutionContextSetOutputContentAsyncMethodName);
- }
-
- context.Writer
- .WriteStartMethodInvocation(WriteTagHelperOutputMethod)
- .Write(_textWriter)
- .WriteParameterSeparator()
- .Write(tagHelperOutputAccessor)
- .WriteEndMethodInvocation()
- .WriteStartAssignment(ExecutionContextVariableName)
- .WriteInstanceMethodInvocation(
- ScopeManagerVariableName,
- ScopeManagerEndMethodName);
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RuntimeBasicWriter.cs b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RuntimeBasicWriter.cs
index 13d95035b7..73c10af3a8 100644
--- a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RuntimeBasicWriter.cs
+++ b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/RuntimeBasicWriter.cs
@@ -22,6 +22,10 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
public virtual string WriteAttributeValueMethod { get; set; } = "WriteAttributeValue";
+ public virtual string PushWriterMethod { get; set; } = "PushWriter";
+
+ public virtual string PopWriterMethod { get; set; } = "PopWriter";
+
public string TemplateTypeName { get; set; } = "Microsoft.AspNetCore.Mvc.Razor.HelperResult";
public override void WriteChecksum(CSharpRenderingContext context, ChecksumIRNode node)
@@ -216,10 +220,13 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
// Not an expression; need to buffer the result.
context.Writer.WriteStartNewObject(TemplateTypeName);
- using (context.Push(new RedirectedRuntimeBasicWriter(ValueWriterName)))
using (context.Writer.BuildAsyncLambda(endLine: false, parameterNames: ValueWriterName))
{
+ context.Writer.WriteMethodInvocation(PushWriterMethod, ValueWriterName);
+
context.RenderChildren(node);
+
+ context.Writer.WriteMethodInvocation(PopWriterMethod);
}
context.Writer.WriteEndMethodInvocation(false);
diff --git a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/TemplateTargetExtension.cs b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/TemplateTargetExtension.cs
index 197ce79172..206b868ae3 100644
--- a/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/TemplateTargetExtension.cs
+++ b/src/Microsoft.AspNetCore.Razor.Language/CodeGeneration/TemplateTargetExtension.cs
@@ -9,9 +9,15 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
internal class TemplateTargetExtension : ITemplateTargetExtension
{
public static readonly string DefaultTemplateTypeName = "Microsoft.AspNetCore.Mvc.Razor.HelperResult";
+ public static readonly string DefaultPushWriterMethod = "PushWriter";
+ public static readonly string DefaultPopWriterMethod = "PopWriter";
public string TemplateTypeName { get; set; } = DefaultTemplateTypeName;
+ public string PushWriterMethod { get; set; } = DefaultPushWriterMethod;
+
+ public string PopWriterMethod { get; set; } = DefaultPopWriterMethod;
+
public void WriteTemplate(CSharpRenderingContext context, TemplateIRNode node)
{
const string ItemParameterName = "item";
@@ -21,21 +27,20 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
.Write(ItemParameterName).Write(" => ")
.WriteStartNewObject(TemplateTypeName);
- IDisposable basicWriterScope = null;
- IDisposable tagHelperWriterScope = null;
- if (!context.Options.DesignTimeMode)
- {
- basicWriterScope = context.Push(new RedirectedRuntimeBasicWriter(TemplateWriterName));
- tagHelperWriterScope = context.Push(new RedirectedRuntimeTagHelperWriter(TemplateWriterName));
- }
-
using (context.Writer.BuildAsyncLambda(endLine: false, parameterNames: TemplateWriterName))
{
- context.RenderChildren(node);
- }
+ if (!context.Options.DesignTimeMode)
+ {
+ context.Writer.WriteMethodInvocation(PushWriterMethod, TemplateWriterName);
+ }
- basicWriterScope?.Dispose();
- tagHelperWriterScope?.Dispose();
+ context.RenderChildren(node);
+
+ if (!context.Options.DesignTimeMode)
+ {
+ context.Writer.WriteMethodInvocation(PopWriterMethod);
+ }
+ }
context.Writer.WriteEndMethodInvocation(endLine: false);
}
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RedirectedRuntimeBasicWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RedirectedRuntimeBasicWriterTest.cs
deleted file mode 100644
index 498e219d1e..0000000000
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RedirectedRuntimeBasicWriterTest.cs
+++ /dev/null
@@ -1,414 +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 System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language.Intermediate;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
-{
- public class RedirectedRuntimeBasicWriterTest
- {
- [Fact]
- public void WriteCSharpExpression_Runtime_SkipsLinePragma_WithoutSource()
- {
- // Arrange
- var writer = new RedirectedRuntimeBasicWriter("test_writer")
- {
- WriteCSharpExpressionMethod = "Test",
- };
-
- var context = new CSharpRenderingContext()
- {
- Options = RazorParserOptions.CreateDefaultOptions(),
- Writer = new Legacy.CSharpCodeWriter(),
- };
-
- var node = new CSharpExpressionIRNode();
- var builder = RazorIRBuilder.Create(node);
- builder.Add(new RazorIRToken()
- {
- Content = "i++",
- Kind = RazorIRToken.TokenKind.CSharp,
- });
-
- // Act
- writer.WriteCSharpExpression(context, node);
-
- // Assert
- var csharp = context.Writer.Builder.ToString();
- Assert.Equal(
-@"Test(test_writer, i++);
-",
- csharp,
- ignoreLineEndingDifferences: true);
- }
-
- [Fact]
- public void WriteCSharpExpression_Runtime_WritesLinePragma_WithSource()
- {
- // Arrange
- var writer = new RedirectedRuntimeBasicWriter("test_writer")
- {
- WriteCSharpExpressionMethod = "Test",
- };
-
- var context = new CSharpRenderingContext()
- {
- Options = RazorParserOptions.CreateDefaultOptions(),
- Writer = new Legacy.CSharpCodeWriter(),
- };
-
- var node = new CSharpExpressionIRNode()
- {
- Source = new SourceSpan("test.cshtml", 0, 0, 0, 3),
- };
- var builder = RazorIRBuilder.Create(node);
- builder.Add(new RazorIRToken()
- {
- Content = "i++",
- Kind = RazorIRToken.TokenKind.CSharp,
- });
-
- // Act
- writer.WriteCSharpExpression(context, node);
-
- // Assert
- var csharp = context.Writer.Builder.ToString();
- Assert.Equal(
-@"#line 1 ""test.cshtml""
-Test(test_writer, i++);
-
-#line default
-#line hidden
-",
- csharp,
- ignoreLineEndingDifferences: true);
- }
-
- [Fact]
- public void WriteCSharpExpression_Runtime_WithExtensionNode_WritesPadding()
- {
- // Arrange
- var writer = new RedirectedRuntimeBasicWriter("test_writer")
- {
- WriteCSharpExpressionMethod = "Test",
- };
-
- var context = new CSharpRenderingContext()
- {
- Options = RazorParserOptions.CreateDefaultOptions(),
- Writer = new Legacy.CSharpCodeWriter(),
- };
-
- var node = new CSharpExpressionIRNode();
- var builder = RazorIRBuilder.Create(node);
- builder.Add(new RazorIRToken()
- {
- Content = "i",
- Kind = RazorIRToken.TokenKind.CSharp,
- });
- builder.Add(new MyExtensionIRNode());
- builder.Add(new RazorIRToken()
- {
- Content = "++",
- Kind = RazorIRToken.TokenKind.CSharp,
- });
-
- context.RenderNode = (n) => Assert.IsType {
+ PushWriter(__razor_attribute_value_writer);
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
if(cls != null) {
#line default
#line hidden
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
-WriteTo(__razor_attribute_value_writer, cls);
+ Write(cls);
#line default
#line hidden
@@ -77,6 +78,7 @@ WriteTo(__razor_attribute_value_writer, cls);
#line default
#line hidden
+ PopWriter();
}
), 256, 25, false);
EndWriteAttribute();
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs
index ae0a046073..33bcf27b58 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs
@@ -57,13 +57,14 @@ AddHtmlAttributeValue(" ", 57, DateTime.Now, 58, 13, false);
__tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper);
BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
AddHtmlAttributeValue("", 95, new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_attribute_value_writer) => {
+ PushWriter(__razor_attribute_value_writer);
#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
if (true) {
#line default
#line hidden
#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
-WriteTo(__razor_attribute_value_writer, string.Empty);
+ Write(string.Empty);
#line default
#line hidden
@@ -73,7 +74,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty);
#line default
#line hidden
#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
- WriteTo(__razor_attribute_value_writer, false);
+ Write(false);
#line default
#line hidden
@@ -82,6 +83,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty);
#line default
#line hidden
+ PopWriter();
}
), 95, 44, false);
AddHtmlAttributeValue(" ", 139, "suffix", 140, 7, true);
@@ -180,13 +182,14 @@ AddHtmlAttributeValue("", 347, long.MinValue, 347, 14, false);
#line default
#line hidden
AddHtmlAttributeValue(" ", 361, new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_attribute_value_writer) => {
+ PushWriter(__razor_attribute_value_writer);
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
if (true) {
#line default
#line hidden
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
- WriteTo(__razor_attribute_value_writer, string.Empty);
+ Write(string.Empty);
#line default
#line hidden
@@ -196,7 +199,7 @@ AddHtmlAttributeValue("", 347, long.MinValue, 347, 14, false);
#line default
#line hidden
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
- WriteTo(__razor_attribute_value_writer, false);
+ Write(false);
#line default
#line hidden
@@ -205,6 +208,7 @@ AddHtmlAttributeValue("", 347, long.MinValue, 347, 14, false);
#line default
#line hidden
+ PopWriter();
}
), 362, 44, false);
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
@@ -260,13 +264,14 @@ AddHtmlAttributeValue(" ", 490, int.MaxValue, 491, 13, false);
__tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper);
BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
AddHtmlAttributeValue("", 528, new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_attribute_value_writer) => {
+ PushWriter(__razor_attribute_value_writer);
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
if (true) {
#line default
#line hidden
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
-WriteTo(__razor_attribute_value_writer, string.Empty);
+ Write(string.Empty);
#line default
#line hidden
@@ -276,7 +281,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty);
#line default
#line hidden
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml"
- WriteTo(__razor_attribute_value_writer, false);
+ Write(false);
#line default
#line hidden
@@ -285,6 +290,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty);
#line default
#line hidden
+ PopWriter();
}
), 528, 44, false);
EndAddHtmlAttributeValues(__tagHelperExecutionContext);
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs
index 7d8699b87e..02efb43db3 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs
@@ -12,7 +12,9 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
WriteLiteral(" Bar Bar Hello");
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml"
@@ -77,8 +78,9 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output);
+ Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
+ PopWriter();
}
)
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml"
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs
index bbb283c971..c5bc65cdcb 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs
@@ -17,13 +17,15 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
#line default
#line hidden
item => new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_template_writer) => {
- WriteLiteralTo(__razor_template_writer, "This works ");
+ PushWriter(__razor_template_writer);
+ WriteLiteral("This works ");
#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml"
- WriteTo(__razor_template_writer, item);
+ Write(item);
#line default
#line hidden
- WriteLiteralTo(__razor_template_writer, "!");
+ WriteLiteral("!");
+ PopWriter();
}
)
#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml"
@@ -45,15 +47,17 @@ Write(foo(""));
#line default
#line hidden
item => new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_template_writer) => {
- WriteLiteralTo(__razor_template_writer, "