template = (context) => @@context.ToLowerInvariant()
; }
+ ");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Component(frame, "Test.RenderChildContentString", 3, 2),
+ frame => AssertFrame.Attribute(frame, RenderTreeBuilder.ChildContent, 3),
+ frame => AssertFrame.Attribute(frame, "Value", "HI", 4),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hi", 1));
+ }
+
+ [Fact]
+ public void Render_AttributeChildContent_NoArgTemplate()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ var component = CompileToComponent(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment template = @@(""HI"".ToLowerInvariant())
; }
+ ");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Component(frame, "Test.RenderChildContent", 2, 2),
+ frame => AssertFrame.Attribute(frame, RenderTreeBuilder.ChildContent, 3),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hi", 1));
+ }
+
+ [Fact]
+ public void Render_AttributeChildContent_IgnoresEmptyBody()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ var component = CompileToComponent(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment template = (context) => @@context.ToLowerInvariant()
; }
+ ");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Component(frame, "Test.RenderChildContent", 2, 2),
+ frame => AssertFrame.Attribute(frame, RenderTreeBuilder.ChildContent, 3),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hi", 1));
+ }
+
+ [Fact]
+ public void Render_AttributeChildContent_IgnoresWhitespaceBody()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ var component = CompileToComponent(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment template = (context) => @@context.ToLowerInvariant()
; }
+
+
+ ");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Component(frame, "Test.RenderChildContent", 2, 2),
+ frame => AssertFrame.Attribute(frame, RenderTreeBuilder.ChildContent, 3),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hi", 1));
+ }
+
+ [Fact]
+ public void Render_MultipleChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderMultipleChildContent);
+
+ var component = CompileToComponent(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment header = context => @@context.ToLowerInvariant()
; }
+
+ Some @context.ToLowerInvariant() Content
+
+ ");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Component(frame, "Test.RenderMultipleChildContent", 6, 2),
+ frame => AssertFrame.Attribute(frame, "Name", "billg", 3),
+ frame => AssertFrame.Attribute(frame, "Header", typeof(RenderFragment), 4),
+ frame => AssertFrame.Attribute(frame, "Value", "HI", 5),
+ frame => AssertFrame.Attribute(frame, RenderTreeBuilder.ChildContent, typeof(RenderFragment), 6),
+ frame => AssertFrame.Attribute(frame, "Footer", typeof(RenderFragment), 10),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "billg", 1),
+ frame => AssertFrame.Text(frame, "Some ", 7),
+ frame => AssertFrame.Text(frame, "hi", 8),
+ frame => AssertFrame.Text(frame, " Content", 9),
+ frame => AssertFrame.Text(frame, "Bye!", 11));
+ }
+
+ [Fact]
+ public void Render_ChildContent_AttributeAndBody_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment template = @@context.ToLowerInvariant()
; }
+
+Some Content
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentSetByAttributeAndBody.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void Render_ChildContent_AttributeAndExplicitChildContent_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment template = @@context.ToLowerInvariant()
; }
+
+
+Some Content
+
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentSetByAttributeAndBody.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void Render_ChildContent_ExplicitChildContent_UnrecogizedContent_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+@somethingElse
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentMixedWithExplicitChildContent.Id, diagnostic.Id);
+ Assert.Equal(
+ "Unrecognized child content inside component 'RenderChildContent'. The component 'RenderChildContent' accepts " +
+ "child content through the following top-level items: 'ChildContent'.",
+ diagnostic.GetMessage());
+ }
+
+ [Fact]
+ public void Render_ChildContent_ExplicitChildContent_UnrecogizedElement_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentMixedWithExplicitChildContent.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void Render_ChildContent_ExplicitChildContent_UnrecogizedAttribute_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentHasInvalidAttribute.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void Render_ChildContent_ExplicitChildContent_InvalidParameterName_ProducesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentStringComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentHasInvalidParameter.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void Render_ChildContent_ExplicitChildContent_RepeatedParameterName_GeneratesDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(RenderChildContentStringComponent);
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+
+
+
+
+ ");
+
+ // Assert
+ var diagnostic = Assert.Single(generated.Diagnostics);
+ Assert.Same(BlazorDiagnosticFactory.ChildContentRepeatedParameterName.Id, diagnostic.Id);
+ Assert.Equal(
+ "The child content element 'ChildContent' of component 'RenderChildContentString' uses the same parameter name ('context') as enclosing child content " +
+ "element 'ChildContent' of component 'RenderChildContentString'. Specify the parameter name like: ' to resolve the ambiguity",
+ diagnostic.GetMessage());
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/CodeGenerationTestBase.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/CodeGenerationTestBase.cs
new file mode 100644
index 0000000000..88684c7e40
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/CodeGenerationTestBase.cs
@@ -0,0 +1,1891 @@
+// 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.Linq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Blazor.Build.Test
+{
+ public abstract class CodeGenerationTestBase : RazorBaselineIntegrationTestBase
+ {
+ internal override bool UseTwoPhaseCompilation => true;
+
+ public CodeGenerationTestBase()
+ {
+ GenerateBaselines = true;
+ }
+
+ #region Basics
+
+ [Fact]
+ public void ChildComponent_Simple()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithParameters()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class SomeType
+ {
+ }
+
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] int IntProperty { get; set; }
+ [Parameter] bool BoolProperty { get; set; }
+ [Parameter] string StringProperty { get; set; }
+ [Parameter] SomeType ObjectProperty { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithExplicitStringParameter()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ string StringProperty { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithNonPropertyAttributes()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ComponentParameter_TypeMismatch_ReportsDiagnostic()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class CoolnessMeter : BlazorComponent
+ {
+ [Parameter] private int Coolness { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+
+ var assembly = CompileToAssembly(generated, throwOnFailure: false);
+ // This has some errors
+ Assert.Collection(
+ assembly.Diagnostics.OrderBy(d => d.Id),
+ d => Assert.Equal("CS1503", d.Id));
+ }
+
+ #endregion
+
+ #region Bind
+
+ [Fact]
+ public void BindToComponent_SpecifiesValue_WithMatchingProperties()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ int Value { get; set; }
+
+ [Parameter]
+ Action ValueChanged { get; set; }
+ }
+}"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToComponent_TypeChecked_WithMatchingProperties()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ int Value { get; set; }
+
+ [Parameter]
+ Action ValueChanged { get; set; }
+ }
+}"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public string ParentValue { get; set; } = ""42"";
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+
+ var assembly = CompileToAssembly(generated, throwOnFailure: false);
+ // This has some errors
+ Assert.Collection(
+ assembly.Diagnostics.OrderBy(d => d.Id),
+ d => Assert.Equal("CS0029", d.Id),
+ d => Assert.Equal("CS1503", d.Id));
+ }
+
+ [Fact]
+ public void BindToComponent_SpecifiesValue_WithoutMatchingProperties()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent, IComponent
+ {
+ void IComponent.SetParameters(ParameterCollection parameters)
+ {
+ }
+ }
+}"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ int Value { get; set; }
+
+ [Parameter]
+ Action OnChanged { get; set; }
+ }
+}"));
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent, IComponent
+ {
+ void IComponent.SetParameters(ParameterCollection parameters)
+ {
+ }
+ }
+}"));
+
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToElement_WritesAttributes()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ [BindElement(""div"", null, ""myvalue"", ""myevent"")]
+ public static class BindAttributes
+ {
+ }
+}"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public string ParentValue { get; set; } = ""hi"";
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToElementWithSuffix_WritesAttributes()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")]
+ public static class BindAttributes
+ {
+ }
+}"));
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public string ParentValue { get; set; } = ""hi"";
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BuiltIn_BindToInputWithoutType_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BuiltIn_BindToInputText_WithFormat_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
+
+ public string Format { get; set; } = ""MM/dd/yyyy"";
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BuiltIn_BindToInputText_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BuiltIn_BindToInputCheckbox_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public bool Enabled { get; set; }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToElementFallback_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public int ParentValue { get; set; } = 42;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BindToElementFallback_WithFormat_WritesAttributes()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Child Content
+
+ [Fact]
+ public void ChildComponent_WithChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ string MyAttr { get; set; }
+
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+Some textNested text ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithGenericChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ string MyAttr { get; set; }
+
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+Some text@context.ToLowerInvariant() ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+
+ [Fact]
+ public void ChildComponent_WithGenericChildContent_SetsParameterName()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ string MyAttr { get; set; }
+
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+ Some text@item.ToLowerInvariant()
+
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithElementOnlyChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+hello ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithExplicitChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+hello ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithExplicitGenericChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@context ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void MultipleExplictChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment Header { get; set; }
+
+ [Parameter]
+ RenderFragment Footer { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BodyAndAttributeChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment Header { get; set; }
+
+ RenderFragment ChildContent { get; set; }
+
+ [Parameter]
+ RenderFragment Footer { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment header = (context) => @@context.ToLowerInvariant()
; }
+
+ Some Content
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void BodyAndExplicitChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ RenderFragment Header { get; set; }
+
+ [Parameter]
+ RenderFragment ChildContent { get; set; }
+
+ [Parameter]
+ RenderFragment Footer { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@{ RenderFragment header = (context) => @@context.ToLowerInvariant()
; }
+
+ Some Content
+
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Directives
+
+ [Fact]
+ public void ChildComponent_WithPageDirective()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@page ""/MyPage""
+@page ""/AnotherRoute/{id}""
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Event Handlers
+
+ [Fact]
+ public void ChildComponent_WithLambdaEventHandler()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ Action OnClick { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+ { Increment(); })""/>
+
+@functions {
+ private int counter;
+ private void Increment() {
+ counter++;
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ // Regression test for #954 - we need to allow arbitrary event handler
+ // attributes with weak typing.
+ [Fact]
+ public void ChildComponent_WithWeaklyTypeEventHandler()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class DynamicElement : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+@functions {
+ private Action OnClick { get; set; }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ChildComponent_WithExplicitEventHandler()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter]
+ Action OnClick { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+@functions {
+ private int counter;
+ private void Increment(UIEventArgs e) {
+ counter++;
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithString()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+ ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithNoArgsLambdaDelegate()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+ { })"" />");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithEventArgsLambdaDelegate()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+ { })"" />");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithNoArgMethodGroup()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+@functions {
+ void OnClick() {
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithEventArgsMethodGroup()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+@functions {
+ void OnClick(UIMouseEventArgs e) {
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+@functions {
+ void OnClick(UIEventArgs e) {
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void AsyncEventHandler_OnElement_Action_MethodGroup()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@using System.Threading.Tasks
+
+@functions {
+ Task OnClick()
+ {
+ return Task.CompletedTask;
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@using System.Threading.Tasks
+
+@functions {
+ Task OnClick(UIMouseEventArgs e)
+ {
+ return Task.CompletedTask;
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void AsyncEventHandler_OnElement_Action_Lambda()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@using System.Threading.Tasks
+ await Task.Delay(10)"" />
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void AsyncEventHandler_OnElement_ActionEventArgs_Lambda()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@using System.Threading.Tasks
+ await Task.Delay(10)"" />
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithLambdaDelegate()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+ { })"" />");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void EventHandler_OnElement_WithDelegate()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+@functions {
+ void OnClick(UIMouseEventArgs e) {
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Ref
+
+ [Fact]
+ public void Element_WithRef()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+Hello
+
+@functions {
+ private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void Component_WithRef()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+@functions {
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void Component_WithRef_WithChildContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+ Some further content
+
+
+@functions {
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Templates
+
+ [Fact]
+ public void RazorTemplate_InCodeBlock()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@{
+ RenderFragment p = (person) => @@person.Name
;
+}
+@functions {
+ class Person
+ {
+ public string Name { get; set; }
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_InExplicitExpression()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@(RenderPerson((person) => @@person.Name
))
+@functions {
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_NonGeneric_InImplicitExpression()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@RenderPerson(@HI
)
+@functions {
+ object RenderPerson(RenderFragment p) => null;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_Generic_InImplicitExpression()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+@RenderPerson((person) => @@person.Name
)
+@functions {
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_ContainsComponent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] string Name { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper ""*, TestAssembly""
+@{
+ RenderFragment p = (person) => @
;
+}
+@functions {
+ class Person
+ {
+ public string Name { get; set; }
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ // Targeted at the logic that assigns 'builder' names
+ [Fact]
+ public void RazorTemplate_FollowedByComponent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] string Name { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper ""*, TestAssembly""
+@{
+ RenderFragment p = (person) => @
;
+}
+
+@(""hello, world!"")
+
+
+@functions {
+ class Person
+ {
+ public string Name { get; set; }
+ }
+}");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_NonGeneric_AsComponentParameter()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] RenderFragment Template { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper ""*, TestAssembly""
+@{ RenderFragment template = @Joey
; }
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_Generic_AsComponentParameter()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] RenderFragment PersonTemplate { get; set; }
+ }
+
+ public class Person
+ {
+ public string Name { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper ""*, TestAssembly""
+@{ RenderFragment template = (person) => @@person.Name
; }
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void RazorTemplate_AsComponentParameter_MixedContent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class MyComponent : BlazorComponent
+ {
+ [Parameter] RenderFragment Template { get; set; }
+ }
+
+ public class Context
+ {
+ public int Index { get; set; }
+ public string Item { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper ""*, TestAssembly""
+@{ RenderFragment template = (context) => @#@context.Index - @context.Item.ToLower() ; }
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Whitespace
+
+ [Fact]
+ public void LeadingWhiteSpace_WithDirective()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+
+@using System
+
+Hello ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void LeadingWhiteSpace_WithCSharpExpression()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+
+@(""My value"")
+
+Hello ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void LeadingWhiteSpace_WithComponent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class SomeOtherComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+
+Hello ");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void TrailingWhiteSpace_WithDirective()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+Hello
+
+@page ""/my/url""
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void TrailingWhiteSpace_WithCSharpExpression()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+Hello
+
+@(""My value"")
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void TrailingWhiteSpace_WithComponent()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class SomeOtherComponent : BlazorComponent
+ {
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+Hello
+
+
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+
+ #region Misc
+
+ [Fact] // We don't process - we just skip them
+ public void Component_WithDocType()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+
+
");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ScriptTag_WithErrorSuppressed()
+ {
+ // Arrange/Act
+ var generated = CompileToCSharp(@"
+
+
+
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact] // https://github.com/aspnet/Blazor/issues/597
+ public void Regression_597()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class Counter : BlazorComponent
+ {
+ public int Count { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+@functions {
+ string y = null;
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void Regression_609()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using System;
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class User : BlazorComponent
+ {
+ public string Name { get; set; }
+ public Action NameChanged { get; set; }
+ public bool IsActive { get; set; }
+ public Action IsActiveChanged { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+
+
+@functions {
+ public string UserName { get; set; }
+ public bool UserIsActive { get; set; }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact] // https://github.com/aspnet/Blazor/issues/772
+ public void Regression_772()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class SurveyPrompt : BlazorComponent
+ {
+ [Parameter] private string Title { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@page ""/""
+
+Hello, world!
+
+Welcome to your new app.
+
+ d.Id),
+ d => Assert.Equal("RZ1034", d.Id),
+ d => Assert.Equal("RZ1035", d.Id));
+ }
+
+ [Fact] // https://github.com/aspnet/Blazor/issues/773
+ public void Regression_773()
+ {
+ // Arrange
+ AdditionalSyntaxTrees.Add(Parse(@"
+using Microsoft.AspNetCore.Blazor.Components;
+
+namespace Test
+{
+ public class SurveyPrompt : BlazorComponent
+ {
+ [Parameter] private string Title { get; set; }
+ }
+}
+"));
+
+ // Act
+ var generated = CompileToCSharp(@"
+@addTagHelper *, TestAssembly
+@page ""/""
+
+Hello, world!
+
+Welcome to your new app.
+
+Test!"" />
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void Regression_784()
+ {
+ // Arrange
+
+ // Act
+ var generated = CompileToCSharp(@"
+
+@functions {
+ public string ParentBgColor { get; set; } = ""#FFFFFF"";
+
+ public void OnComponentHover(UIMouseEventArgs e)
+ {
+ }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ #endregion
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/ComponentRenderingRazorIntegrationTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/ComponentRenderingRazorIntegrationTest.cs
index aa318bd98e..8451014691 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/ComponentRenderingRazorIntegrationTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/ComponentRenderingRazorIntegrationTest.cs
@@ -586,7 +586,7 @@ namespace Test
var component = CompileToComponent(@"
@addTagHelper ""*, TestAssembly""
-@{ RenderFragment template = @@context.ToLower()
; }
+@{ RenderFragment template = (context) => @@context.ToLower()
; }
");
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/DesignTimeCodeGenerationTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/DesignTimeCodeGenerationTest.cs
index 82249842ca..858f6de540 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/DesignTimeCodeGenerationTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/DesignTimeCodeGenerationTest.cs
@@ -1,1250 +1,10 @@
// 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.Linq;
-using Xunit;
-
namespace Microsoft.AspNetCore.Blazor.Build.Test
{
- public class DesignTimeCodeGenerationTest : RazorBaselineIntegrationTestBase
+ public class DesignTimeCodeGenerationTest : CodeGenerationTestBase
{
internal override bool DesignTime => true;
-
- internal override bool UseTwoPhaseCompilation => true;
-
- [Fact]
- public void ChildComponent_WithParameters()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SomeType
- {
- }
-
- public class MyComponent : BlazorComponent
- {
- [Parameter] int IntProperty { get; set; }
- [Parameter] bool BoolProperty { get; set; }
- [Parameter] string StringProperty { get; set; }
- [Parameter] SomeType ObjectProperty { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ComponentParameter_TypeMismatch_ReportsDiagnostic()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class CoolnessMeter : BlazorComponent
- {
- [Parameter] private int Coolness { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
-
- var assembly = CompileToAssembly(generated, throwOnFailure: false);
- // This has some errors
- Assert.Collection(
- assembly.Diagnostics.OrderBy(d => d.Id),
- d => Assert.Equal("CS1503", d.Id));
- }
-
- [Fact]
- public void ChildComponent_WithExplicitStringParameter()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- string StringProperty { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithNonPropertyAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithLambdaEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- Action OnClick { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- { Increment(); })""/>
-
-@functions {
- private int counter;
- private void Increment() {
- counter++;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- // Regression test for #954 - we need to allow arbitrary event handler
- // attributes with weak typing.
- [Fact]
- public void ChildComponent_WithWeaklyTypeEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class DynamicElement : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- private Action OnClick { get; set; }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithExplicitEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- Action OnClick { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- private int counter;
- private void Increment(UIEventArgs e) {
- counter++;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithChildContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- string MyAttr { get; set; }
-
- [Parameter]
- RenderFragment ChildContent { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-Some textNested text ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithElementOnlyChildContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- RenderFragment ChildContent { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-hello ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithString()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithLambdaDelegate()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
- { })"" />");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithDelegate()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- void OnClick(UIMouseEventArgs e) {
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_Action_MethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
-
-@functions {
- Task OnClick()
- {
- return Task.CompletedTask;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
-
-@functions {
- Task OnClick(UIMouseEventArgs e)
- {
- return Task.CompletedTask;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_Action_Lambda()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
- await Task.Delay(10)"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_ActionEventArgs_Lambda()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
- await Task.Delay(10)"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/597
- public void Regression_597()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class Counter : BlazorComponent
- {
- public int Count { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- string y = null;
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Regression_609()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class User : BlazorComponent
- {
- public string Name { get; set; }
- public Action NameChanged { get; set; }
- public bool IsActive { get; set; }
- public Action IsActiveChanged { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- public string UserName { get; set; }
- public bool UserIsActive { get; set; }
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/772
- public void Regression_772()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SurveyPrompt : BlazorComponent
- {
- [Parameter] private string Title { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-@page ""/""
-
-Hello, world!
-
-Welcome to your new app.
-
- d.Id),
- d => Assert.Equal("RZ1034", d.Id),
- d => Assert.Equal("RZ1035", d.Id));
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/773
- public void Regression_773()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SurveyPrompt : BlazorComponent
- {
- [Parameter] private string Title { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-@page ""/""
-
-Hello, world!
-
-Welcome to your new app.
-
-Test!"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Regression_784()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- public string ParentBgColor { get; set; } = ""#FFFFFF"";
-
- public void OnComponentHover(UIMouseEventArgs e)
- {
- }
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValue_WithMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- int Value { get; set; }
-
- [Parameter]
- Action ValueChanged { get; set; }
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_TypeChecked_WithMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- int Value { get; set; }
-
- [Parameter]
- Action ValueChanged { get; set; }
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public string ParentValue { get; set; } = ""42"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
-
- var assembly = CompileToAssembly(generated, throwOnFailure: false);
- // This has some errors
- Assert.Collection(
- assembly.Diagnostics.OrderBy(d => d.Id),
- d => Assert.Equal("CS0029", d.Id),
- d => Assert.Equal("CS1503", d.Id));
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValue_WithoutMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent, IComponent
- {
- void IComponent.SetParameters(ParameterCollection parameters)
- {
- }
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- int Value { get; set; }
-
- [Parameter]
- Action OnChanged { get; set; }
- }
-}"));
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent, IComponent
- {
- void IComponent.SetParameters(ParameterCollection parameters)
- {
- }
- }
-}"));
-
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElement_WritesAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- [BindElement(""div"", null, ""myvalue"", ""myevent"")]
- public static class BindAttributes
- {
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public string ParentValue { get; set; } = ""hi"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementWithSuffix_WritesAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")]
- public static class BindAttributes
- {
- }
-}"));
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public string ParentValue { get; set; } = ""hi"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputWithoutType_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WithFormat_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-
- public string Format { get; set; } = ""MM/dd/yyyy"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputCheckbox_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public bool Enabled { get; set; }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementFallback_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementFallback_WithFormat_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Element_WithRef()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-Hello
-
-@functions {
- Microsoft.AspNetCore.Blazor.ElementRef myElem;
-
- void DoSomething() { myElem.GetHashCode(); } // Avoid 'assigned but not used' warning
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Component_WithRef()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- Test.MyComponent myInstance;
-
- void DoSomething() { myInstance.GetHashCode(); } // Avoid 'assigned but not used' warning
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // We don't process - we just skip them
- public void Component_WithDocType()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-
-
");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_InCodeBlock()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@{
- RenderFragment p = @@context.Name
;
-}
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
-
- [Fact]
- public void RazorTemplate_InExplicitExpression()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@(RenderPerson(@@context.Name
))
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-
- object RenderPerson(RenderFragment p) => null;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_InImplicitExpression()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@RenderPerson(@@context.Name
)
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-
- object RenderPerson(RenderFragment p) => null;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_ContainsComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{
- RenderFragment p = @
;
-}
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- // Targeted at the logic that assigns 'builder' names
- [Fact]
- public void RazorTemplate_FollowedByComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{
- RenderFragment p = @
;
-}
-
-@(""hello, world!"")
-
-
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_AsComponentParameter()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] RenderFragment PersonTemplate { get; set; }
- }
-
- public class Person
- {
- public string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{ RenderFragment template = @@context.Name
; }
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_AsComponentParameter_MixedContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] RenderFragment Template { get; set; }
- }
-
- public class Context
- {
- public int Index { get; set; }
- public string Item { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{ RenderFragment template = @#@context.Index - @context.Item.ToLower() ; }
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
}
}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/InitializeTestFileAttribute.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/InitializeTestFileAttribute.cs
index 2add553f5b..c4bb636f35 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/InitializeTestFileAttribute.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/InitializeTestFileAttribute.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// 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.Reflection;
@@ -11,16 +11,16 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
public override void Before(MethodInfo methodUnderTest)
{
- if (typeof(RazorBaselineIntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.DeclaringType.GetTypeInfo()))
+ if (typeof(RazorBaselineIntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.ReflectedType.GetTypeInfo()))
{
- var typeName = methodUnderTest.DeclaringType.Name;
+ var typeName = methodUnderTest.ReflectedType.Name;
RazorBaselineIntegrationTestBase.DirectoryPath = $"TestFiles/{typeName}/{methodUnderTest.Name}";
}
}
public override void After(MethodInfo methodUnderTest)
{
- if (typeof(RazorBaselineIntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.DeclaringType.GetTypeInfo()))
+ if (typeof(RazorBaselineIntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.ReflectedType.GetTypeInfo()))
{
RazorBaselineIntegrationTestBase.DirectoryPath = null;
}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/IntermediateNodeWriter.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/IntermediateNodeWriter.cs
index daf38c1251..4e39b09cec 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/IntermediateNodeWriter.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/Razor/IntermediateNodeWriter.cs
@@ -18,6 +18,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
IExtensionIntermediateNodeVisitor,
IExtensionIntermediateNodeVisitor,
IExtensionIntermediateNodeVisitor,
+ IExtensionIntermediateNodeVisitor,
IExtensionIntermediateNodeVisitor,
IExtensionIntermediateNodeVisitor
{
@@ -285,6 +286,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
WriteContentNode(node, node.AttributeName, node.PropertyName);
}
+ void IExtensionIntermediateNodeVisitor.VisitExtension(ComponentChildContentIntermediateNode node)
+ {
+ WriteContentNode(node, node.AttributeName);
+ }
+
void IExtensionIntermediateNodeVisitor.VisitExtension(RouteAttributeExtensionNode node)
{
WriteContentNode(node, node.Template);
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/RenderingRazorIntegrationTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/RenderingRazorIntegrationTest.cs
index a51499c39c..2457c44efb 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/RenderingRazorIntegrationTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/RenderingRazorIntegrationTest.cs
@@ -600,14 +600,14 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
public enum MyEnum { FirstValue, SecondValue }
[Fact]
- public void RazorTemplate_CanBeUsedFromRazorCode()
+ public void RazorTemplate_NonGeneric_CanBeUsedFromRazorCode()
{
// Arrange
var component = CompileToComponent(@"
-@{ RenderFragment template = @@context.ToLower()
; }
+@{ RenderFragment template = @@(""Hello, World!"".ToLower())
; }
@for (var i = 0; i < 3; i++)
{
- @template.WithValue(""Hello, World!"");
+ @template;
}
");
@@ -626,11 +626,75 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
}
[Fact]
- public void RazorTemplate_CanBeUsedFromMethod()
+ public void RazorTemplate_Generic_CanBeUsedFromRazorCode()
{
// Arrange
var component = CompileToComponent(@"
-@(Repeat(@@context.ToLower()
, ""Hello, World!"", 3))
+@{ RenderFragment template = (context) => @@context.ToLower()
; }
+@for (var i = 0; i < 3; i++)
+{
+ @template(""Hello, World!"");
+}
+");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hello, world!", 1),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hello, world!", 1),
+ frame => AssertFrame.Element(frame, "div", 2, 0),
+ frame => AssertFrame.Text(frame, "hello, world!", 1));
+ }
+
+ [Fact]
+ public void RazorTemplate_NonGeneric_CanBeUsedFromMethod()
+ {
+ // Arrange
+ var component = CompileToComponent(@"
+@(Repeat(@@(""Hello, World!"".ToLower())
, 3))
+
+@functions {
+ RenderFragment Repeat(RenderFragment template, int count)
+ {
+ return (b) =>
+ {
+ for (var i = 0; i < count; i++)
+ {
+ b.AddContent(i, template);
+ }
+ };
+ }
+}");
+
+ // Act
+ var frames = GetRenderTree(component);
+
+ // Assert
+ //
+ // The sequence numbers start at 1 here because there is an AddContent(0, Repeat(....) call
+ // that precedes the definition of the lambda. Sequence numbers for the lambda are allocated
+ // from the same logical sequence as the surrounding code.
+ Assert.Collection(
+ frames,
+ frame => AssertFrame.Element(frame, "div", 2, 1),
+ frame => AssertFrame.Text(frame, "hello, world!", 2),
+ frame => AssertFrame.Element(frame, "div", 2, 1),
+ frame => AssertFrame.Text(frame, "hello, world!", 2),
+ frame => AssertFrame.Element(frame, "div", 2, 1),
+ frame => AssertFrame.Text(frame, "hello, world!", 2));
+ }
+
+ [Fact]
+ public void RazorTemplate_Generic_CanBeUsedFromMethod()
+ {
+ // Arrange
+ var component = CompileToComponent(@"
+@(Repeat((context) => @@context.ToLower()
, ""Hello, World!"", 3))
@functions {
RenderFragment Repeat(RenderFragment template, T value, int count)
@@ -639,7 +703,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
{
for (var i = 0; i < count; i++)
{
- template(b, value);
+ b.AddContent(i, template, value);
}
};
}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeCodeGenerationTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeCodeGenerationTest.cs
index 5e48e4bf6b..271daee854 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeCodeGenerationTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeCodeGenerationTest.cs
@@ -1,1489 +1,9 @@
// 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.Linq;
-using Xunit;
-
namespace Microsoft.AspNetCore.Blazor.Build.Test
{
- public class RuntimeCodeGenerationTest : RazorBaselineIntegrationTestBase
- {
- internal override bool UseTwoPhaseCompilation => true;
-
- [Fact]
- public void ChildComponent_Simple()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
+ public class RuntimeCodeGenerationTest : CodeGenerationTestBase
{
}
}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithParameters()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SomeType
- {
- }
-
- public class MyComponent : BlazorComponent
- {
- [Parameter] int IntProperty { get; set; }
- [Parameter] bool BoolProperty { get; set; }
- [Parameter] string StringProperty { get; set; }
- [Parameter] SomeType ObjectProperty { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithExplicitStringParameter()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- string StringProperty { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithNonPropertyAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
-
- [Fact]
- public void ChildComponent_WithLambdaEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- Action OnClick { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
- { Increment(); })""/>
-
-@functions {
- private int counter;
- private void Increment() {
- counter++;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- // Regression test for #954 - we need to allow arbitrary event handler
- // attributes with weak typing.
- [Fact]
- public void ChildComponent_WithWeaklyTypeEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class DynamicElement : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- private Action OnClick { get; set; }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithExplicitEventHandler()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- Action OnClick { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- private int counter;
- private void Increment(UIEventArgs e) {
- counter++;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithChildContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- string MyAttr { get; set; }
-
- [Parameter]
- RenderFragment ChildContent { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-Some textNested text ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithElementOnlyChildContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- RenderFragment ChildContent { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-hello ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ChildComponent_WithPageDirective()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-@page ""/MyPage""
-@page ""/AnotherRoute/{id}""
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ComponentParameter_TypeMismatch_ReportsDiagnostic()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class CoolnessMeter : BlazorComponent
- {
- [Parameter] private int Coolness { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
-
- var assembly = CompileToAssembly(generated, throwOnFailure: false);
- // This has some errors
- Assert.Collection(
- assembly.Diagnostics.OrderBy(d => d.Id),
- d => Assert.Equal("CS1503", d.Id));
- }
-
- [Fact]
- public void EventHandler_OnElement_WithString()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
- ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithNoArgsLambdaDelegate()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
- { })"" />");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithEventArgsLambdaDelegate()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
- { })"" />");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithNoArgMethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- void OnClick() {
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_WithEventArgsMethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- void OnClick(UIMouseEventArgs e) {
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- void OnClick(UIEventArgs e) {
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_Action_MethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
-
-@functions {
- Task OnClick()
- {
- return Task.CompletedTask;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
-
-@functions {
- Task OnClick(UIMouseEventArgs e)
- {
- return Task.CompletedTask;
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_Action_Lambda()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
- await Task.Delay(10)"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void AsyncEventHandler_OnElement_ActionEventArgs_Lambda()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@using System.Threading.Tasks
- await Task.Delay(10)"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void ScriptTag_WithErrorSuppressed()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-
-
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void LeadingWhiteSpace_WithDirective()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-
-@using System
-
-Hello ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void LeadingWhiteSpace_WithCSharpExpression()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-
-@(""My value"")
-
-Hello ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void LeadingWhiteSpace_WithComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SomeOtherComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-
-Hello ");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void TrailingWhiteSpace_WithDirective()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-Hello
-
-@page ""/my/url""
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void TrailingWhiteSpace_WithCSharpExpression()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-Hello
-
-@(""My value"")
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void TrailingWhiteSpace_WithComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SomeOtherComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-Hello
-
-
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/597
- public void Regression_597()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class Counter : BlazorComponent
- {
- public int Count { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- string y = null;
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Regression_609()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class User : BlazorComponent
- {
- public string Name { get; set; }
- public Action NameChanged { get; set; }
- public bool IsActive { get; set; }
- public Action IsActiveChanged { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- public string UserName { get; set; }
- public bool UserIsActive { get; set; }
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/772
- public void Regression_772()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SurveyPrompt : BlazorComponent
- {
- [Parameter] private string Title { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-@page ""/""
-
-Hello, world!
-
-Welcome to your new app.
-
- d.Id),
- d => Assert.Equal("RZ1034", d.Id),
- d => Assert.Equal("RZ1035", d.Id));
- }
-
- [Fact] // https://github.com/aspnet/Blazor/issues/773
- public void Regression_773()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class SurveyPrompt : BlazorComponent
- {
- [Parameter] private string Title { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-@page ""/""
-
-Hello, world!
-
-Welcome to your new app.
-
-Test!"" />
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Regression_784()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-@functions {
- public string ParentBgColor { get; set; } = ""#FFFFFF"";
-
- public void OnComponentHover(UIMouseEventArgs e)
- {
- }
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValue_WithMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- int Value { get; set; }
-
- [Parameter]
- Action ValueChanged { get; set; }
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValue_WithoutMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent, IComponent
- {
- void IComponent.SetParameters(ParameterCollection parameters)
- {
- }
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter]
- int Value { get; set; }
-
- [Parameter]
- Action OnChanged { get; set; }
- }
-}"));
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent, IComponent
- {
- void IComponent.SetParameters(ParameterCollection parameters)
- {
- }
- }
-}"));
-
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElement_WritesAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- [BindElement(""div"", null, ""myvalue"", ""myevent"")]
- public static class BindAttributes
- {
- }
-}"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public string ParentValue { get; set; } = ""hi"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementWithSuffix_WritesAttributes()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using System;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")]
- public static class BindAttributes
- {
- }
-}"));
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public string ParentValue { get; set; } = ""hi"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputWithoutType_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WithFormat_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-
- public string Format { get; set; } = ""MM/dd/yyyy"";
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputText_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BuiltIn_BindToInputCheckbox_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public bool Enabled { get; set; }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementFallback_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public int ParentValue { get; set; } = 42;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void BindToElementFallback_WithFormat_WritesAttributes()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-@functions {
- public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Element_WithRef()
- {
- // Arrange/Act
- var generated = CompileToCSharp(@"
-Hello
-
-@functions {
- private Microsoft.AspNetCore.Blazor.ElementRef myElem;
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Component_WithRef()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Arrange/Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
-
-@functions {
- private Test.MyComponent myInstance;
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void Component_WithRef_WithChildContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- }
-}
-"));
-
- // Arrange/Act
- var generated = CompileToCSharp(@"
-@addTagHelper *, TestAssembly
-
- Some further content
-
-
-@functions {
- private Test.MyComponent myInstance;
-}
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact] // We don't process - we just skip them
- public void Component_WithDocType()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-
-
-
");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_InCodeBlock()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@{
- RenderFragment p = @@context.Name
;
-}
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
-
- [Fact]
- public void RazorTemplate_InExplicitExpression()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@(RenderPerson(@@context.Name
))
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-
- object RenderPerson(RenderFragment p) => null;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_InImplicitExpression()
- {
- // Arrange
-
- // Act
- var generated = CompileToCSharp(@"
-@RenderPerson(@@context.Name
)
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-
- object RenderPerson(RenderFragment p) => null;
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_ContainsComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{
- RenderFragment p = @
;
-}
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- // Targeted at the logic that assigns 'builder' names
- [Fact]
- public void RazorTemplate_FollowedByComponent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{
- RenderFragment p = @
;
-}
-
-@(""hello, world!"")
-
-
-@functions {
- class Person
- {
- public string Name { get; set; }
- }
-}");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_AsComponentParameter()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] RenderFragment PersonTemplate { get; set; }
- }
-
- public class Person
- {
- public string Name { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{ RenderFragment template = @@context.Name
; }
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
-
- [Fact]
- public void RazorTemplate_AsComponentParameter_MixedContent()
- {
- // Arrange
- AdditionalSyntaxTrees.Add(Parse(@"
-using Microsoft.AspNetCore.Blazor;
-using Microsoft.AspNetCore.Blazor.Components;
-
-namespace Test
-{
- public class MyComponent : BlazorComponent
- {
- [Parameter] RenderFragment Template { get; set; }
- }
-
- public class Context
- {
- public int Index { get; set; }
- public string Item { get; set; }
- }
-}
-"));
-
- // Act
- var generated = CompileToCSharp(@"
-@addTagHelper ""*, TestAssembly""
-@{ RenderFragment template = @#@context.Index - @context.Item.ToLower() ; }
-
-");
-
- // Assert
- AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
- AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
- CompileToAssembly(generated);
- }
- }
-}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TemplateRazorIntegrationTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TemplateRazorIntegrationTest.cs
index fdc02afd37..a94bbc7233 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TemplateRazorIntegrationTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TemplateRazorIntegrationTest.cs
@@ -5,7 +5,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Blazor.Build.Test
{
- public class TemplateRazorIntegrationTest : RazorBaselineIntegrationTestBase
+ public class TemplateRazorIntegrationTest : RazorIntegrationTestBase
{
// Razor doesn't parse this as a template, we don't need much special handling for
// it because it will just be invalid in general.
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..874370cd3d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
@@ -0,0 +1,60 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment header = (context) =>
+
+#line default
+#line hidden
+ (builder2) => {
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = context.ToLowerInvariant();
+
+#line default
+#line hidden
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ __o = new Microsoft.AspNetCore.Blazor.RenderFragment(
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ header
+
+#line default
+#line hidden
+ );
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..81cff48b37
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt
@@ -0,0 +1,39 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment header = (context) =>
+ Template - (80:1,49 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (80:1,49 [38] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ CSharpCode - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (123:2,0 [62] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (151:2,28 [20] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (151:2,28 [20] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some Content\n
+ ComponentAttributeExtensionNode - (143:2,20 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Header - Header
+ CSharpExpression - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - header
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..23e2dfcacf
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
@@ -0,0 +1,25 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment header = (context) => |
+Generated Location: (1039:29,2 [46] )
+| RenderFragment header = (context) => |
+
+Source Location: (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+|context.ToLowerInvariant()|
+Generated Location: (1253:35,55 [26] )
+|context.ToLowerInvariant()|
+
+Source Location: (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1466:41,87 [2] )
+|; |
+
+Source Location: (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+|header|
+Generated Location: (1655:47,21 [6] )
+|header|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..7704b55c64
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
@@ -0,0 +1,63 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment header = (context) =>
+
+#line default
+#line hidden
+ (builder2) => {
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = context.ToLowerInvariant();
+
+#line default
+#line hidden
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ __o = new Microsoft.AspNetCore.Blazor.RenderFragment(
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ header
+
+#line default
+#line hidden
+ );
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ builder.AddAttribute(-1, "Footer", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..e47457aeee
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt
@@ -0,0 +1,42 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment header = (context) =>
+ Template - (80:1,49 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (80:1,49 [38] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ CSharpCode - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (123:2,0 [114] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (155:3,2 [41] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (169:3,16 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (169:3,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some Content
+ ComponentChildContent - (200:4,2 [21] x:\dir\subdir\Test\TestComponent.cshtml) - Footer
+ HtmlContent - (208:4,10 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (208:4,10 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Bye!
+ ComponentAttributeExtensionNode - (143:2,20 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Header - Header
+ CSharpExpression - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - header
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..23e2dfcacf
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
@@ -0,0 +1,25 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment header = (context) => |
+Generated Location: (1039:29,2 [46] )
+| RenderFragment header = (context) => |
+
+Source Location: (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+|context.ToLowerInvariant()|
+Generated Location: (1253:35,55 [26] )
+|context.ToLowerInvariant()|
+
+Source Location: (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1466:41,87 [2] )
+|; |
+
+Source Location: (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+|header|
+Generated Location: (1655:47,21 [6] )
+|header|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.codegen.cs
new file mode 100644
index 0000000000..37a3009656
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.codegen.cs
@@ -0,0 +1,36 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.ir.txt
new file mode 100644
index 0000000000..c716464868
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.ir.txt
@@ -0,0 +1,25 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.mappings.txt
new file mode 100644
index 0000000000..75b2c90a92
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_Simple/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
index ac6736fae4..c921265f1a 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
@@ -23,14 +23,15 @@ Document -
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
ComponentExtensionNode - (31:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
- HtmlElement - (66:1,35 [42] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
- HtmlAttribute - - -
- HtmlAttributeValue - -
- IntermediateToken - - Html - 1
- HtmlContent - (84:1,53 [11] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (84:1,53 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Nested text
+ ComponentChildContent - - ChildContent
+ HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
+ HtmlElement - (66:1,35 [42] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - 1
+ HtmlContent - (84:1,53 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (84:1,53 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Nested text
ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
index be1cbcc72b..9dc149f9ce 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
@@ -23,6 +23,7 @@ Document -
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
ComponentExtensionNode - (31:1,0 [47] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlElement - (44:1,13 [20] x:\dir\subdir\Test\TestComponent.cshtml) - child
- HtmlContent - (51:1,20 [5] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (51:1,20 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - hello
+ ComponentChildContent - - ChildContent
+ HtmlElement - (44:1,13 [20] x:\dir\subdir\Test\TestComponent.cshtml) - child
+ HtmlContent - (51:1,20 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (51:1,20 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..37a3009656
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs
@@ -0,0 +1,36 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..8b2563d0d8
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt
@@ -0,0 +1,28 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [61] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (44:1,13 [34] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (58:1,27 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (58:1,27 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..75b2c90a92
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..d651e6bdb1
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
@@ -0,0 +1,41 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((context) => (builder2) => {
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = context;
+
+#line default
+#line hidden
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..2304ddd218
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt
@@ -0,0 +1,28 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (44:1,13 [37] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ CSharpExpression - (59:1,28 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (59:1,28 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..940513b3ec
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (59:1,28 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+|context|
+Generated Location: (1208:30,28 [7] )
+|context|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..781ebf72c9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
@@ -0,0 +1,41 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((context) => (builder2) => {
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = context.ToLowerInvariant();
+
+#line default
+#line hidden
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..f493489dfe
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt
@@ -0,0 +1,37 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [107] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
+ HtmlElement - (66:1,35 [58] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - 1
+ CSharpExpression - (85:1,54 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (85:1,54 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
+ HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..902f1572d2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (85:1,54 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+|context.ToLowerInvariant()|
+Generated Location: (1234:30,54 [26] )
+|context.ToLowerInvariant()|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
new file mode 100644
index 0000000000..1b1a8b108c
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
@@ -0,0 +1,41 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((item) => (builder2) => {
+#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = item.ToLowerInvariant();
+
+#line default
+#line hidden
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt
new file mode 100644
index 0000000000..9e4657e098
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt
@@ -0,0 +1,39 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [164] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (61:2,2 [118] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (90:2,31 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (90:2,31 [15] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some text
+ HtmlElement - (105:3,13 [55] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - 1
+ CSharpExpression - (124:3,32 [23] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (124:3,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - item.ToLowerInvariant()
+ HtmlContent - (160:3,68 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (160:3,68 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
+ HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt
new file mode 100644
index 0000000000..585184e8bb
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (124:3,32 [23] x:\dir\subdir\Test\TestComponent.cshtml)
+|item.ToLowerInvariant()|
+Generated Location: (1209:30,32 [23] )
+|item.ToLowerInvariant()|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs
index 665a271300..64e8e3703f 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs
@@ -28,7 +28,7 @@ global::System.Object __typeHelper = "*, TestAssembly";
base.BuildRenderTree(builder);
__o = new System.Action(
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- (e) => { Increment(); }
+ e => { Increment(); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.ir.txt
index 9ab3373d6f..f5eec3c96d 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.ir.txt
@@ -22,11 +22,11 @@ Document -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- ComponentExtensionNode - (31:1,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (53:1,22 [26] x:\dir\subdir\Test\TestComponent.cshtml) - OnClick - OnClick
- CSharpExpression - (54:1,23 [25] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (55:1,24 [23] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - (e) => { Increment(); }
- HtmlContent - (82:1,51 [4] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (82:1,51 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
- CSharpCode - (98:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (98:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private int counter;\n private void Increment() {\n counter++;\n }\n
+ ComponentExtensionNode - (31:1,0 [49] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (53:1,22 [24] x:\dir\subdir\Test\TestComponent.cshtml) - OnClick - OnClick
+ CSharpExpression - (54:1,23 [23] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (55:1,24 [21] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - e => { Increment(); }
+ HtmlContent - (80:1,49 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (80:1,49 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ CSharpCode - (96:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (96:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private int counter;\n private void Increment() {\n counter++;\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt
index f938240b14..175657d740 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt
@@ -3,19 +3,19 @@ Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (559:16,38 [15] )
|*, TestAssembly|
-Source Location: (55:1,24 [23] x:\dir\subdir\Test\TestComponent.cshtml)
-|(e) => { Increment(); }|
-Generated Location: (1140:30,24 [23] )
-|(e) => { Increment(); }|
+Source Location: (55:1,24 [21] x:\dir\subdir\Test\TestComponent.cshtml)
+|e => { Increment(); }|
+Generated Location: (1140:30,24 [21] )
+|e => { Increment(); }|
-Source Location: (98:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (96:3,12 [87] x:\dir\subdir\Test\TestComponent.cshtml)
|
private int counter;
private void Increment() {
counter++;
}
|
-Generated Location: (1471:41,12 [87] )
+Generated Location: (1469:41,12 [87] )
|
private int counter;
private void Increment() {
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.codegen.cs
new file mode 100644
index 0000000000..aa907c15d3
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.codegen.cs
@@ -0,0 +1,46 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ [Microsoft.AspNetCore.Blazor.Components.RouteAttribute("/MyPage")]
+ [Microsoft.AspNetCore.Blazor.Components.RouteAttribute("/AnotherRoute/{id}")]
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "/MyPage";
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "/AnotherRoute/{id}";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.ir.txt
new file mode 100644
index 0000000000..f87c22ab81
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.ir.txt
@@ -0,0 +1,29 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ RouteAttributeExtensionNode - - /MyPage
+ RouteAttributeExtensionNode - - /AnotherRoute/{id}
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ DirectiveToken - (37:1,6 [9] x:\dir\subdir\Test\TestComponent.cshtml) - "/MyPage"
+ DirectiveToken - (54:2,6 [20] x:\dir\subdir\Test\TestComponent.cshtml) - "/AnotherRoute/{id}"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (76:3,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.mappings.txt
new file mode 100644
index 0000000000..53489fb33f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ChildComponent_WithPageDirective/TestComponent.mappings.txt
@@ -0,0 +1,15 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (714:18,38 [15] )
+|*, TestAssembly|
+
+Source Location: (37:1,6 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+|"/MyPage"|
+Generated Location: (830:22,37 [9] )
+|"/MyPage"|
+
+Source Location: (54:2,6 [20] x:\dir\subdir\Test\TestComponent.cshtml)
+|"/AnotherRoute/{id}"|
+Generated Location: (939:26,37 [20] )
+|"/AnotherRoute/{id}"|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
index 054893de86..8710dff3b6 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
@@ -38,9 +38,8 @@ global::System.Object __typeHelper = "*, TestAssembly";
#pragma warning restore 1998
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
- Test.MyComponent myInstance;
-
- void DoSomething() { myInstance.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
index d472c3cd92..adee9b617c 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
@@ -32,7 +32,7 @@ Document -
IntermediateToken - (94:1,63 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (103:1,72 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (103:1,72 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
- HtmlContent - (253:7,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (253:7,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (119:3,12 [133] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (119:3,12 [133] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Test.MyComponent myInstance;\n\n void DoSomething() { myInstance.GetHashCode(); } // Avoid 'assigned but not used' warning\n
+ HtmlContent - (224:6,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (224:6,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
index 61b26413c6..23bc888573 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
@@ -8,16 +8,14 @@ Source Location: (70:1,39 [10] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (1223:32,39 [10] )
|myInstance|
-Source Location: (119:3,12 [133] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
- Test.MyComponent myInstance;
-
- void DoSomething() { myInstance.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
-Generated Location: (1407:39,12 [133] )
+Generated Location: (1407:39,12 [104] )
|
- Test.MyComponent myInstance;
-
- void DoSomething() { myInstance.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..8e1d3edc04
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs
@@ -0,0 +1,48 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ myInstance = default(Test.MyComponent);
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+#line 6 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..8bcf5f5a02
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt
@@ -0,0 +1,43 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some
+ HtmlElement - (87:2,9 [16] x:\dir\subdir\Test\TestComponent.cshtml) - el
+ HtmlContent - (91:2,13 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (91:2,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Html - further
+ HtmlContent - (103:2,25 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (103:2,25 [10] x:\dir\subdir\Test\TestComponent.cshtml) - Html - content\n
+ RefExtensionNode - (49:1,18 [10] x:\dir\subdir\Test\TestComponent.cshtml) - myInstance - Test.MyComponent
+ ComponentAttributeExtensionNode - - SomeProp -
+ HtmlContent - (71:1,40 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (71:1,40 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - val
+ HtmlContent - (127:3,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (127:3,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlContent - (248:8,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (248:8,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..49b2528ce4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt
@@ -0,0 +1,21 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (49:1,18 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+|myInstance|
+Generated Location: (1202:32,18 [10] )
+|myInstance|
+
+Source Location: (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
+|
+Generated Location: (1386:39,12 [104] )
+|
+ private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
index c29205053a..c430656f63 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
@@ -31,9 +31,8 @@ namespace Test
#pragma warning restore 1998
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- Microsoft.AspNetCore.Blazor.ElementRef myElem;
-
- void DoSomething() { myElem.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
index bdf90a1f8c..2c8d389e39 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
@@ -31,7 +31,7 @@ Document -
IntermediateToken - (60:0,60 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (79:0,79 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (79:0,79 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
- HtmlContent - (243:6,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (243:6,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (95:2,12 [147] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (95:2,12 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Microsoft.AspNetCore.Blazor.ElementRef myElem;\n\n void DoSomething() { myElem.GetHashCode(); } // Avoid 'assigned but not used' warning\n
+ HtmlContent - (214:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (214:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Microsoft.AspNetCore.Blazor.ElementRef myElem;\n public void Foo() { System.GC.KeepAlive(myElem); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
index cd0b6cb8cb..9cc58eaa96 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
@@ -3,16 +3,14 @@ Source Location: (36:0,36 [6] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (956:25,36 [6] )
|myElem|
-Source Location: (95:2,12 [147] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml)
|
- Microsoft.AspNetCore.Blazor.ElementRef myElem;
-
- void DoSomething() { myElem.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
|
-Generated Location: (1158:32,12 [147] )
+Generated Location: (1158:32,12 [118] )
|
- Microsoft.AspNetCore.Blazor.ElementRef myElem;
-
- void DoSomething() { myElem.GetHashCode(); } // Avoid 'assigned but not used' warning
+ private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs
new file mode 100644
index 0000000000..f959903880
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs
@@ -0,0 +1,37 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ __o = Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(OnClick);
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ void OnClick(UIEventArgs e) {
+ }
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.ir.txt
new file mode 100644
index 0000000000..4e62bc1fb6
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.ir.txt
@@ -0,0 +1,31 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
+ IntermediateToken - - CSharp - )
+ HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIEventArgs e) {\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt
new file mode 100644
index 0000000000..c85b977fbd
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt
@@ -0,0 +1,16 @@
+Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+|OnClick|
+Generated Location: (1005:24,136 [7] )
+|OnClick|
+
+Source Location: (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ void OnClick(UIEventArgs e) {
+ }
+|
+Generated Location: (1128:28,12 [44] )
+|
+ void OnClick(UIEventArgs e) {
+ }
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs
new file mode 100644
index 0000000000..9e6ebcefbd
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs
@@ -0,0 +1,30 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ __o = Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(x => { });
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.ir.txt
new file mode 100644
index 0000000000..c67fddb05a
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.ir.txt
@@ -0,0 +1,27 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [31] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [11] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - x => { }
+ IntermediateToken - - CSharp - )
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt
new file mode 100644
index 0000000000..2da1e51570
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+|x => { }|
+Generated Location: (1005:24,136 [8] )
+|x => { }|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs
new file mode 100644
index 0000000000..4c994b80df
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs
@@ -0,0 +1,37 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ __o = Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(OnClick);
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ void OnClick(UIMouseEventArgs e) {
+ }
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.ir.txt
new file mode 100644
index 0000000000..1637168f24
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.ir.txt
@@ -0,0 +1,31 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
+ IntermediateToken - - CSharp - )
+ HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIMouseEventArgs e) {\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt
new file mode 100644
index 0000000000..646a3d5f65
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt
@@ -0,0 +1,16 @@
+Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+|OnClick|
+Generated Location: (1005:24,136 [7] )
+|OnClick|
+
+Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ void OnClick(UIMouseEventArgs e) {
+ }
+|
+Generated Location: (1128:28,12 [49] )
+|
+ void OnClick(UIMouseEventArgs e) {
+ }
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs
new file mode 100644
index 0000000000..7a84a849de
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs
@@ -0,0 +1,37 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ __o = Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(OnClick);
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ void OnClick() {
+ }
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.ir.txt
new file mode 100644
index 0000000000..09083f3dec
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.ir.txt
@@ -0,0 +1,31 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
+ IntermediateToken - - CSharp - )
+ HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick() {\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt
new file mode 100644
index 0000000000..c6fefa55b1
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt
@@ -0,0 +1,16 @@
+Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+|OnClick|
+Generated Location: (1005:24,136 [7] )
+|OnClick|
+
+Source Location: (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ void OnClick() {
+ }
+|
+Generated Location: (1128:28,12 [31] )
+|
+ void OnClick() {
+ }
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs
new file mode 100644
index 0000000000..2b38a71db1
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs
@@ -0,0 +1,30 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ __o = Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(() => { });
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.ir.txt
new file mode 100644
index 0000000000..af1e2ba553
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.ir.txt
@@ -0,0 +1,27 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [32] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - () => { }
+ IntermediateToken - - CSharp - )
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt
new file mode 100644
index 0000000000..8e4e60f6b0
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+|() => { }|
+Generated Location: (1005:24,136 [9] )
+|() => { }|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
new file mode 100644
index 0000000000..60ed593377
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -0,0 +1,34 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
+__o = "My value";
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt
new file mode 100644
index 0000000000..b39e7880dd
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt
@@ -0,0 +1,28 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpExpression - (2:0,2 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (2:0,2 [10] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "My value"
+ HtmlContent - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlElement - (17:2,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (21:2,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (21:2,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt
new file mode 100644
index 0000000000..fb7c9fa184
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (2:0,2 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+|"My value"|
+Generated Location: (926:25,6 [10] )
+|"My value"|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..37a3009656
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
@@ -0,0 +1,36 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.ir.txt
new file mode 100644
index 0000000000..2e241fc492
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.ir.txt
@@ -0,0 +1,30 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n \n
+ ComponentExtensionNode - (36:2,0 [22] x:\dir\subdir\Test\TestComponent.cshtml) - SomeOtherComponent - Test.SomeOtherComponent
+ HtmlContent - (58:2,22 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (58:2,22 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlElement - (62:4,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (66:4,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (66:4,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..75b2c90a92
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs
new file mode 100644
index 0000000000..aa179a2ea6
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs
@@ -0,0 +1,33 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
+using System;
+
+#line default
+#line hidden
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.ir.txt
new file mode 100644
index 0000000000..bd386d9345
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.ir.txt
@@ -0,0 +1,26 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (1:0,1 [12] x:\dir\subdir\Test\TestComponent.cshtml) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlElement - (17:2,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (21:2,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (21:2,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.mappings.txt
new file mode 100644
index 0000000000..35951811e5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (1:0,1 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+|using System|
+Generated Location: (140:6,0 [12] )
+|using System|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..c1814adecd
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
@@ -0,0 +1,44 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "Header", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ builder.AddAttribute(-1, "Footer", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = "bye!";
+
+#line default
+#line hidden
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..237f236559
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt
@@ -0,0 +1,31 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentExtensionNode - (31:1,0 [87] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (50:2,4 [20] x:\dir\subdir\Test\TestComponent.cshtml) - Header
+ HtmlContent - (58:2,12 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (58:2,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hi!
+ ComponentChildContent - (76:3,4 [26] x:\dir\subdir\Test\TestComponent.cshtml) - Footer
+ CSharpExpression - (86:3,14 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:3,14 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "bye!"
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..bc5f908a26
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
+Source Location: (86:3,14 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+|"bye!"|
+Generated Location: (1301:33,14 [6] )
+|"bye!"|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
index 8e50513756..6cf479f40e 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
@@ -31,7 +31,7 @@ global::System.Object __typeHelper = "*, TestAssembly";
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = context.Name;
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
index 4f631de376..9d437ce2d4 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
@@ -10,16 +10,16 @@ Generated Location: (1039:29,2 [35] )
Source Location: (77:1,44 [12] x:\dir\subdir\Test\TestComponent.cshtml)
|context.Name|
-Generated Location: (1240:35,44 [12] )
+Generated Location: (1231:35,44 [12] )
|context.Name|
Source Location: (95:1,62 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1414:41,62 [2] )
+Generated Location: (1405:41,62 [2] )
|; |
Source Location: (130:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|template|
-Generated Location: (1610:47,30 [8] )
+Generated Location: (1601:47,30 [8] )
|template|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
index d21e72efaf..f07f1324ca 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
@@ -27,24 +27,24 @@ global::System.Object __typeHelper = "*, TestAssembly";
{
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment template =
+ RenderFragment template = (context) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- __o = context.Index;
+ __o = context.Index;
#line default
#line hidden
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- __o = context.Item.ToLower();
+ __o = context.Item.ToLower();
#line default
#line hidden
}
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
index 3541c5d421..62076ad6d3 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
@@ -22,23 +22,23 @@ Document -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template =
- Template - (77:1,44 [48] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (77:1,44 [50] x:\dir\subdir\Test\TestComponent.cshtml) - li
- HtmlContent - (81:1,48 [1] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (81:1,48 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
- CSharpExpression - (83:1,50 [13] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (83:1,50 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Index
- HtmlContent - (96:1,63 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (96:1,63 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \-
- CSharpExpression - (100:1,67 [22] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (100:1,67 [22] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Item.ToLower()
- CSharpCode - (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
- ComponentExtensionNode - (132:2,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (155:2,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Template - Template
- CSharpExpression - (156:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (156:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
- HtmlContent - (167:2,35 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (167:2,35 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template = (context) =>
+ Template - (90:1,57 [48] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (90:1,57 [50] x:\dir\subdir\Test\TestComponent.cshtml) - li
+ HtmlContent - (94:1,61 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (94:1,61 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
+ CSharpExpression - (96:1,63 [13] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (96:1,63 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Index
+ HtmlContent - (109:1,76 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (109:1,76 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \-
+ CSharpExpression - (113:1,80 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (113:1,80 [22] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Item.ToLower()
+ CSharpCode - (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (145:2,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (168:2,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Template - Template
+ CSharpExpression - (169:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (169:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
+ HtmlContent - (180:2,35 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (180:2,35 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
index 38cefa4950..09183888bc 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
@@ -3,28 +3,28 @@ Source Location: (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (558:16,37 [17] )
|"*, TestAssembly"|
-Source Location: (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml)
-| RenderFragment template = |
-Generated Location: (1039:29,2 [41] )
-| RenderFragment template = |
+Source Location: (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment template = (context) => |
+Generated Location: (1039:29,2 [54] )
+| RenderFragment template = (context) => |
-Source Location: (83:1,50 [13] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (96:1,63 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|context.Index|
-Generated Location: (1252:35,50 [13] )
+Generated Location: (1269:35,63 [13] )
|context.Index|
-Source Location: (100:1,67 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (113:1,80 [22] x:\dir\subdir\Test\TestComponent.cshtml)
|context.Item.ToLower()|
-Generated Location: (1417:40,67 [22] )
+Generated Location: (1447:40,80 [22] )
|context.Item.ToLower()|
-Source Location: (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1633:46,94 [2] )
+Generated Location: (1676:46,107 [2] )
|; |
-Source Location: (156:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (169:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|template|
-Generated Location: (1824:52,24 [8] )
+Generated Location: (1867:52,24 [8] )
|template|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
index 4082d38712..b89987f9ad 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
@@ -28,14 +28,14 @@ global::System.Object __typeHelper = "*, TestAssembly";
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment p = (person) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
__o = Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.Name
+ person.Name
#line default
#line hidden
@@ -45,7 +45,7 @@ global::System.Object __typeHelper = "*, TestAssembly";
));
}
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
index fce1ae8629..5757b61821 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
@@ -22,15 +22,15 @@ Document -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p =
- Template - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml) - div
- ComponentExtensionNode - (74:2,37 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (93:2,56 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
- CSharpExpression - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- CSharpCode - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
- CSharpCode - (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
+ CSharpCode - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p = (person) =>
+ Template - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ ComponentExtensionNode - (86:2,49 [34] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (105:2,68 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
+ CSharpExpression - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
+ CSharpCode - (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
index 84665112d5..0d3c926dc3 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
@@ -3,33 +3,33 @@ Source Location: (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (558:16,37 [17] )
|"*, TestAssembly"|
-Source Location: (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
|
- RenderFragment p = |
-Generated Location: (1039:29,2 [33] )
+ RenderFragment p = (person) => |
+Generated Location: (1039:29,2 [45] )
|
- RenderFragment p = |
+ RenderFragment p = (person) => |
-Source Location: (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
-|context.Name|
-Generated Location: (1354:37,57 [12] )
-|context.Name|
+Source Location: (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1369:37,69 [11] )
+|person.Name|
-Source Location: (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1723:47,78 [3] )
+Generated Location: (1748:47,89 [3] )
|;
|
-Source Location: (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
public string Name { get; set; }
}
|
-Generated Location: (1869:54,12 [76] )
+Generated Location: (1894:54,12 [76] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
index 30475cf8a9..47d4f7a8c4 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
@@ -28,14 +28,14 @@ global::System.Object __typeHelper = "*, TestAssembly";
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment p = (person) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
__o = Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.Name
+ person.Name
#line default
#line hidden
@@ -45,7 +45,7 @@ global::System.Object __typeHelper = "*, TestAssembly";
));
}
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
index 7d07d0fb6c..a8f64cd644 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
@@ -22,24 +22,25 @@ Document -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p =
- Template - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml) - div
- ComponentExtensionNode - (74:2,37 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (93:2,56 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
- CSharpExpression - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- CSharpCode - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
- ComponentExtensionNode - (121:4,0 [49] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlContent - (134:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (134:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpExpression - (138:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (138:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "hello, world!"
- HtmlContent - (154:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (154:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- HtmlContent - (170:6,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (170:6,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
- CSharpCode - (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
+ CSharpCode - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p = (person) =>
+ Template - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ ComponentExtensionNode - (86:2,49 [34] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (105:2,68 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
+ CSharpExpression - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
+ ComponentExtensionNode - (132:4,0 [49] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (145:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (145:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpExpression - (149:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (149:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "hello, world!"
+ HtmlContent - (165:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (165:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlContent - (181:6,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (181:6,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ CSharpCode - (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
index a185a62885..d053ab758b 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
@@ -3,38 +3,38 @@ Source Location: (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (558:16,37 [17] )
|"*, TestAssembly"|
-Source Location: (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
|
- RenderFragment p = |
-Generated Location: (1039:29,2 [33] )
+ RenderFragment p = (person) => |
+Generated Location: (1039:29,2 [45] )
|
- RenderFragment p = |
+ RenderFragment p = (person) => |
-Source Location: (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
-|context.Name|
-Generated Location: (1354:37,57 [12] )
-|context.Name|
+Source Location: (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1369:37,69 [11] )
+|person.Name|
-Source Location: (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1723:47,78 [3] )
+Generated Location: (1748:47,89 [3] )
|;
|
-Source Location: (138:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (149:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|"hello, world!"|
-Generated Location: (1929:53,6 [15] )
+Generated Location: (1954:53,6 [15] )
|"hello, world!"|
-Source Location: (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
public string Name { get; set; }
}
|
-Generated Location: (2122:62,12 [76] )
+Generated Location: (2147:62,12 [76] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
new file mode 100644
index 0000000000..d0607a92b3
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
@@ -0,0 +1,60 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment template = (person) =>
+
+#line default
+#line hidden
+ (builder2) => {
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = person.Name;
+
+#line default
+#line hidden
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ __o = new Microsoft.AspNetCore.Blazor.RenderFragment(
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ template
+
+#line default
+#line hidden
+ );
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt
new file mode 100644
index 0000000000..78cc76ac69
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt
@@ -0,0 +1,38 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml) - "*, TestAssembly"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template = (person) =>
+ Template - (83:1,50 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (83:1,50 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (89:1,56 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (89:1,56 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (111:2,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (140:2,29 [9] x:\dir\subdir\Test\TestComponent.cshtml) - PersonTemplate - PersonTemplate
+ CSharpExpression - (141:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (141:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
+ HtmlContent - (152:2,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (152:2,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
new file mode 100644
index 0000000000..44cfddf80b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
@@ -0,0 +1,25 @@
+Source Location: (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml)
+|"*, TestAssembly"|
+Generated Location: (558:16,37 [17] )
+|"*, TestAssembly"|
+
+Source Location: (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment template = (person) => |
+Generated Location: (1039:29,2 [47] )
+| RenderFragment template = (person) => |
+
+Source Location: (89:1,56 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1255:35,56 [11] )
+|person.Name|
+
+Source Location: (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1439:41,73 [2] )
+|; |
+
+Source Location: (141:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+|template|
+Generated Location: (1635:47,30 [8] )
+|template|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
new file mode 100644
index 0000000000..a590086a8b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
@@ -0,0 +1,52 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
+__o = RenderPerson((person) => (builder2) => {
+#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = person.Name;
+
+#line default
+#line hidden
+}
+);
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt
new file mode 100644
index 0000000000..c8db0f08eb
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt
@@ -0,0 +1,32 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpExpression - (1:0,1 [48] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (1:0,1 [25] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderPerson((person) =>
+ Template - (27:0,27 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (27:0,27 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ IntermediateToken - (50:0,50 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - )
+ HtmlContent - (51:0,51 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (51:0,51 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n\n object RenderPerson(RenderFragment p) => null;\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
new file mode 100644
index 0000000000..dd80c12c60
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
@@ -0,0 +1,34 @@
+Source Location: (1:0,1 [25] x:\dir\subdir\Test\TestComponent.cshtml)
+|RenderPerson((person) => |
+Generated Location: (926:25,6 [25] )
+|RenderPerson((person) => |
+
+Source Location: (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1052:27,33 [11] )
+|person.Name|
+
+Source Location: (50:0,50 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+|)|
+Generated Location: (1100:32,0 [1] )
+|)|
+
+Source Location: (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+|
+Generated Location: (1247:39,12 [138] )
+|
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
index 968f7ca5b8..08f3ab4473 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
@@ -24,19 +24,19 @@ namespace Test
base.BuildRenderTree(builder);
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment p = (person) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- __o = context.Name;
+ __o = person.Name;
#line default
#line hidden
}
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.ir.txt
index 28e58777c7..0daa3f2173 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.ir.txt
@@ -19,13 +19,13 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- CSharpCode - (2:0,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (2:0,2 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p =
- Template - (36:1,32 [23] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (36:1,32 [24] x:\dir\subdir\Test\TestComponent.cshtml) - div
- CSharpExpression - (42:1,38 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (42:1,38 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- CSharpCode - (60:1,56 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (60:1,56 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
- CSharpCode - (78:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (78:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
+ CSharpCode - (2:0,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (2:0,2 [45] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p = (person) =>
+ Template - (48:1,44 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (48:1,44 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (54:1,50 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (54:1,50 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (71:1,67 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (71:1,67 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
+ CSharpCode - (89:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (89:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
index 54db326ba9..ad61715d04 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
@@ -1,30 +1,30 @@
-Source Location: (2:0,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (2:0,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
|
- RenderFragment p = |
-Generated Location: (922:25,2 [33] )
+ RenderFragment p = (person) => |
+Generated Location: (922:25,2 [45] )
|
- RenderFragment p = |
+ RenderFragment p = (person) => |
-Source Location: (42:1,38 [12] x:\dir\subdir\Test\TestComponent.cshtml)
-|context.Name|
-Generated Location: (1115:32,38 [12] )
-|context.Name|
+Source Location: (54:1,50 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1130:32,50 [11] )
+|person.Name|
-Source Location: (60:1,56 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (71:1,67 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1283:38,56 [3] )
+Generated Location: (1308:38,67 [3] )
|;
|
-Source Location: (78:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (89:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
public string Name { get; set; }
}
|
-Generated Location: (1429:45,12 [76] )
+Generated Location: (1454:45,12 [76] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
index 7de4a55463..ccf68e72b2 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
@@ -23,9 +23,9 @@ namespace Test
{
base.BuildRenderTree(builder);
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
-__o = RenderPerson((builder2, context) => {
+__o = RenderPerson((person) => (builder2) => {
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- __o = context.Name;
+ __o = person.Name;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.ir.txt
index 6f2bc6c9ad..bda53687d1 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.ir.txt
@@ -19,14 +19,14 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- CSharpExpression - (2:0,2 [37] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (2:0,2 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderPerson(
- Template - (16:0,16 [23] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (16:0,16 [24] x:\dir\subdir\Test\TestComponent.cshtml) - div
- CSharpExpression - (22:0,22 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (22:0,22 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- IntermediateToken - (40:0,40 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - )
- HtmlContent - (42:0,42 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (42:0,42 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (56:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (56:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n\n object RenderPerson(RenderFragment p) => null;\n
+ CSharpExpression - (2:0,2 [48] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (2:0,2 [25] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderPerson((person) =>
+ Template - (28:0,28 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (28:0,28 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (34:0,34 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (34:0,34 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ IntermediateToken - (51:0,51 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - )
+ HtmlContent - (53:0,53 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (53:0,53 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (67:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (67:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n\n object RenderPerson(RenderFragment p) => null;\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
index 31784c6e77..fd279ffbcb 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
@@ -1,19 +1,19 @@
-Source Location: (2:0,2 [13] x:\dir\subdir\Test\TestComponent.cshtml)
-|RenderPerson(|
-Generated Location: (926:25,6 [13] )
-|RenderPerson(|
+Source Location: (2:0,2 [25] x:\dir\subdir\Test\TestComponent.cshtml)
+|RenderPerson((person) => |
+Generated Location: (926:25,6 [25] )
+|RenderPerson((person) => |
-Source Location: (22:0,22 [12] x:\dir\subdir\Test\TestComponent.cshtml)
-|context.Name|
-Generated Location: (1038:27,22 [12] )
-|context.Name|
+Source Location: (34:0,34 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+|person.Name|
+Generated Location: (1053:27,34 [11] )
+|person.Name|
-Source Location: (40:0,40 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (51:0,51 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|)|
-Generated Location: (1087:32,0 [1] )
+Generated Location: (1101:32,0 [1] )
|)|
-Source Location: (56:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (67:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
@@ -22,7 +22,7 @@ Source Location: (56:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
object RenderPerson(RenderFragment p) => null;
|
-Generated Location: (1234:39,12 [138] )
+Generated Location: (1248:39,12 [138] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.codegen.cs
index b58d53d9d5..db863eb6bb 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.codegen.cs
@@ -23,7 +23,7 @@ namespace Test
{
base.BuildRenderTree(builder);
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
-__o = RenderPerson((builder2, context) => {
+__o = RenderPerson((builder2) => {
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = context.Name;
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.mappings.txt
index 02adc91104..99bbf63272 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_InImplicitExpression/TestComponent.mappings.txt
@@ -5,12 +5,12 @@ Generated Location: (926:25,6 [13] )
Source Location: (21:0,21 [12] x:\dir\subdir\Test\TestComponent.cshtml)
|context.Name|
-Generated Location: (1037:27,21 [12] )
+Generated Location: (1028:27,21 [12] )
|context.Name|
Source Location: (39:0,39 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|)|
-Generated Location: (1086:32,0 [1] )
+Generated Location: (1077:32,0 [1] )
|)|
Source Location: (54:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
@@ -22,7 +22,7 @@ Source Location: (54:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
object RenderPerson(RenderFragment p) => null;
|
-Generated Location: (1233:39,12 [138] )
+Generated Location: (1224:39,12 [138] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs
new file mode 100644
index 0000000000..7a58682253
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs
@@ -0,0 +1,55 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment template =
+
+#line default
+#line hidden
+ (builder2) => {
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ __o =
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ template
+
+#line default
+#line hidden
+ ;
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.ir.txt
new file mode 100644
index 0000000000..e84c84fa27
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.ir.txt
@@ -0,0 +1,38 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml) - "*, TestAssembly"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (35:1,2 [27] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [27] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template =
+ Template - (63:1,30 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (63:1,30 [15] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlContent - (68:1,35 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (68:1,35 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Joey
+ CSharpCode - (78:1,45 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (78:1,45 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (83:2,0 [33] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - - Person -
+ CSharpExpression - (104:2,21 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (105:2,22 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
+ HtmlContent - (116:2,33 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (116:2,33 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.mappings.txt
new file mode 100644
index 0000000000..659c7d4ab7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.mappings.txt
@@ -0,0 +1,20 @@
+Source Location: (14:0,14 [17] x:\dir\subdir\Test\TestComponent.cshtml)
+|"*, TestAssembly"|
+Generated Location: (558:16,37 [17] )
+|"*, TestAssembly"|
+
+Source Location: (35:1,2 [27] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment template = |
+Generated Location: (1039:29,2 [27] )
+| RenderFragment template = |
+
+Source Location: (78:1,45 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1239:36,45 [2] )
+|; |
+
+Source Location: (105:2,22 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+|template|
+Generated Location: (1367:42,22 [8] )
+|template|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs
new file mode 100644
index 0000000000..d6048816b1
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs
@@ -0,0 +1,42 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
+__o = RenderPerson((builder2) => {
+}
+);
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ object RenderPerson(RenderFragment p) => null;
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.ir.txt
new file mode 100644
index 0000000000..d9beb963b4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.ir.txt
@@ -0,0 +1,32 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpExpression - (1:0,1 [27] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (1:0,1 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderPerson(
+ Template - (15:0,15 [13] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (15:0,15 [13] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlContent - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - HI
+ IntermediateToken - (28:0,28 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - )
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (43:1,12 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (43:1,12 [54] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n object RenderPerson(RenderFragment p) => null;\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt
new file mode 100644
index 0000000000..64452dbc9c
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt
@@ -0,0 +1,19 @@
+Source Location: (1:0,1 [13] x:\dir\subdir\Test\TestComponent.cshtml)
+|RenderPerson(|
+Generated Location: (926:25,6 [13] )
+|RenderPerson(|
+
+Source Location: (28:0,28 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+|)|
+Generated Location: (959:27,0 [1] )
+|)|
+
+Source Location: (43:1,12 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ object RenderPerson(RenderFragment p) => null;
+|
+Generated Location: (1106:34,12 [54] )
+|
+ object RenderPerson(RenderFragment p) => null;
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.codegen.cs
new file mode 100644
index 0000000000..6119cd65df
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.codegen.cs
@@ -0,0 +1,29 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.ir.txt
new file mode 100644
index 0000000000..6305970ba5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/ScriptTag_WithErrorSuppressed/TestComponent.ir.txt
@@ -0,0 +1,37 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [144] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlContent - (5:0,5 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (5:0,5 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlElement - (11:1,4 [125] x:\dir\subdir\Test\TestComponent.cshtml) - script
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - some/url.js
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html -
+ HtmlContent - (78:1,71 [49] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (78:1,71 [49] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n some text\n some more text\n
+ HtmlContent - (136:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (136:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlContent - (144:5,6 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:5,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
new file mode 100644
index 0000000000..4885f2d2c4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -0,0 +1,34 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+__o = "My value";
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt
new file mode 100644
index 0000000000..69d6d4daa9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt
@@ -0,0 +1,30 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (4:0,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (4:0,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
+ HtmlContent - (14:0,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (14:0,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ CSharpExpression - (20:2,2 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (20:2,2 [10] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "My value"
+ HtmlContent - (31:2,13 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (31:2,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt
new file mode 100644
index 0000000000..c0996e985f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (20:2,2 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+|"My value"|
+Generated Location: (926:25,6 [10] )
+|"My value"|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..37a3009656
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.codegen.cs
@@ -0,0 +1,36 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, TestAssembly";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ }
+ ));
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt
new file mode 100644
index 0000000000..9a88c5efea
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt
@@ -0,0 +1,32 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml) - *, TestAssembly
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlElement - (31:1,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (35:1,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
+ HtmlContent - (45:1,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (45:1,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ ComponentExtensionNode - (49:3,0 [22] x:\dir\subdir\Test\TestComponent.cshtml) - SomeOtherComponent - Test.SomeOtherComponent
+ HtmlContent - (71:3,22 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (71:3,22 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..75b2c90a92
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (14:0,14 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+|*, TestAssembly|
+Generated Location: (559:16,38 [15] )
+|*, TestAssembly|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.codegen.cs
new file mode 100644
index 0000000000..44ab249f7e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.codegen.cs
@@ -0,0 +1,34 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ [Microsoft.AspNetCore.Blazor.Components.RouteAttribute("/my/url")]
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "/my/url";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt
new file mode 100644
index 0000000000..928f611cd5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt
@@ -0,0 +1,30 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
+ RouteAttributeExtensionNode - - /my/url
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ DesignTimeDirective -
+ DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
+ DirectiveToken - (14:0,14 [9] ) - "*, Test"
+ DirectiveToken - (24:2,6 [9] x:\dir\subdir\Test\TestComponent.cshtml) - "/my/url"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ HtmlElement - (0:0,0 [14] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (4:0,4 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (4:0,4 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
+ HtmlContent - (14:0,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (14:0,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlContent - (35:3,0 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:3,0 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.mappings.txt
new file mode 100644
index 0000000000..cba8722d11
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/DesignTimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (24:2,6 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+|"/my/url"|
+Generated Location: (630:17,37 [9] )
+|"/my/url"|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..3472503d55
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
@@ -0,0 +1,44 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment header = (context) =>
+
+#line default
+#line hidden
+ (builder2) => {
+ builder2.OpenElement(0, "div");
+ builder2.AddContent(1, context.ToLowerInvariant());
+ builder2.CloseElement();
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ builder.OpenComponent(2);
+ builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Blazor.RenderFragment(header));
+ builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(5, "\n Some Content\n");
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..7a970ce612
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.ir.txt
@@ -0,0 +1,27 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpCode - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment header = (context) =>
+ Template - (80:1,49 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (80:1,49 [38] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ CSharpCode - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (123:2,0 [62] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (151:2,28 [20] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (151:2,28 [20] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some Content\n
+ ComponentAttributeExtensionNode - (143:2,20 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Header - Header
+ CSharpExpression - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - header
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..cbaabc54dc
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment header = (context) => |
+Generated Location: (654:18,2 [46] )
+| RenderFragment header = (context) => |
+
+Source Location: (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1075:28,87 [2] )
+|; |
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..180d2f0cf5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
@@ -0,0 +1,48 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment header = (context) =>
+
+#line default
+#line hidden
+ (builder2) => {
+ builder2.OpenElement(0, "div");
+ builder2.AddContent(1, context.ToLowerInvariant());
+ builder2.CloseElement();
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ builder.OpenComponent(2);
+ builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Blazor.RenderFragment(header));
+ builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(5, "Some Content");
+ }
+ ));
+ builder.AddAttribute(6, "Footer", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(7, "Bye!");
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..91d66478eb
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.ir.txt
@@ -0,0 +1,30 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpCode - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment header = (context) =>
+ Template - (80:1,49 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (80:1,49 [38] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:1,55 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ CSharpCode - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (123:2,0 [114] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (155:3,2 [41] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (169:3,16 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (169:3,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some Content
+ ComponentChildContent - (200:4,2 [21] x:\dir\subdir\Test\TestComponent.cshtml) - Footer
+ HtmlContent - (208:4,10 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (208:4,10 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Bye!
+ ComponentAttributeExtensionNode - (143:2,20 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Header - Header
+ CSharpExpression - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:2,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - header
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
new file mode 100644
index 0000000000..cbaabc54dc
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (33:1,2 [46] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment header = (context) => |
+Generated Location: (654:18,2 [46] )
+| RenderFragment header = (context) => |
+
+Source Location: (118:1,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1075:28,87 [2] )
+|; |
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
index ef778dd366..53b69a78d0 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithChildContent/TestComponent.ir.txt
@@ -11,9 +11,10 @@ Document -
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
ComponentExtensionNode - (31:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
- HtmlBlock - - Nested text
+ ComponentChildContent - - ChildContent
+ HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
+ HtmlBlock - - Nested text
ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
index a232d19fb4..52c0670d90 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithElementOnlyChildContent/TestComponent.ir.txt
@@ -11,4 +11,5 @@ Document -
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
ComponentExtensionNode - (31:1,0 [47] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlBlock - - hello
+ ComponentChildContent - - ChildContent
+ HtmlBlock - - hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..1f212fdd04
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.codegen.cs
@@ -0,0 +1,28 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.OpenComponent(0);
+ builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(2, "hello");
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..eb26477cfa
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitChildContent/TestComponent.ir.txt
@@ -0,0 +1,16 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ ComponentExtensionNode - (31:1,0 [61] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (44:1,13 [34] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (58:1,27 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (58:1,27 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - hello
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..d14c503d76
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
@@ -0,0 +1,28 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.OpenComponent(0);
+ builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((context) => (builder2) => {
+ builder2.AddContent(2, context);
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..eb9f83e603
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.ir.txt
@@ -0,0 +1,16 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ ComponentExtensionNode - (31:1,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (44:1,13 [37] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ CSharpExpression - (59:1,28 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (59:1,28 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..5bbf681fec
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
@@ -0,0 +1,33 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.OpenComponent(0);
+ builder.AddAttribute(1, "MyAttr", "abc");
+ builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((context) => (builder2) => {
+ builder2.AddContent(3, "Some text");
+ builder2.OpenElement(4, "some-child");
+ builder2.AddAttribute(5, "a", "1");
+ builder2.AddContent(6, context.ToLowerInvariant());
+ builder2.CloseElement();
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..d5911f9d84
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.ir.txt
@@ -0,0 +1,25 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ ComponentExtensionNode - (31:1,0 [107] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (57:1,26 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Some text
+ HtmlElement - (66:1,35 [58] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - 1
+ CSharpExpression - (85:1,54 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (85:1,54 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.ToLowerInvariant()
+ ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
+ HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
new file mode 100644
index 0000000000..476e4d4103
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
@@ -0,0 +1,34 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.OpenComponent(0);
+ builder.AddAttribute(1, "MyAttr", "abc");
+ builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Blazor.RenderFragment)((item) => (builder2) => {
+ builder2.AddContent(3, "\n Some text");
+ builder2.OpenElement(4, "some-child");
+ builder2.AddAttribute(5, "a", "1");
+ builder2.AddContent(6, item.ToLowerInvariant());
+ builder2.CloseElement();
+ builder2.AddContent(7, "\n ");
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt
new file mode 100644
index 0000000000..611158ed29
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.ir.txt
@@ -0,0 +1,27 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ ComponentExtensionNode - (31:1,0 [164] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (61:2,2 [118] x:\dir\subdir\Test\TestComponent.cshtml) - ChildContent
+ HtmlContent - (90:2,31 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (90:2,31 [15] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some text
+ HtmlElement - (105:3,13 [55] x:\dir\subdir\Test\TestComponent.cshtml) - some-child
+ HtmlAttribute - - -
+ HtmlAttributeValue - -
+ IntermediateToken - - Html - 1
+ CSharpExpression - (124:3,32 [23] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (124:3,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - item.ToLowerInvariant()
+ HtmlContent - (160:3,68 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (160:3,68 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ ComponentAttributeExtensionNode - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - MyAttr - MyAttr
+ HtmlContent - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (52:1,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - abc
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
index ff75de6c6a..e480e46328 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.codegen.cs
@@ -32,6 +32,7 @@ namespace Test
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
index 7c5be1da8c..985d13d3be 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.ir.txt
@@ -18,5 +18,5 @@ Document -
ComponentAttributeExtensionNode - - ParamAfter -
HtmlContent - (94:1,63 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (94:1,63 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
- CSharpCode - (119:3,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (119:3,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n
+ CSharpCode - (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
index c57c9d55d1..fad95126c6 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef/TestComponent.mappings.txt
@@ -3,12 +3,14 @@ Source Location: (70:1,39 [10] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (940:22,39 [10] )
|myInstance|
-Source Location: (119:3,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (119:3,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
-Generated Location: (1194:32,12 [44] )
+Generated Location: (1194:32,12 [104] )
|
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs
index 3b9e68efaa..644cfa4c4d 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.codegen.cs
@@ -36,6 +36,7 @@ namespace Test
#line 6 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt
index a24b6860a7..b3af27df44 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.ir.txt
@@ -11,12 +11,13 @@ Document -
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
ComponentExtensionNode - (31:1,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlContent - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some
- HtmlBlock - - further content\n
+ ComponentChildContent - - ChildContent
+ HtmlContent - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (76:1,45 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Some
+ HtmlBlock - - further content\n
RefExtensionNode - (49:1,18 [10] x:\dir\subdir\Test\TestComponent.cshtml) - myInstance - Test.MyComponent
ComponentAttributeExtensionNode - - SomeProp -
HtmlContent - (71:1,40 [3] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (71:1,40 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - val
- CSharpCode - (143:5,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (143:5,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n
+ CSharpCode - (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt
index 0c8c2b2eb6..b7b4f8d3cd 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Component_WithRef_WithChildContent/TestComponent.mappings.txt
@@ -3,12 +3,14 @@ Source Location: (49:1,18 [10] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (1131:27,18 [10] )
|myInstance|
-Source Location: (143:5,12 [44] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (143:5,12 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
-Generated Location: (1385:37,12 [44] )
+Generated Location: (1385:37,12 [104] )
|
private Test.MyComponent myInstance;
+ public void Foo() { System.GC.KeepAlive(myInstance); }
|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
index d1b4f6ea12..a1da1779c2 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.codegen.cs
@@ -33,6 +33,7 @@ namespace Test
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
index 0a10abd84a..7519b928d4 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.ir.txt
@@ -20,5 +20,5 @@ Document -
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (60:0,60 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (60:0,60 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
- CSharpCode - (95:2,12 [62] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (95:2,12 [62] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Microsoft.AspNetCore.Blazor.ElementRef myElem;\n
+ CSharpCode - (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Microsoft.AspNetCore.Blazor.ElementRef myElem;\n public void Foo() { System.GC.KeepAlive(myElem); }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
index 3b8dc820bf..70f8152136 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/Element_WithRef/TestComponent.mappings.txt
@@ -3,12 +3,14 @@ Source Location: (36:0,36 [6] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (931:22,36 [6] )
|myElem|
-Source Location: (95:2,12 [62] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (95:2,12 [118] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
|
-Generated Location: (1206:33,12 [62] )
+Generated Location: (1206:33,12 [118] )
|
private Microsoft.AspNetCore.Blazor.ElementRef myElem;
+ public void Foo() { System.GC.KeepAlive(myElem); }
|
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs
index b3f3686b47..61f2ee883d 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs
@@ -8,6 +8,7 @@ namespace Test
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
{
#pragma warning disable 1998
@@ -17,10 +18,9 @@ namespace Test
builder.OpenElement(0, "input");
builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(OnClick));
builder.CloseElement();
- builder.AddContent(2, "\n");
}
#pragma warning restore 1998
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
void OnClick(UIMouseEventArgs e) {
}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.ir.txt
index ecf6331fca..2e944a3486 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.ir.txt
@@ -4,21 +4,17 @@ Document -
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
- UsingDirective - (1:0,1 [35] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- HtmlContent -
- IntermediateToken - - Html - (
- IntermediateToken - (53:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
- IntermediateToken - - CSharp - )
- HtmlContent -
- IntermediateToken - - Html - />
- HtmlContent - (64:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (64:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (78:2,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (78:2,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIMouseEventArgs e) {\n }\n
+ HtmlElement - (0:0,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
+ IntermediateToken - - CSharp - )
+ CSharpCode - (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIMouseEventArgs e) {\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt
index 2b525eee21..db716b1e55 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt
@@ -1,9 +1,9 @@
-Source Location: (78:2,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
void OnClick(UIMouseEventArgs e) {
}
|
-Generated Location: (964:23,12 [49] )
+Generated Location: (973:23,12 [49] )
|
void OnClick(UIMouseEventArgs e) {
}
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs
index 7e58c05413..633aa0fc97 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs
@@ -8,6 +8,7 @@ namespace Test
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
{
#pragma warning disable 1998
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.ir.txt
index 58a90a079b..ffdd649aec 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.ir.txt
@@ -4,17 +4,15 @@ Document -
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
- UsingDirective - (1:0,1 [35] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- HtmlContent -
- IntermediateToken - - Html - (
- IntermediateToken - (54:1,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - x => { }
- IntermediateToken - - CSharp - )
- HtmlContent -
- IntermediateToken - - Html - />
+ HtmlElement - (0:0,0 [31] x:\dir\subdir\Test\TestComponent.cshtml) - input
+ HtmlAttribute - (16:0,16 [11] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
+ CSharpExpressionAttributeValue - -
+ IntermediateToken - - CSharp - Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue(
+ IntermediateToken - (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - x => { }
+ IntermediateToken - - CSharp - )
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
new file mode 100644
index 0000000000..84e1c9c51f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
@@ -0,0 +1,32 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.OpenComponent(0);
+ builder.AddAttribute(1, "Header", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(2, "Hi!");
+ }
+ ));
+ builder.AddAttribute(3, "Footer", (Microsoft.AspNetCore.Blazor.RenderFragment)((builder2) => {
+ builder2.AddContent(4, "bye!");
+ }
+ ));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt
new file mode 100644
index 0000000000..d7e62756e6
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.ir.txt
@@ -0,0 +1,19 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ ComponentExtensionNode - (31:1,0 [87] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - (50:2,4 [20] x:\dir\subdir\Test\TestComponent.cshtml) - Header
+ HtmlContent - (58:2,12 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (58:2,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hi!
+ ComponentChildContent - (76:3,4 [26] x:\dir\subdir\Test\TestComponent.cshtml) - Footer
+ CSharpExpression - (86:3,14 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (86:3,14 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "bye!"
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
index bc44e0278f..918cb0bebb 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.codegen.cs
@@ -20,7 +20,7 @@ namespace Test
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
builder2.OpenElement(0, "div");
builder2.AddContent(1, context.Name);
builder2.CloseElement();
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
index 38cba423b0..fe05054ad1 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter/TestComponent.mappings.txt
@@ -5,6 +5,6 @@ Generated Location: (654:18,2 [35] )
Source Location: (95:1,62 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1034:28,62 [2] )
+Generated Location: (1025:28,62 [2] )
|; |
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
index 48625f2519..f805d53281 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
@@ -16,11 +16,11 @@ namespace Test
{
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment template =
+ RenderFragment template = (context) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
builder2.OpenElement(0, "li");
builder2.AddContent(1, "#");
builder2.AddContent(2, context.Index);
@@ -29,7 +29,7 @@ namespace Test
builder2.CloseElement();
}
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
index 67d104b4c4..9fa7ec52e1 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.ir.txt
@@ -10,21 +10,21 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- CSharpCode - (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template =
- Template - (77:1,44 [48] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (77:1,44 [50] x:\dir\subdir\Test\TestComponent.cshtml) - li
- HtmlContent - (81:1,48 [1] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (81:1,48 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
- CSharpExpression - (83:1,50 [13] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (83:1,50 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Index
- HtmlContent - (96:1,63 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (96:1,63 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \-
- CSharpExpression - (100:1,67 [22] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (100:1,67 [22] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Item.ToLower()
- CSharpCode - (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
- ComponentExtensionNode - (132:2,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (155:2,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Template - Template
- CSharpExpression - (156:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (156:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
+ CSharpCode - (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template = (context) =>
+ Template - (90:1,57 [48] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (90:1,57 [50] x:\dir\subdir\Test\TestComponent.cshtml) - li
+ HtmlContent - (94:1,61 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (94:1,61 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
+ CSharpExpression - (96:1,63 [13] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (96:1,63 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Index
+ HtmlContent - (109:1,76 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (109:1,76 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \-
+ CSharpExpression - (113:1,80 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (113:1,80 [22] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Item.ToLower()
+ CSharpCode - (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (145:2,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (168:2,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Template - Template
+ CSharpExpression - (169:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (169:2,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
index 957f6b1cfc..23134836c8 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
@@ -1,10 +1,10 @@
-Source Location: (35:1,2 [41] x:\dir\subdir\Test\TestComponent.cshtml)
-| RenderFragment template = |
-Generated Location: (654:18,2 [41] )
-| RenderFragment template = |
+Source Location: (35:1,2 [54] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment template = (context) => |
+Generated Location: (654:18,2 [54] )
+| RenderFragment template = (context) => |
-Source Location: (127:1,94 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (140:1,107 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1231:31,94 [2] )
+Generated Location: (1248:31,107 [2] )
|; |
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
index 6048c7ea24..e5002b7870 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs
@@ -17,19 +17,19 @@ namespace Test
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment p = (person) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
builder2.OpenElement(0, "div");
builder2.OpenComponent(1);
- builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(context.Name));
+ builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(person.Name));
builder2.CloseComponent();
builder2.CloseElement();
}
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
index e4f216fe5b..a69b6bbfab 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.ir.txt
@@ -10,15 +10,15 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- CSharpCode - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p =
- Template - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml) - div
- ComponentExtensionNode - (74:2,37 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (93:2,56 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
- CSharpExpression - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- CSharpCode - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
- CSharpCode - (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
+ CSharpCode - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p = (person) =>
+ Template - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ ComponentExtensionNode - (86:2,49 [34] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (105:2,68 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
+ CSharpExpression - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
+ CSharpCode - (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
index 58511127b8..d25e4e29d7 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt
@@ -1,25 +1,25 @@
-Source Location: (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
|
- RenderFragment p = |
-Generated Location: (654:18,2 [33] )
+ RenderFragment p = (person) => |
+Generated Location: (654:18,2 [45] )
|
- RenderFragment p = |
+ RenderFragment p = (person) => |
-Source Location: (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1244:31,78 [3] )
+Generated Location: (1257:31,89 [3] )
|;
|
-Source Location: (133:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (144:4,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
public string Name { get; set; }
}
|
-Generated Location: (1390:38,12 [76] )
+Generated Location: (1403:38,12 [76] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
index 674bd7003d..0775f60712 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
@@ -17,19 +17,19 @@ namespace Test
base.BuildRenderTree(builder);
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment p = (person) =>
#line default
#line hidden
- (builder2, context) => {
+ (builder2) => {
builder2.OpenElement(0, "div");
builder2.OpenComponent(1);
- builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(context.Name));
+ builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Blazor.Components.RuntimeHelpers.TypeCheck(person.Name));
builder2.CloseComponent();
builder2.CloseElement();
}
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- ;
+ ;
#line default
#line hidden
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
index a5a184e80e..359c73d681 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.ir.txt
@@ -10,22 +10,23 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree
CSharpCode -
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
- CSharpCode - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p =
- Template - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml)
- HtmlElement - (69:2,32 [46] x:\dir\subdir\Test\TestComponent.cshtml) - div
- ComponentExtensionNode - (74:2,37 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- ComponentAttributeExtensionNode - (93:2,56 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
- CSharpExpression - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (94:2,57 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context.Name
- CSharpCode - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
- ComponentExtensionNode - (121:4,0 [49] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
- HtmlContent - (134:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (134:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpExpression - (138:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (138:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "hello, world!"
- HtmlContent - (154:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (154:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
- CSharpCode - (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
- IntermediateToken - (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
+ CSharpCode - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n RenderFragment p = (person) =>
+ Template - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (81:2,44 [45] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ ComponentExtensionNode - (86:2,49 [34] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (105:2,68 [12] x:\dir\subdir\Test\TestComponent.cshtml) - Name - Name
+ CSharpExpression - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:2,69 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;\n
+ ComponentExtensionNode - (132:4,0 [49] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentChildContent - - ChildContent
+ HtmlContent - (145:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (145:4,13 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpExpression - (149:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (149:5,2 [15] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "hello, world!"
+ HtmlContent - (165:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (165:5,18 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
index a70f88f50a..d9fd813328 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
@@ -1,25 +1,25 @@
-Source Location: (35:1,2 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (35:1,2 [45] x:\dir\subdir\Test\TestComponent.cshtml)
|
- RenderFragment p = |
-Generated Location: (654:18,2 [33] )
+ RenderFragment p = (person) => |
+Generated Location: (654:18,2 [45] )
|
- RenderFragment p = |
+ RenderFragment p = (person) => |
-Source Location: (115:2,78 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (126:2,89 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1244:31,78 [3] )
+Generated Location: (1257:31,89 [3] )
|;
|
-Source Location: (186:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
+Source Location: (197:8,12 [76] x:\dir\subdir\Test\TestComponent.cshtml)
|
class Person
{
public string Name { get; set; }
}
|
-Generated Location: (1784:46,12 [76] )
+Generated Location: (1797:46,12 [76] )
|
class Person
{
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
new file mode 100644
index 0000000000..6b858cb853
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
@@ -0,0 +1,40 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ RenderFragment template = (person) =>
+
+#line default
+#line hidden
+ (builder2) => {
+ builder2.OpenElement(0, "div");
+ builder2.AddContent(1, person.Name);
+ builder2.CloseElement();
+ }
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ ;
+
+#line default
+#line hidden
+ builder.OpenComponent(2);
+ builder.AddAttribute(3, "PersonTemplate", new Microsoft.AspNetCore.Blazor.RenderFragment(template));
+ builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt
new file mode 100644
index 0000000000..319b871451
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.ir.txt
@@ -0,0 +1,24 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpCode - (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderFragment template = (person) =>
+ Template - (83:1,50 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (83:1,50 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (89:1,56 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (89:1,56 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ CSharpCode - (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ;
+ ComponentExtensionNode - (111:2,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - Test.MyComponent
+ ComponentAttributeExtensionNode - (140:2,29 [9] x:\dir\subdir\Test\TestComponent.cshtml) - PersonTemplate - PersonTemplate
+ CSharpExpression - (141:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (141:2,30 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - template
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
new file mode 100644
index 0000000000..5f8bf908da
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (35:1,2 [47] x:\dir\subdir\Test\TestComponent.cshtml)
+| RenderFragment template = (person) => |
+Generated Location: (654:18,2 [47] )
+| RenderFragment template = (person) => |
+
+Source Location: (106:1,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+|; |
+Generated Location: (1047:28,73 [2] )
+|; |
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
new file mode 100644
index 0000000000..cedb1fbd2c
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
@@ -0,0 +1,39 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Blazor;
+ using Microsoft.AspNetCore.Blazor.Components;
+ public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
+ {
+ base.BuildRenderTree(builder);
+ builder.AddContent(0, RenderPerson((person) => (builder2) => {
+ builder2.OpenElement(1, "div");
+ builder2.AddContent(2, person.Name);
+ builder2.CloseElement();
+ }
+ ));
+ }
+ #pragma warning restore 1998
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+
+#line default
+#line hidden
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt
new file mode 100644
index 0000000000..477190a5db
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.ir.txt
@@ -0,0 +1,21 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
+ UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
+ ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ CSharpCode -
+ IntermediateToken - - CSharp - base.BuildRenderTree(builder);
+ CSharpExpression - (1:0,1 [48] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (1:0,1 [25] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - RenderPerson((person) =>
+ Template - (27:0,27 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ HtmlElement - (27:0,27 [23] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ CSharpExpression - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
+ IntermediateToken - (50:0,50 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - )
+ CSharpCode - (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+ IntermediateToken - (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n class Person\n {\n public string Name { get; set; }\n }\n\n object RenderPerson(RenderFragment p) => null;\n
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
new file mode 100644
index 0000000000..cfd4eca5d3
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
@@ -0,0 +1,19 @@
+Source Location: (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+|
+Generated Location: (966:26,12 [138] )
+|
+ class Person
+ {
+ public string Name { get; set; }
+ }
+
+ object RenderPerson(RenderFragment p) => null;
+|
+
diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
index ee583ec422..e965d1304a 100644
--- a/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/TestFiles/RuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
@@ -17,17 +17,17 @@ namespace Test
base.BuildRenderTree(builder);
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderFragment p =
+ RenderFragment