diff --git a/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs b/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs index 8923a8bfaa..aa826dbbd5 100644 --- a/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs +++ b/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Text.Encodings.Web; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.TagHelpers; @@ -243,6 +244,28 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers Output.Reinitialize(tagName, tagMode); } + /// + /// Executes children asynchronously with the page's in scope and + /// sets 's to the rendered results. + /// + /// A that on completion sets 's + /// to the children's rendered content. + public async Task SetOutputContentAsync() + { + var childContent = _childContent; + + if (childContent == null) + { + _startTagHelperWritingScope(null); + await _executeChildContentAsync(); + childContent = _endTagHelperWritingScope(); + } + + Debug.Assert(!Output.IsContentModified); + + Output.Content.SetHtmlContent(childContent); + } + // Internal for testing. internal async Task GetChildContentAsync(bool useCachedResult, HtmlEncoder encoder) { diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs index 132915b4f3..f93acf499f 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs @@ -583,13 +583,10 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators using (_writer.BuildScope()) { _writer - .Write(tagHelperOutputAccessor) - .Write(".") - .WriteStartAssignment(_tagHelperContext.TagHelperOutputContentPropertyName) .Write("await ") .WriteInstanceMethodInvocation( - tagHelperOutputAccessor, - _tagHelperContext.TagHelperOutputGetChildContentAsyncMethodName); + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextSetOutputContentAsyncMethodName); } } diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs index 5af4cebe16..e7db286a03 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators HtmlEncoderPropertyName = "HtmlEncoder"; TagHelperOutputIsContentModifiedPropertyName = "IsContentModified"; TagHelperOutputContentPropertyName = "Content"; - TagHelperOutputGetChildContentAsyncMethodName = "GetChildContentAsync"; + ExecutionContextSetOutputContentAsyncMethodName = "SetOutputContentAsync"; TagHelperAttributeTypeName = "Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute"; EncodedHtmlStringTypeName = "Microsoft.AspNetCore.Html.HtmlEncodedString"; } @@ -209,10 +209,10 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators public string TagHelperOutputContentPropertyName { get; set; } /// - /// The name of the method on the property used to retrieve - /// tag helper child content. + /// The name of the method on the property used to execute + /// child content and set the rendered results on its property. /// - public string TagHelperOutputGetChildContentAsyncMethodName { get; set; } + public string ExecutionContextSetOutputContentAsyncMethodName { get; set; } /// /// The name of the type used to represent tag helper attributes. diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs index e6e0103b65..d246b3556b 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs @@ -14,6 +14,33 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers { public class TagHelperExecutionContextTest { + [Fact] + public async Task SetOutputContentAsync_SetsOutputsContent() + { + // Arrange + var tagHelperContent = new DefaultTagHelperContent(); + var content = "Hello from child content"; + var executionContext = new TagHelperExecutionContext( + "p", + tagMode: TagMode.StartTagAndEndTag, + items: new Dictionary(), + uniqueId: string.Empty, + executeChildContentAsync: () => + { + tagHelperContent.SetContent(content); + + return Task.FromResult(result: true); + }, + startTagHelperWritingScope: _ => { }, + endTagHelperWritingScope: () => tagHelperContent); + + // Act + await executionContext.SetOutputContentAsync(); + + // Assert + Assert.Equal(content, executionContext.Output.Content.GetContent()); + } + [Fact] public async Task ExecutionContext_Reinitialize_UpdatesTagHelperOutputAsExpected() { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs index 93e2424409..b20c2a509f 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs @@ -48,7 +48,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(54, 36, false); Write(__tagHelperExecutionContext.Output); @@ -116,7 +116,7 @@ __TestNamespace_InputTagHelper2.Checked = true; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(30, 228, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs index dcf75126ea..99c0ed053d 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs @@ -110,7 +110,7 @@ __TestNamespace_InputTagHelper2.Checked = **From custom attribute code renderer* await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(104, 216, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs index 999fa5c606..9b46feb1ce 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs @@ -66,7 +66,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(107, 136, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs index 8917b36a81..d97be25ce8 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs @@ -111,7 +111,7 @@ __TestNamespace_InputTagHelper2.Checked = true; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(104, 216, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs index 335d9229bd..f32594b97a 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs @@ -96,7 +96,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(265, 83, false); Write(__tagHelperExecutionContext.Output); @@ -155,7 +155,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(414, 58, false); Write(__tagHelperExecutionContext.Output); @@ -266,7 +266,7 @@ AddHtmlAttributeValue(" ", 159, DateTime.Now, 160, 14, false); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(137, 529, false); Write(__tagHelperExecutionContext.Output); @@ -330,7 +330,7 @@ __TestNamespace_InputTagHelper2.Checked = (@object); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(678, 181, false); Write(__tagHelperExecutionContext.Output); @@ -379,7 +379,7 @@ __TestNamespace_PTagHelper.Age = -1970 + @DateTimeOffset.Now.Year; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(869, 155, false); Write(__tagHelperExecutionContext.Output); @@ -426,7 +426,7 @@ __TestNamespace_PTagHelper.Age = DateTimeOffset.Now.Year - 1970; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(1034, 116, false); Write(__tagHelperExecutionContext.Output); @@ -473,7 +473,7 @@ __TestNamespace_PTagHelper.Age = ("My age is this long.".Length); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(1160, 133, false); Write(__tagHelperExecutionContext.Output); @@ -518,7 +518,7 @@ __TestNamespace_PTagHelper.Age = 123; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(1316, 57, false); WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs index 4d9afe8936..a3d408d3fa 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs @@ -98,7 +98,7 @@ __TestNamespace_PTagHelper.Age = 3; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(33, 157, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs index a0b7078833..865c9412f6 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs @@ -97,7 +97,7 @@ __TestNamespace_PTagHelper.Age = ; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(78, 64, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs index 180b9662c7..1cdb6793e2 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs @@ -123,7 +123,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(33, 647, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs index b9db37ceee..757c3d6e0a 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs @@ -102,7 +102,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(137, 433, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs index 74809dd046..6a748f74d1 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs @@ -46,7 +46,7 @@ __TestNamespace_PTagHelper.Age = 1337; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(33, 49, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs index 90a11c2c00..6df511bd43 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs @@ -46,7 +46,7 @@ __TestNamespace_PTagHelper.Age = 1337; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(33, 53, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs index f119694e16..8cb6add2fb 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs @@ -96,7 +96,7 @@ __TestNamespace_CatchAllTagHelper.Event1 = doSomething(); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(374, 79, false); Write(__tagHelperExecutionContext.Output); @@ -124,7 +124,7 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(455, 81, false); Write(__tagHelperExecutionContext.Output); @@ -148,7 +148,7 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(538, 67, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs index 781587b136..8678da042d 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs @@ -64,7 +64,7 @@ namespace TestOutput await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(267, 66, false); Write(__tagHelperExecutionContext.Output); @@ -99,7 +99,7 @@ AddHtmlAttributeValue(" ", 199, DateTime.Now, 200, 14, false); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(112, 245, false); WriteTo(__razor_section_writer, __tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs index 8113aa23e6..f635e249df 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs @@ -59,7 +59,7 @@ __TestNamespace_PTagHelper.Age = 1337; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(33, 85, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs index 8d0622722a..3b632cd318 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs @@ -58,7 +58,7 @@ __TestNamespace_PTagHelper.Age = 1337; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { - __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + await __tagHelperExecutionContext.SetOutputContentAsync(); } Instrumentation.BeginContext(97, 44, false); Write(__tagHelperExecutionContext.Output);