+ LazyIntermediateToken - (542:16,38 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (543:16,39 [4] ConditionalAttributes2.cshtml) - Html -
+ CSharpCode - (547:16,43 [8] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (547:16,43 [8] ConditionalAttributes2.cshtml) - CSharp - \n\n
+ HtmlContent - (555:18,4 [3] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (555:18,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (581:18,30 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (582:18,31 [4] ConditionalAttributes2.cshtml) - Html -
+ CSharpCode - (586:18,35 [6] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (586:18,35 [6] ConditionalAttributes2.cshtml) - CSharp - \n
+ HtmlContent - (592:19,4 [3] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (592:19,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (638:19,50 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (639:19,51 [4] ConditionalAttributes2.cshtml) - Html -
+ CSharpCode - (643:19,55 [6] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (643:19,55 [6] ConditionalAttributes2.cshtml) - CSharp - \n
+ HtmlContent - (649:20,4 [3] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (649:20,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (670:20,25 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (671:20,26 [4] ConditionalAttributes2.cshtml) - Html -
+ CSharpCode - (675:20,30 [2] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (675:20,30 [2] ConditionalAttributes2.cshtml) - CSharp - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt
new file mode 100644
index 00000000000..6351ea88ec2
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt
@@ -0,0 +1,272 @@
+Source Location: (2:0,2 [68] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ var ch = true;
+ var cls = "bar";
+ var s = "str";
+ |
+Generated Location: (2043:39,2 [68] )
+|
+ var ch = true;
+ var cls = "bar";
+ var s = "str";
+ |
+
+Source Location: (74:4,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (2288:50,8 [1] )
+|s|
+
+Source Location: (87:4,21 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (2480:57,21 [6] )
+|
+ |
+
+Source Location: (97:5,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (2663:65,8 [1] )
+|s|
+
+Source Location: (107:5,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|cls|
+Generated Location: (2852:72,18 [3] )
+|cls|
+
+Source Location: (114:5,25 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (3050:79,25 [6] )
+|
+ |
+
+Source Location: (124:6,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (3233:87,8 [1] )
+|s|
+
+Source Location: (136:6,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|cls|
+Generated Location: (3424:94,20 [3] )
+|cls|
+
+Source Location: (143:6,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (3624:101,27 [6] )
+|
+ |
+
+Source Location: (153:7,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (3807:109,8 [1] )
+|s|
+
+Source Location: (163:7,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|cls|
+Generated Location: (3996:116,18 [3] )
+|cls|
+
+Source Location: (172:7,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (4196:123,27 [6] )
+|
+ |
+
+Source Location: (202:8,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (4399:131,28 [1] )
+|s|
+
+Source Location: (214:8,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|ch|
+Generated Location: (4610:138,40 [2] )
+|ch|
+
+Source Location: (220:8,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (4828:145,46 [6] )
+|
+ |
+
+Source Location: (250:9,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (5032:153,28 [1] )
+|s|
+
+Source Location: (264:9,42 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|ch|
+Generated Location: (5246:160,42 [2] )
+|ch|
+
+Source Location: (270:9,48 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (5467:167,48 [6] )
+|
+ |
+
+Source Location: (280:10,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (5651:175,8 [1] )
+|s|
+
+Source Location: (290:10,18 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|if(cls != null) { |
+Generated Location: (5841:182,18 [18] )
+|if(cls != null) { |
+
+Source Location: (309:10,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|cls|
+Generated Location: (6066:189,37 [3] )
+|cls|
+
+Source Location: (312:10,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+| }|
+Generated Location: (6280:196,40 [2] )
+| }|
+
+Source Location: (318:10,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (6498:203,46 [6] )
+|
+ |
+
+Source Location: (343:11,23 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (6948:213,23 [6] )
+|
+ |
+
+Source Location: (358:12,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (7137:221,13 [1] )
+|s|
+
+Source Location: (366:12,21 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|Url.Content("~/Scripts/jquery-1.6.2.min.js")|
+Generated Location: (7330:228,21 [44] )
+|Url.Content("~/Scripts/jquery-1.6.2.min.js")|
+
+Source Location: (444:12,99 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (7644:235,99 [6] )
+|
+ |
+
+Source Location: (454:13,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (7828:243,8 [1] )
+|s|
+
+Source Location: (464:13,18 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (8018:250,18 [4] )
+|null|
+
+Source Location: (472:13,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (8219:257,26 [6] )
+|
+ |
+
+Source Location: (489:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (8410:265,15 [4] )
+|null|
+
+Source Location: (496:14,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (8607:272,22 [1] )
+|s|
+
+Source Location: (500:14,26 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+
+ |
+Generated Location: (8805:279,26 [8] )
+|
+
+ |
+
+Source Location: (526:16,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (9005:288,22 [1] )
+|s|
+
+Source Location: (536:16,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (9209:295,32 [4] )
+|null|
+
+Source Location: (547:16,43 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+
+ |
+Generated Location: (9427:302,43 [8] )
+|
+
+ |
+
+Source Location: (560:18,9 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s + s|
+Generated Location: (9614:311,9 [5] )
+|s + s|
+
+Source Location: (575:18,24 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (9814:318,24 [4] )
+|null|
+
+Source Location: (586:18,35 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (10024:325,35 [6] )
+|
+ |
+
+Source Location: (597:19,9 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|if (s.Length != 0) { |
+Generated Location: (10209:333,9 [21] )
+|if (s.Length != 0) { |
+
+Source Location: (619:19,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|s|
+Generated Location: (10431:340,31 [1] )
+|s|
+
+Source Location: (620:19,32 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+| }|
+Generated Location: (10635:347,32 [2] )
+| }|
+
+Source Location: (632:19,44 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (10851:354,44 [4] )
+|null|
+
+Source Location: (643:19,55 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+ |
+Generated Location: (11081:361,55 [6] )
+|
+ |
+
+Source Location: (664:20,19 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|null|
+Generated Location: (11276:369,19 [4] )
+|null|
+
+Source Location: (675:20,30 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml)
+|
+|
+Generated Location: (11481:376,30 [2] )
+|
+|
+
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs
new file mode 100644
index 00000000000..bfdfcbda387
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs
@@ -0,0 +1,414 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ee976c57374bafda343bd6b2086b223381f842016566d5a83498a6d0cbec2f54"
+//
+ #nullable disable
+ {
+ #line hidden
+ #pragma warning disable 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ #pragma warning restore 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ #pragma warning disable 0169
+ private string __tagHelperStringValueBuffer;
+ #pragma warning restore 0169
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
+ {
+ get
+ {
+ if (__backed__tagHelperScopeManager == null)
+ {
+ __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
+ }
+ return __backed__tagHelperScopeManager;
+ }
+ }
+ private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper;
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+#nullable restore
+#line (1,3)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml"
+
+ var ch = true;
+ var cls = "bar";
+ var s = "str";
+
+#line default
+#line hidden
+#nullable disable
+
+ WriteLiteral(" \r\n \r\n \r\n \r\n \r\n \r\n {
+ PushWriter(__razor_attribute_value_writer);
+#nullable restore
+#line (11,19)-(11,37) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml"
+if(cls != null) {
+
+#line default
+#line hidden
+#nullable disable
+ Write(
+#nullable restore
+#line (11,38)-(11,41) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml"
+cls
+
+#line default
+#line hidden
+#nullable disable
+ );
+#nullable restore
+#line (11,41)-(11,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml"
+ }
+
+#line default
+#line hidden
+#nullable disable
+ PopWriter();
+ }
+ ), 289, 25, false);
+ EndWriteAttribute();
+ WriteLiteral(" />\r\n ");
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => {
+ }
+ );
+ __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ if (!__tagHelperExecutionContext.Output.IsContentModified)
+ {
+ await __tagHelperExecutionContext.SetOutputContentAsync();
+ }
+ Write(__tagHelperExecutionContext.Output);
+ __tagHelperExecutionContext = __tagHelperScopeManager.End();
+ WriteLiteral("\r\n \r\n \r\n \r\n");
+ WriteLiteral(" x
\r\n");
+ WriteLiteral(" x
\r\n x
\r\n x
\r\n");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.diagnostics.txt
new file mode 100644
index 00000000000..b26658f13b4
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml(12,8): Error RZ1031: The tag helper 'a' must not have C# in the element's attribute declaration area.
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt
new file mode 100644
index 00000000000..a3910916ddd
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt
@@ -0,0 +1,229 @@
+Document -
+ RazorCompiledItemAttribute -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [22] ) - global::System
+ UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic
+ UsingDirective - (67:2,1 [27] ) - global::System.Linq
+ UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks
+ UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc
+ UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ RazorCompiledItemMetadataAttribute -
+ CreateNewOnMetadataUpdateAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode - (2:0,2 [64] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (2:0,2 [64] ConditionalAttributes2.cshtml) - CSharp - \n var ch = true;\n var cls = "bar";\n var s = "str";\n
+ HtmlContent - (66:4,0 [7] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (66:4,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (70:4,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (87:4,21 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (89:5,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (93:5,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (114:5,25 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (116:6,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (120:6,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (143:6,27 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (145:7,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (149:7,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (172:7,27 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (174:8,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (178:8,4 [6] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (220:8,46 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (222:9,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (226:9,4 [6] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (270:9,48 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (272:10,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (276:10,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (318:10,46 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (320:11,0 [4] ConditionalAttributes2.cshtml) - Html -
+ TagHelper - (324:11,4 [19] ConditionalAttributes2.cshtml) - a - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
+ DefaultTagHelperExecute -
+ HtmlContent - (343:11,23 [14] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (343:11,23 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (345:12,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (349:12,4 [7] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (444:12,99 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (446:13,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (450:13,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (472:13,26 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (474:14,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (478:14,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (500:14,26 [2] ConditionalAttributes2.cshtml) - Html - \n
+ CSharpCode - (502:15,0 [2] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (502:15,0 [2] ConditionalAttributes2.cshtml) - CSharp - \n
+ HtmlContent - (504:16,0 [7] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (504:16,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (508:16,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (542:16,38 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (543:16,39 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (547:16,43 [2] ConditionalAttributes2.cshtml) - Html - \n
+ CSharpCode - (549:17,0 [2] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (549:17,0 [2] ConditionalAttributes2.cshtml) - CSharp - \n
+ HtmlContent - (551:18,0 [7] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (551:18,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (555:18,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (581:18,30 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (582:18,31 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (586:18,35 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (588:19,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (592:19,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (638:19,50 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (639:19,51 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (643:19,55 [2] ConditionalAttributes2.cshtml) - Html - \n
+ LazyIntermediateToken - (645:20,0 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (649:20,4 [2] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (670:20,25 [1] ConditionalAttributes2.cshtml) - Html - x
+ LazyIntermediateToken - (671:20,26 [4] ConditionalAttributes2.cshtml) - Html -
+ LazyIntermediateToken - (675:20,30 [2] ConditionalAttributes2.cshtml) - Html - \n
+ CSharpCode - (677:21,0 [0] ConditionalAttributes2.cshtml)
+ LazyIntermediateToken - (677:21,0 [0] ConditionalAttributes2.cshtml) - CSharp -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs
index ff574f914a5..569b502fc05 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs
@@ -200,6 +200,21 @@ private void __RazorDirectiveTokenHelpers__() {
#nullable restore
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
+
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 15 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
+ __o = null;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 15 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml"
+
#line default
#line hidden
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html
index 34c5024a53f..323da7fe613 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html
@@ -12,4 +12,5 @@
-~
\ No newline at end of file
+
+~
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.html.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.html.mappings.txt
index 25185818f66..5630f45dd41 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.html.mappings.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.html.mappings.txt
@@ -93,3 +93,20 @@ Source Location: (527:13,4 [111] TestFiles/IntegrationTests/CodeGenerationIntegr
Generated Location: (527:13,4 [111] )
||
+Source Location: (644:14,4 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
+||
+Generated Location: (659:14,19 [4] )
+|" />|
+
+Source Location: (666:15,1 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
+|
+|
+Generated Location: (666:15,1 [2] )
+|
+|
+
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt
index 1281fd038c2..bcdf748d694 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt
@@ -151,8 +151,18 @@
LazyIntermediateToken - (605:13,82 [23] ConditionalAttributes.cshtml) - Html - type="text/javascript"
LazyIntermediateToken - (628:13,105 [1] ConditionalAttributes.cshtml) - Html - >
LazyIntermediateToken - (629:13,106 [9] ConditionalAttributes.cshtml) - Html -
- CSharpCode - (638:13,115 [2] ConditionalAttributes.cshtml)
- LazyIntermediateToken - (638:13,115 [2] ConditionalAttributes.cshtml) - CSharp - \n
+ CSharpCode - (638:13,115 [6] ConditionalAttributes.cshtml)
+ LazyIntermediateToken - (638:13,115 [6] ConditionalAttributes.cshtml) - CSharp - \n
+ HtmlContent - (644:14,4 [2] ConditionalAttributes.cshtml)
+ LazyIntermediateToken - (644:14,4 [2] ConditionalAttributes.cshtml) - Html -
+ CSharpCode - (663:14,23 [2] ConditionalAttributes.cshtml)
+ LazyIntermediateToken - (663:14,23 [2] ConditionalAttributes.cshtml) - CSharp - \n
Inject -
Inject -
Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt
index 06a436ff701..46e2d14236f 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt
@@ -129,10 +129,22 @@ Generated Location: (6616:193,112 [6] )
|
|
-Source Location: (638:13,115 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
+Source Location: (638:13,115 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
+|
+ |
+Generated Location: (6906:201,115 [6] )
+|
+ |
+
+Source Location: (655:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
+|null|
+Generated Location: (7096:209,15 [4] )
+|null|
+
+Source Location: (663:14,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml)
|
|
-Generated Location: (6906:201,115 [2] )
+Generated Location: (7293:216,23 [2] )
|
|
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs
index a6735c47762..c1bbb67fd09 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs
@@ -1,4 +1,4 @@
-#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "06e553c9dddd22392e81b4db3d16d097612b3552ffeaa58d015a2e3dedcf6c3a"
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ea68cb71b106404af0072bb70c04f6d73d165cf4aabc5d838b668d681625b53c"
//
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")]
@@ -14,7 +14,7 @@ namespace AspNetCore
using global::Microsoft.AspNetCore.Mvc.ViewFeatures;
#line default
#line hidden
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"Sha256", @"06e553c9dddd22392e81b4db3d16d097612b3552ffeaa58d015a2e3dedcf6c3a", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")]
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"Sha256", @"ea68cb71b106404af0072bb70c04f6d73d165cf4aabc5d838b668d681625b53c", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")]
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
#nullable restore
@@ -188,7 +188,19 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Conditiona
#nullable disable
, 426, 61, false);
EndWriteAttribute();
- WriteLiteral(" type=\"text/javascript\">\r\n \r\n");
+ WriteLiteral(" type=\"text/javascript\">\r\n \r\n \r\n");
}
#pragma warning restore 1998
#nullable restore
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt
index adc4d29b9f8..5e343b65339 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt
@@ -113,7 +113,7 @@
HtmlAttribute - (420:12,11 [68] ConditionalAttributes.cshtml) - src=" - "
CSharpExpressionAttributeValue - (426:12,17 [61] ConditionalAttributes.cshtml) -
LazyIntermediateToken - (427:12,18 [60] ConditionalAttributes.cshtml) - CSharp - Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")
- HtmlContent - (488:12,79 [152] ConditionalAttributes.cshtml)
+ HtmlContent - (488:12,79 [158] ConditionalAttributes.cshtml)
LazyIntermediateToken - (488:12,79 [23] ConditionalAttributes.cshtml) - Html - type="text/javascript"
LazyIntermediateToken - (511:12,102 [1] ConditionalAttributes.cshtml) - Html - >
LazyIntermediateToken - (512:12,103 [9] ConditionalAttributes.cshtml) - Html -
@@ -125,8 +125,17 @@
LazyIntermediateToken - (628:13,105 [1] ConditionalAttributes.cshtml) - Html - >
LazyIntermediateToken - (629:13,106 [9] ConditionalAttributes.cshtml) - Html -
LazyIntermediateToken - (638:13,115 [2] ConditionalAttributes.cshtml) - Html - \n
- CSharpCode - (640:14,0 [0] ConditionalAttributes.cshtml)
- LazyIntermediateToken - (640:14,0 [0] ConditionalAttributes.cshtml) - CSharp -
+ LazyIntermediateToken - (640:14,0 [4] ConditionalAttributes.cshtml) - Html -
+ LazyIntermediateToken - (644:14,4 [2] ConditionalAttributes.cshtml) - Html -
+ LazyIntermediateToken - (663:14,23 [2] ConditionalAttributes.cshtml) - Html - \n
+ CSharpCode - (665:15,0 [0] ConditionalAttributes.cshtml)
+ LazyIntermediateToken - (665:15,0 [0] ConditionalAttributes.cshtml) - CSharp -
Inject -
Inject -
Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt
index ddcf25c76ea..e1680c41e3d 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt
@@ -73,7 +73,8 @@
LazyIntermediateToken - (408:17,0 [6] RazorComments.cshtml) - Html -
LazyIntermediateToken - (473:17,65 [2] RazorComments.cshtml) - Html - \n
Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt
index 290deed1310..931613bfaf4 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt
@@ -54,7 +54,8 @@
LazyIntermediateToken - (408:17,0 [6] RazorComments.cshtml) - Html -
LazyIntermediateToken - (473:17,65 [2] RazorComments.cshtml) - Html - \n
Inject -
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.cspans.txt
index aa6ae7948c7..208b6b6fbb1 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.cspans.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.cspans.txt
@@ -9,4 +9,5 @@ Markup span at (51:2,25 [45] ) - Parent: Markup block at (0:0,0 [110] )
Markup span at (96:2,70 [2] ) - Parent: Tag block at (96:2,70 [14] )
Transition span at (98:2,72 [1] ) - Parent: Expression block at (98:2,72 [8] )
Code span at (99:2,73 [7] ) - Parent: Expression block at (98:2,72 [8] )
-Markup span at (106:2,80 [4] ) - Parent: Tag block at (96:2,70 [14] )
+Markup span at (106:2,80 [1] ) - Parent: Markup block at (106:2,80 [1] )
+Markup span at (107:2,81 [3] ) - Parent: Markup block at (107:2,81 [3] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.stree.txt
index 484eb659c35..9104e3483f3 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_08.stree.txt
@@ -58,7 +58,7 @@
MarkupStartTag - [96..110)::14 - [< @context;LF}] - Gen
OpenAngle;[<];
Text;[];
- MarkupMiscAttributeContent - [97..110)::13
+ MarkupMiscAttributeContent - [97..106)::9
MarkupTextLiteral - [97..98)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [98..106)::8
@@ -69,9 +69,13 @@
CSharpCodeBlock - [99..106)::7
CSharpExpressionLiteral - [99..106)::7 - [context] - Gen
Identifier;[context];
- MarkupTextLiteral - [106..110)::4 - [;LF}] - Gen
+ MarkupMinimizedAttributeBlock - [106..107)::1 - [;]
+ MarkupTextLiteral - [106..107)::1 - [;] - Gen
Text;[;];
+ MarkupMinimizedAttributeBlock - [107..110)::3 - [LF}]
+ MarkupTextLiteral - [107..109)::2 - [LF] - Gen
NewLine;[LF];
+ MarkupTextLiteral - [109..110)::1 - [}] - Gen
Text;[}];
CloseAngle;[];
EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt
index c44a546575b..46591bf7c95 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt
@@ -4,15 +4,14 @@
MarkupStartTag - [0..26)::26 - [] - Gen
OpenAngle;[<];
Text;[text];
- MarkupMiscAttributeContent - [5..25)::20
- MarkupTextLiteral - [5..6)::1 - [ ] - Gen
- Whitespace;[ ];
- RazorComment - [6..25)::19
- RazorCommentTransition;[@];
- RazorCommentStar;[*];
- RazorCommentLiteral;[ razor comment ];
- RazorCommentStar;[*];
- RazorCommentTransition;[@];
+ MarkupTextLiteral - [5..6)::1 - [ ] - Gen
+ Whitespace;[ ];
+ RazorComment - [6..25)::19
+ RazorCommentTransition;[@];
+ RazorCommentStar;[*];
+ RazorCommentLiteral;[ razor comment ];
+ RazorCommentStar;[*];
+ RazorCommentTransition;[@];
CloseAngle;[>];
MarkupEndTag - [26..33)::7 - [] - Gen
OpenAngle;[<];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.cspans.txt
new file mode 100644
index 00000000000..361925fdb9f
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.cspans.txt
@@ -0,0 +1,12 @@
+Markup span at (0:0,0 [2] ) - Parent: Tag block at (0:0,0 [30] )
+Markup span at (2:0,2 [8] ) - Parent: Markup block at (2:0,2 [11] )
+Transition span at (10:0,10 [1] ) - Parent: Expression block at (10:0,10 [2] )
+Code span at (11:0,11 [1] ) - Parent: Expression block at (10:0,10 [2] )
+Markup span at (12:0,12 [1] ) - Parent: Markup block at (2:0,2 [11] )
+Markup span at (13:0,13 [1] ) - Parent: Tag block at (0:0,0 [30] )
+Transition span at (14:0,14 [1] ) - Parent: Comment block at (14:0,14 [13] )
+MetaCode span at (15:0,15 [1] ) - Parent: Comment block at (14:0,14 [13] )
+Comment span at (16:0,16 [9] ) - Parent: Comment block at (14:0,14 [13] )
+MetaCode span at (25:0,25 [1] ) - Parent: Comment block at (14:0,14 [13] )
+Transition span at (26:0,26 [1] ) - Parent: Comment block at (14:0,14 [13] )
+Markup span at (27:0,27 [3] ) - Parent: Tag block at (0:0,0 [30] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.stree.txt
new file mode 100644
index 00000000000..99d7738a6c7
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentAfter.stree.txt
@@ -0,0 +1,41 @@
+RazorDocument - [0..30)::30 - []
+ MarkupBlock - [0..30)::30
+ MarkupElement - [0..30)::30
+ MarkupStartTag - [0..30)::30 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupAttributeBlock - [2..13)::11 - [ class="@c"]
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [3..8)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [9..10)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [10..12)::2
+ MarkupDynamicAttributeValue - [10..12)::2 - [@c]
+ GenericBlock - [10..12)::2
+ CSharpCodeBlock - [10..12)::2
+ CSharpImplicitExpression - [10..12)::2
+ CSharpTransition - [10..11)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [11..12)::1
+ CSharpCodeBlock - [11..12)::1
+ CSharpExpressionLiteral - [11..12)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [12..13)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupTextLiteral - [13..14)::1 - [ ] - Gen
+ Whitespace;[ ];
+ RazorComment - [14..27)::13
+ RazorCommentTransition;[@];
+ RazorCommentStar;[*];
+ RazorCommentLiteral;[ comment ];
+ RazorCommentStar;[*];
+ RazorCommentTransition;[@];
+ MarkupMiscAttributeContent - [27..28)::1
+ MarkupTextLiteral - [27..28)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.cspans.txt
new file mode 100644
index 00000000000..601a400d623
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.cspans.txt
@@ -0,0 +1,11 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [30] )
+Transition span at (3:0,3 [1] ) - Parent: Comment block at (3:0,3 [13] )
+MetaCode span at (4:0,4 [1] ) - Parent: Comment block at (3:0,3 [13] )
+Comment span at (5:0,5 [9] ) - Parent: Comment block at (3:0,3 [13] )
+MetaCode span at (14:0,14 [1] ) - Parent: Comment block at (3:0,3 [13] )
+Transition span at (15:0,15 [1] ) - Parent: Comment block at (3:0,3 [13] )
+Markup span at (16:0,16 [8] ) - Parent: Markup block at (16:0,16 [11] )
+Transition span at (24:0,24 [1] ) - Parent: Expression block at (24:0,24 [2] )
+Code span at (25:0,25 [1] ) - Parent: Expression block at (24:0,24 [2] )
+Markup span at (26:0,26 [1] ) - Parent: Markup block at (16:0,16 [11] )
+Markup span at (27:0,27 [3] ) - Parent: Tag block at (0:0,0 [30] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.stree.txt
new file mode 100644
index 00000000000..a8aee7debe0
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_CommentBefore.stree.txt
@@ -0,0 +1,41 @@
+RazorDocument - [0..30)::30 - []
+ MarkupBlock - [0..30)::30
+ MarkupElement - [0..30)::30
+ MarkupStartTag - [0..30)::30 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ RazorComment - [3..16)::13
+ RazorCommentTransition;[@];
+ RazorCommentStar;[*];
+ RazorCommentLiteral;[ comment ];
+ RazorCommentStar;[*];
+ RazorCommentTransition;[@];
+ MarkupAttributeBlock - [16..27)::11 - [ class="@c"]
+ MarkupTextLiteral - [16..17)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [17..22)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [23..24)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [24..26)::2
+ MarkupDynamicAttributeValue - [24..26)::2 - [@c]
+ GenericBlock - [24..26)::2
+ CSharpCodeBlock - [24..26)::2
+ CSharpImplicitExpression - [24..26)::2
+ CSharpTransition - [24..25)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [25..26)::1
+ CSharpCodeBlock - [25..26)::1
+ CSharpExpressionLiteral - [25..26)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [26..27)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [27..28)::1
+ MarkupTextLiteral - [27..28)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.cspans.txt
new file mode 100644
index 00000000000..1afcd2567c6
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.cspans.txt
@@ -0,0 +1,9 @@
+Markup span at (0:0,0 [2] ) - Parent: Tag block at (0:0,0 [19] )
+Markup span at (2:0,2 [8] ) - Parent: Markup block at (2:0,2 [11] )
+Transition span at (10:0,10 [1] ) - Parent: Expression block at (10:0,10 [2] )
+Code span at (11:0,11 [1] ) - Parent: Expression block at (10:0,10 [2] )
+Markup span at (12:0,12 [1] ) - Parent: Markup block at (2:0,2 [11] )
+Markup span at (13:0,13 [1] ) - Parent: Tag block at (0:0,0 [19] )
+Transition span at (14:0,14 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Code span at (15:0,15 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Markup span at (16:0,16 [3] ) - Parent: Tag block at (0:0,0 [19] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.stree.txt
new file mode 100644
index 00000000000..4e4b3cb53aa
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentAfter.stree.txt
@@ -0,0 +1,44 @@
+RazorDocument - [0..19)::19 - []
+ MarkupBlock - [0..19)::19
+ MarkupElement - [0..19)::19
+ MarkupStartTag - [0..19)::19 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupAttributeBlock - [2..13)::11 - [ class="@c"]
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [3..8)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [9..10)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [10..12)::2
+ MarkupDynamicAttributeValue - [10..12)::2 - [@c]
+ GenericBlock - [10..12)::2
+ CSharpCodeBlock - [10..12)::2
+ CSharpImplicitExpression - [10..12)::2
+ CSharpTransition - [10..11)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [11..12)::1
+ CSharpCodeBlock - [11..12)::1
+ CSharpExpressionLiteral - [11..12)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [12..13)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [13..16)::3
+ MarkupTextLiteral - [13..14)::1 - [ ] - Gen
+ Whitespace;[ ];
+ CSharpCodeBlock - [14..16)::2
+ CSharpImplicitExpression - [14..16)::2
+ CSharpTransition - [14..15)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [15..16)::1
+ CSharpCodeBlock - [15..16)::1
+ CSharpExpressionLiteral - [15..16)::1 - [x] - Gen
+ Identifier;[x];
+ MarkupMiscAttributeContent - [16..17)::1
+ MarkupTextLiteral - [16..17)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.cspans.txt
new file mode 100644
index 00000000000..a17d0422e53
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.cspans.txt
@@ -0,0 +1,8 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [19] )
+Transition span at (3:0,3 [1] ) - Parent: Expression block at (3:0,3 [2] )
+Code span at (4:0,4 [1] ) - Parent: Expression block at (3:0,3 [2] )
+Markup span at (5:0,5 [8] ) - Parent: Markup block at (5:0,5 [11] )
+Transition span at (13:0,13 [1] ) - Parent: Expression block at (13:0,13 [2] )
+Code span at (14:0,14 [1] ) - Parent: Expression block at (13:0,13 [2] )
+Markup span at (15:0,15 [1] ) - Parent: Markup block at (5:0,5 [11] )
+Markup span at (16:0,16 [3] ) - Parent: Tag block at (0:0,0 [19] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.stree.txt
new file mode 100644
index 00000000000..48d0f66ca4b
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore.stree.txt
@@ -0,0 +1,44 @@
+RazorDocument - [0..19)::19 - []
+ MarkupBlock - [0..19)::19
+ MarkupElement - [0..19)::19
+ MarkupStartTag - [0..19)::19 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupMiscAttributeContent - [2..5)::3
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ CSharpCodeBlock - [3..5)::2
+ CSharpImplicitExpression - [3..5)::2
+ CSharpTransition - [3..4)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [4..5)::1
+ CSharpCodeBlock - [4..5)::1
+ CSharpExpressionLiteral - [4..5)::1 - [x] - Gen
+ Identifier;[x];
+ MarkupAttributeBlock - [5..16)::11 - [ class="@c"]
+ MarkupTextLiteral - [5..6)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [6..11)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [12..13)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [13..15)::2
+ MarkupDynamicAttributeValue - [13..15)::2 - [@c]
+ GenericBlock - [13..15)::2
+ CSharpCodeBlock - [13..15)::2
+ CSharpImplicitExpression - [13..15)::2
+ CSharpTransition - [13..14)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [14..15)::1
+ CSharpCodeBlock - [14..15)::1
+ CSharpExpressionLiteral - [14..15)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [15..16)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [16..17)::1
+ MarkupTextLiteral - [16..17)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.cspans.txt
new file mode 100644
index 00000000000..3360fe43295
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.cspans.txt
@@ -0,0 +1,10 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [25] )
+Transition span at (3:0,3 [1] ) - Parent: Expression block at (3:0,3 [8] )
+MetaCode span at (4:0,4 [1] ) - Parent: Expression block at (3:0,3 [8] )
+Code span at (5:0,5 [5] ) - Parent: Expression block at (3:0,3 [8] )
+MetaCode span at (10:0,10 [1] ) - Parent: Expression block at (3:0,3 [8] )
+Markup span at (11:0,11 [8] ) - Parent: Markup block at (11:0,11 [11] )
+Transition span at (19:0,19 [1] ) - Parent: Expression block at (19:0,19 [2] )
+Code span at (20:0,20 [1] ) - Parent: Expression block at (19:0,19 [2] )
+Markup span at (21:0,21 [1] ) - Parent: Markup block at (11:0,11 [11] )
+Markup span at (22:0,22 [3] ) - Parent: Tag block at (0:0,0 [25] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.stree.txt
new file mode 100644
index 00000000000..0bfb01eb951
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_02.stree.txt
@@ -0,0 +1,52 @@
+RazorDocument - [0..25)::25 - []
+ MarkupBlock - [0..25)::25
+ MarkupElement - [0..25)::25
+ MarkupStartTag - [0..25)::25 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupMiscAttributeContent - [2..11)::9
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ CSharpCodeBlock - [3..11)::8
+ CSharpExplicitExpression - [3..11)::8
+ CSharpTransition - [3..4)::1 - Gen
+ Transition;[@];
+ CSharpExplicitExpressionBody - [4..11)::7
+ RazorMetaCode - [4..5)::1 - Gen
+ LeftParenthesis;[(];
+ CSharpCodeBlock - [5..10)::5
+ CSharpExpressionLiteral - [5..10)::5 - [x + y] - Gen
+ Identifier;[x];
+ Whitespace;[ ];
+ Plus;[+];
+ Whitespace;[ ];
+ Identifier;[y];
+ RazorMetaCode - [10..11)::1 - Gen
+ RightParenthesis;[)];
+ MarkupAttributeBlock - [11..22)::11 - [ class="@c"]
+ MarkupTextLiteral - [11..12)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [12..17)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [18..19)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [19..21)::2
+ MarkupDynamicAttributeValue - [19..21)::2 - [@c]
+ GenericBlock - [19..21)::2
+ CSharpCodeBlock - [19..21)::2
+ CSharpImplicitExpression - [19..21)::2
+ CSharpTransition - [19..20)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [20..21)::1
+ CSharpCodeBlock - [20..21)::1
+ CSharpExpressionLiteral - [20..21)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [21..22)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [22..23)::1
+ MarkupTextLiteral - [22..23)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.cspans.txt
new file mode 100644
index 00000000000..72a255eca54
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.cspans.txt
@@ -0,0 +1,13 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [33] )
+Transition span at (3:0,3 [1] ) - Parent: Statement block at (3:0,3 [16] )
+MetaCode span at (4:0,4 [1] ) - Parent: Statement block at (3:0,3 [16] )
+Code span at (5:0,5 [9] ) - Parent: Statement block at (3:0,3 [16] )
+Transition span at (14:0,14 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Code span at (15:0,15 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Code span at (16:0,16 [2] ) - Parent: Statement block at (3:0,3 [16] )
+MetaCode span at (18:0,18 [1] ) - Parent: Statement block at (3:0,3 [16] )
+Markup span at (19:0,19 [8] ) - Parent: Markup block at (19:0,19 [11] )
+Transition span at (27:0,27 [1] ) - Parent: Expression block at (27:0,27 [2] )
+Code span at (28:0,28 [1] ) - Parent: Expression block at (27:0,27 [2] )
+Markup span at (29:0,29 [1] ) - Parent: Markup block at (19:0,19 [11] )
+Markup span at (30:0,30 [3] ) - Parent: Tag block at (0:0,0 [33] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.stree.txt
new file mode 100644
index 00000000000..c9f30d10b3b
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_03.stree.txt
@@ -0,0 +1,66 @@
+RazorDocument - [0..33)::33 - []
+ MarkupBlock - [0..33)::33
+ MarkupElement - [0..33)::33
+ MarkupStartTag - [0..33)::33 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupMiscAttributeContent - [2..19)::17
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ CSharpCodeBlock - [3..19)::16
+ CSharpStatement - [3..19)::16
+ CSharpTransition - [3..4)::1 - Gen
+ Transition;[@];
+ CSharpStatementBody - [4..19)::15
+ RazorMetaCode - [4..5)::1 - Gen
+ LeftBrace;[{];
+ CSharpCodeBlock - [5..18)::13
+ CSharpStatementLiteral - [5..14)::9 - [if (x) { ] - Gen
+ Keyword;[if];
+ Whitespace;[ ];
+ LeftParenthesis;[(];
+ Identifier;[x];
+ RightParenthesis;[)];
+ Whitespace;[ ];
+ LeftBrace;[{];
+ Whitespace;[ ];
+ CSharpCodeBlock - [14..16)::2
+ CSharpImplicitExpression - [14..16)::2
+ CSharpTransition - [14..15)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [15..16)::1
+ CSharpCodeBlock - [15..16)::1
+ CSharpExpressionLiteral - [15..16)::1 - [x] - Gen
+ Identifier;[x];
+ CSharpStatementLiteral - [16..18)::2 - [ }] - Gen
+ Whitespace;[ ];
+ RightBrace;[}];
+ RazorMetaCode - [18..19)::1 - Gen
+ RightBrace;[}];
+ MarkupAttributeBlock - [19..30)::11 - [ class="@c"]
+ MarkupTextLiteral - [19..20)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [20..25)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [26..27)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [27..29)::2
+ MarkupDynamicAttributeValue - [27..29)::2 - [@c]
+ GenericBlock - [27..29)::2
+ CSharpCodeBlock - [27..29)::2
+ CSharpImplicitExpression - [27..29)::2
+ CSharpTransition - [27..28)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [28..29)::1
+ CSharpCodeBlock - [28..29)::1
+ CSharpExpressionLiteral - [28..29)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [29..30)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [30..31)::1
+ MarkupTextLiteral - [30..31)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.cspans.txt
new file mode 100644
index 00000000000..7e28da18a1f
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.cspans.txt
@@ -0,0 +1,8 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [20] )
+Markup span at (3:0,3 [1] ) - Parent: Tag block at (0:0,0 [20] )
+Markup span at (4:0,4 [2] ) - Parent: Markup block at (4:0,4 [2] )
+Markup span at (6:0,6 [8] ) - Parent: Markup block at (6:0,6 [11] )
+Transition span at (14:0,14 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Code span at (15:0,15 [1] ) - Parent: Expression block at (14:0,14 [2] )
+Markup span at (16:0,16 [1] ) - Parent: Markup block at (6:0,6 [11] )
+Markup span at (17:0,17 [3] ) - Parent: Tag block at (0:0,0 [20] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.stree.txt
new file mode 100644
index 00000000000..136a533f762
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_DynamicContentBefore_04.stree.txt
@@ -0,0 +1,41 @@
+RazorDocument - [0..20)::20 - []
+ MarkupBlock - [0..20)::20
+ MarkupElement - [0..20)::20
+ MarkupStartTag - [0..20)::20 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupEphemeralTextLiteral - [3..4)::1 - [@] - Gen
+ Transition;[@];
+ MarkupMinimizedAttributeBlock - [4..6)::2 - [@x]
+ MarkupTextLiteral - [4..6)::2 - [@x] - Gen
+ Transition;[@];
+ Text;[x];
+ MarkupAttributeBlock - [6..17)::11 - [ class="@c"]
+ MarkupTextLiteral - [6..7)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupTextLiteral - [7..12)::5 - [class] - Gen
+ Text;[class];
+ Equals;[=];
+ MarkupTextLiteral - [13..14)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [14..16)::2
+ MarkupDynamicAttributeValue - [14..16)::2 - [@c]
+ GenericBlock - [14..16)::2
+ CSharpCodeBlock - [14..16)::2
+ CSharpImplicitExpression - [14..16)::2
+ CSharpTransition - [14..15)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [15..16)::1
+ CSharpCodeBlock - [15..16)::1
+ CSharpExpressionLiteral - [15..16)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [16..17)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [17..18)::1
+ MarkupTextLiteral - [17..18)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.cspans.txt
new file mode 100644
index 00000000000..f3b1e46a965
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.cspans.txt
@@ -0,0 +1,4 @@
+Markup span at (0:0,0 [15] ) - Parent: Tag block at (0:0,0 [21] )
+Transition span at (15:0,15 [1] ) - Parent: Expression block at (15:0,15 [2] )
+Code span at (16:0,16 [1] ) - Parent: Expression block at (15:0,15 [2] )
+Markup span at (17:0,17 [4] ) - Parent: Tag block at (0:0,0 [21] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.stree.txt
new file mode 100644
index 00000000000..28ae108fc51
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/ConditionalAttribute_InvalidContentBefore.stree.txt
@@ -0,0 +1,30 @@
+RazorDocument - [0..21)::21 - []
+ MarkupBlock - [0..21)::21
+ MarkupElement - [0..21)::21
+ MarkupStartTag - [0..21)::21 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupMiscAttributeContent - [2..19)::17
+ MarkupTextLiteral - [2..15)::13 - [ "ab" class="] - Gen
+ Whitespace;[ ];
+ DoubleQuote;["];
+ Text;[ab];
+ DoubleQuote;["];
+ Whitespace;[ ];
+ Text;[class];
+ Equals;[=];
+ DoubleQuote;["];
+ CSharpCodeBlock - [15..17)::2
+ CSharpImplicitExpression - [15..17)::2
+ CSharpTransition - [15..16)::1 - Gen
+ Transition;[@];
+ CSharpImplicitExpressionBody - [16..17)::1
+ CSharpCodeBlock - [16..17)::1
+ CSharpExpressionLiteral - [16..17)::1 - [c] - Gen
+ Identifier;[c];
+ MarkupTextLiteral - [17..19)::2 - [" ] - Gen
+ DoubleQuote;["];
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.cspans.txt
new file mode 100644
index 00000000000..f56e27cddc5
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.cspans.txt
@@ -0,0 +1,3 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [5] )
+Markup span at (3:0,3 [1] ) - Parent: Tag block at (0:0,0 [5] )
+Markup span at (4:0,4 [1] ) - Parent: Markup block at (4:0,4 [1] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.stree.txt
new file mode 100644
index 00000000000..c33f401ff88
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Eof.stree.txt
@@ -0,0 +1,15 @@
+RazorDocument - [0..5)::5 - [
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupEphemeralTextLiteral - [3..4)::1 - [@] - Gen
+ Transition;[@];
+ MarkupMinimizedAttributeBlock - [4..5)::1 - [@]
+ MarkupTextLiteral - [4..5)::1 - [@] - Gen
+ Transition;[@];
+ CloseAngle;[];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.cspans.txt
new file mode 100644
index 00000000000..768edf20f10
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.cspans.txt
@@ -0,0 +1,4 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [17] )
+Markup span at (3:0,3 [1] ) - Parent: Tag block at (0:0,0 [17] )
+Markup span at (4:0,4 [10] ) - Parent: Markup block at (4:0,4 [10] )
+Markup span at (14:0,14 [3] ) - Parent: Tag block at (0:0,0 [17] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.stree.txt
new file mode 100644
index 00000000000..b3a855fdc03
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_InvalidName.stree.txt
@@ -0,0 +1,22 @@
+RazorDocument - [0..17)::17 - []
+ MarkupBlock - [0..17)::17
+ MarkupElement - [0..17)::17
+ MarkupStartTag - [0..17)::17 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupEphemeralTextLiteral - [3..4)::1 - [@] - Gen
+ Transition;[@];
+ MarkupMinimizedAttributeBlock - [4..14)::10 - [@"invalid"]
+ MarkupTextLiteral - [4..14)::10 - [@"invalid"] - Gen
+ Transition;[@];
+ DoubleQuote;["];
+ Text;[invalid];
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [14..15)::1
+ MarkupTextLiteral - [14..15)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.cspans.txt
new file mode 100644
index 00000000000..65a083eaf48
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.cspans.txt
@@ -0,0 +1,4 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [12] )
+Markup span at (3:0,3 [1] ) - Parent: Tag block at (0:0,0 [12] )
+Markup span at (4:0,4 [5] ) - Parent: Markup block at (4:0,4 [5] )
+Markup span at (9:0,9 [3] ) - Parent: Tag block at (0:0,0 [12] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.stree.txt
new file mode 100644
index 00000000000..e995535e191
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_Minimized.stree.txt
@@ -0,0 +1,20 @@
+RazorDocument - [0..12)::12 - []
+ MarkupBlock - [0..12)::12
+ MarkupElement - [0..12)::12
+ MarkupStartTag - [0..12)::12 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupEphemeralTextLiteral - [3..4)::1 - [@] - Gen
+ Transition;[@];
+ MarkupMinimizedAttributeBlock - [4..9)::5 - [@attr]
+ MarkupTextLiteral - [4..9)::5 - [@attr] - Gen
+ Transition;[@];
+ Text;[attr];
+ MarkupMiscAttributeContent - [9..10)::1
+ MarkupTextLiteral - [9..10)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.cspans.txt
new file mode 100644
index 00000000000..1007a00e136
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.cspans.txt
@@ -0,0 +1,6 @@
+Markup span at (0:0,0 [3] ) - Parent: Tag block at (0:0,0 [20] )
+Markup span at (3:0,3 [1] ) - Parent: Tag block at (0:0,0 [20] )
+Markup span at (4:0,4 [7] ) - Parent: Markup block at (4:0,4 [13] )
+Markup span at (11:0,11 [5] ) - Parent: Markup block at (4:0,4 [13] )
+Markup span at (16:0,16 [1] ) - Parent: Markup block at (4:0,4 [13] )
+Markup span at (17:0,17 [3] ) - Parent: Tag block at (0:0,0 [20] )
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.stree.txt
new file mode 100644
index 00000000000..12c5fb8ca0b
--- /dev/null
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlAttributeTest/EscapedAttributeName_WithValue.stree.txt
@@ -0,0 +1,29 @@
+RazorDocument - [0..20)::20 - []
+ MarkupBlock - [0..20)::20
+ MarkupElement - [0..20)::20
+ MarkupStartTag - [0..20)::20 - [] - Gen
+ OpenAngle;[<];
+ Text;[p];
+ MarkupTextLiteral - [2..3)::1 - [ ] - Gen
+ Whitespace;[ ];
+ MarkupEphemeralTextLiteral - [3..4)::1 - [@] - Gen
+ Transition;[@];
+ MarkupAttributeBlock - [4..17)::13 - [@attr="value"]
+ MarkupTextLiteral - [4..9)::5 - [@attr] - Gen
+ Transition;[@];
+ Text;[attr];
+ Equals;[=];
+ MarkupTextLiteral - [10..11)::1 - ["] - Gen
+ DoubleQuote;["];
+ GenericBlock - [11..16)::5
+ MarkupLiteralAttributeValue - [11..16)::5 - [value]
+ MarkupTextLiteral - [11..16)::5 - [value] - Gen
+ Text;[value];
+ MarkupTextLiteral - [16..17)::1 - ["] - Gen
+ DoubleQuote;["];
+ MarkupMiscAttributeContent - [17..18)::1
+ MarkupTextLiteral - [17..18)::1 - [ ] - Gen
+ Whitespace;[ ];
+ ForwardSlash;[/];
+ CloseAngle;[>];
+ EndOfFile;[];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SwitchesToCodeWhenSwapCharacterEncounteredMidTag.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SwitchesToCodeWhenSwapCharacterEncounteredMidTag.stree.txt
index f88861c33a6..90bdb2cbe61 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SwitchesToCodeWhenSwapCharacterEncounteredMidTag.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/HtmlToCodeSwitchTest/SwitchesToCodeWhenSwapCharacterEncounteredMidTag.stree.txt
@@ -15,7 +15,7 @@
MarkupStartTag - [2..14)::12 - [] - Gen
OpenAngle;[<];
Text;[foo];
- MarkupMiscAttributeContent - [6..12)::6
+ MarkupMiscAttributeContent - [6..11)::5
MarkupTextLiteral - [6..7)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [7..11)::4
@@ -26,6 +26,7 @@
CSharpCodeBlock - [8..11)::3
CSharpExpressionLiteral - [8..11)::3 - [bar] - Gen
Identifier;[bar];
+ MarkupMiscAttributeContent - [11..12)::1
MarkupTextLiteral - [11..12)::1 - [ ] - Gen
Whitespace;[ ];
ForwardSlash;[/];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_SelfClosing.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_SelfClosing.stree.txt
index 127a0c96746..17fb8f7a506 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_SelfClosing.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_SelfClosing.stree.txt
@@ -4,7 +4,7 @@
MarkupStartTag - [0..25)::25 - [] - Gen
OpenAngle;[<];
Text;[input];
- MarkupMiscAttributeContent - [6..23)::17
+ MarkupMiscAttributeContent - [6..15)::9
MarkupTextLiteral - [6..7)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [7..15)::8
@@ -15,6 +15,7 @@
CSharpCodeBlock - [8..15)::7
CSharpExpressionLiteral - [8..15)::7 - [onclick] - Gen
Identifier;[onclick];
+ MarkupMiscAttributeContent - [15..23)::8
MarkupTextLiteral - [15..17)::2 - [="] - Gen
Equals;[=];
DoubleQuote;["];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_Void.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_Void.stree.txt
index 7d6cb8d775d..ec24da08de9 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_Void.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/AllowsCompatibleTagStructures_DirectiveAttribute_Void.stree.txt
@@ -4,7 +4,7 @@
MarkupStartTag - [0..24)::24 - [] - Gen
OpenAngle;[<];
Text;[input];
- MarkupMiscAttributeContent - [6..23)::17
+ MarkupMiscAttributeContent - [6..15)::9
MarkupTextLiteral - [6..7)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [7..15)::8
@@ -15,6 +15,7 @@
CSharpCodeBlock - [8..15)::7
CSharpExpressionLiteral - [8..15)::7 - [onclick] - Gen
Identifier;[onclick];
+ MarkupMiscAttributeContent - [15..23)::8
MarkupTextLiteral - [15..17)::2 - [="] - Gen
Equals;[=];
DoubleQuote;["];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes13.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes13.stree.txt
index e3f29b33746..63b33f86d1d 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes13.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes13.stree.txt
@@ -4,7 +4,7 @@
MarkupTagHelperStartTag - [0..29)::29 - [] - Gen
OpenAngle;[<];
Text;[p];
- MarkupMiscAttributeContent - [2..28)::26
+ MarkupMiscAttributeContent - [2..16)::14
MarkupTextLiteral - [2..3)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [3..16)::13
@@ -17,12 +17,19 @@
Identifier;[DateTime];
Dot;[.];
Identifier;[Now];
- MarkupTextLiteral - [16..28)::12 - [ class="btn"] - Gen
+ MarkupAttributeBlock - [16..28)::12 - [ class="btn"]
+ MarkupTextLiteral - [16..17)::1 - [ ] - Gen
Whitespace;[ ];
+ MarkupTextLiteral - [17..22)::5 - [class] - Gen
Text;[class];
- Equals;[=];
+ Equals;[=];
+ MarkupTextLiteral - [23..24)::1 - ["] - Gen
DoubleQuote;["];
- Text;[btn];
+ GenericBlock - [24..27)::3
+ MarkupLiteralAttributeValue - [24..27)::3 - [btn]
+ MarkupTextLiteral - [24..27)::3 - [btn] - Gen
+ Text;[btn];
+ MarkupTextLiteral - [27..28)::1 - ["] - Gen
DoubleQuote;["];
CloseAngle;[>];
MarkupTagHelperEndTag - [29..33)::4 - [
]
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes14.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes14.stree.txt
index 427584cf397..cef184ddffb 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes14.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForMalformedTagHelpersWithAttributes14.stree.txt
@@ -4,7 +4,7 @@
MarkupTagHelperStartTag - [0..23)::23 - [] - Gen
OpenAngle;[<];
Text;[p];
- MarkupMiscAttributeContent - [2..22)::20
+ MarkupMiscAttributeContent - [2..16)::14
MarkupTextLiteral - [2..3)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [3..16)::13
@@ -17,6 +17,7 @@
Identifier;[DateTime];
Dot;[.];
Identifier;[Now];
+ MarkupMiscAttributeContent - [16..22)::6
MarkupTextLiteral - [16..22)::6 - [="btn"] - Gen
Equals;[=];
DoubleQuote;["];
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt
index 00a8412278e..ffb0abc8937 100644
--- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt
+++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/TagHelperParseTreeRewriter_AllowsInvalidHtml10.stree.txt
@@ -9,7 +9,7 @@
MarkupStartTag - [3..20)::17 - [< @DateTime.Now >] - Gen
OpenAngle;[<];
Text;[];
- MarkupMiscAttributeContent - [4..19)::15
+ MarkupMiscAttributeContent - [4..18)::14
MarkupTextLiteral - [4..5)::1 - [ ] - Gen
Whitespace;[ ];
CSharpCodeBlock - [5..18)::13
@@ -22,6 +22,7 @@
Identifier;[DateTime];
Dot;[.];
Identifier;[Now];
+ MarkupMiscAttributeContent - [18..19)::1
MarkupTextLiteral - [18..19)::1 - [ ] - Gen
Whitespace;[ ];
CloseAngle;[>];
diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs
index dace4acf713..a89e708b7b2 100644
--- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs
+++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs
@@ -1085,16 +1085,53 @@ private void ParseAttribute(in SyntaxListBuilder builder)
// http://dev.w3.org/html5/spec/tokenization.html#attribute-name-state
// Read the 'name' (i.e. read until the '=' or whitespace/newline)
using var nameTokens = new PooledArrayBuilder();
- if (!TryParseAttributeName(ref nameTokens.AsRef()))
+ var nameParsingResult = TryParseAttributeName(out SyntaxToken? ephemeralToken, ref nameTokens.AsRef());
+
+ switch (nameParsingResult)
{
+ // Parse C# and return to attribute parsing afterwards.
+ case AttributeNameParsingResult.CSharp:
+ {
+ Accept(in attributePrefixWhitespace);
+ PutCurrentBack();
+ using var pooledResult = Pool.Allocate();
+ var dynamicAttributeValueBuilder = pooledResult.Builder;
+ OtherParserBlock(dynamicAttributeValueBuilder);
+ var value = SyntaxFactory.MarkupMiscAttributeContent(dynamicAttributeValueBuilder.ToList());
+ builder.Add(value);
+ return;
+ }
+
+ // Parse razor comment and return to attribute parsing afterwards.
+ case AttributeNameParsingResult.RazorComment:
+ {
+ Accept(in attributePrefixWhitespace);
+ PutCurrentBack();
+ ParseRazorCommentWithLeadingAndTrailingWhitespace(builder);
+ return;
+ }
+
// Unexpected character in tag, enter recovery
- Accept(in attributePrefixWhitespace);
- ParseMiscAttribute(builder);
- return;
+ case AttributeNameParsingResult.Other:
+ {
+ Accept(in attributePrefixWhitespace);
+ ParseMiscAttribute(builder);
+ return;
+ }
}
+ Debug.Assert(nameParsingResult is AttributeNameParsingResult.Success);
Accept(in attributePrefixWhitespace); // Whitespace before attribute name
var namePrefix = OutputAsMarkupLiteral();
+
+ if (ephemeralToken is not null)
+ {
+ builder.Add(namePrefix);
+ Accept(ephemeralToken);
+ builder.Add(OutputAsMarkupEphemeralLiteral());
+ namePrefix = null;
+ }
+
Accept(in nameTokens); // Attribute name
var name = OutputAsMarkupLiteralRequired();
@@ -1113,18 +1150,44 @@ private void ParseAttribute(in SyntaxListBuilder builder)
}
}
- private bool TryParseAttributeName(ref PooledArrayBuilder nameTokens)
+ private enum AttributeNameParsingResult
{
+ Success,
+ Other,
+ CSharp,
+ RazorComment,
+ }
+
+ private AttributeNameParsingResult TryParseAttributeName(out SyntaxToken? ephemeralToken, ref PooledArrayBuilder nameTokens)
+ {
+ ephemeralToken = null;
+
//
// We are currently here
// If we encounter a transition (@) here, it can be parsed as CSharp or Markup depending on the feature flag.
// For example, in Components, we want to parse it as Markup so we can support directive attributes.
//
- if (Context.FeatureFlags.AllowCSharpInMarkupAttributeArea &&
- (At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)))
+ if (Context.FeatureFlags.AllowCSharpInMarkupAttributeArea)
{
- // If we get here, there is CSharp in the attribute area. Don't try to parse the name.
- return false;
+ if (At(SyntaxKind.Transition))
+ {
+ if (NextIs(SyntaxKind.Transition))
+ {
+ // The attribute name is escaped (@@), eat the first @ sign.
+ ephemeralToken = CurrentToken;
+ NextToken();
+ }
+ else
+ {
+ // There is CSharp in the attribute area. Don't try to parse the name.
+ return AttributeNameParsingResult.CSharp;
+ }
+ }
+ else if (At(SyntaxKind.RazorCommentTransition))
+ {
+ // There is razor comment in the attribute area. Don't try to parse the name.
+ return AttributeNameParsingResult.RazorComment;
+ }
}
if (IsValidAttributeNameToken(CurrentToken))
@@ -1140,10 +1203,10 @@ private bool TryParseAttributeName(ref PooledArrayBuilder nameToken
this,
ref nameTokens);
- return true;
+ return AttributeNameParsingResult.Success;
}
- return false;
+ return AttributeNameParsingResult.Other;
}
private MarkupAttributeBlockSyntax ParseRemainingAttribute(MarkupTextLiteralSyntax? namePrefix, MarkupTextLiteralSyntax name)
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorCshtmlTests.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorCshtmlTests.cs
index bd36e701d94..32db754df10 100644
--- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorCshtmlTests.cs
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorCshtmlTests.cs
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
using Roslyn.Test.Utilities;
using Xunit;
@@ -68,4 +70,50 @@ public async Task CssScoping()
Assert.Single(result.GeneratedSources);
await VerifyRazorPageMatchesBaselineAsync(compilation, "Pages_Index");
}
+
+ [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/razor/issues/10586")]
+ public async Task ConditionalAttributes([CombinatorialValues("@null", "@n")] string value)
+ {
+ // Arrange
+ var project = CreateTestProject(new()
+ {
+ ["Pages/Index.cshtml"] = $$"""
+ @page
+ @{ var s = "str"; string? n = null; }
+ x
+ x
+ x
+ x
+ x
+
+ x
+ x
+
+ x
+
+ x
+ x
+ x
+
+ x
+ x
+ """,
+ });
+ var compilation = await project.GetCompilationAsync();
+ compilation = compilation.WithOptions(compilation.Options.WithSpecificDiagnosticOptions([.. compilation.Options.SpecificDiagnosticOptions,
+ // warning CS0219: The variable 'n' is assigned but its value is never used
+ new("CS0219", ReportDiagnostic.Suppress)]));
+ var driver = await GetDriverAsync(project);
+
+ // Act
+ var result = RunGenerator(compilation!, ref driver, out compilation);
+
+ // Assert
+ Assert.Empty(result.Diagnostics);
+ Assert.Single(result.GeneratedSources);
+ var html = await VerifyRazorPageMatchesBaselineAsync(compilation, "Pages_Index");
+
+ // The style attribute should not be rendered at all.
+ Assert.DoesNotContain("style", html);
+ }
}
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
index 1b53d747d68..6d9f8cdef27 100644
--- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
@@ -209,7 +209,7 @@ static IEnumerable GetViewStartNames(string name)
}
}
- protected static async Task VerifyRazorPageMatchesBaselineAsync(Compilation compilation, string name,
+ protected static async Task VerifyRazorPageMatchesBaselineAsync(Compilation compilation, string name,
[CallerFilePath] string testPath = "", [CallerMemberName] string testName = "", string suffix = "")
{
var html = await RenderRazorPageAsync(compilation, name);
@@ -220,6 +220,7 @@ protected static async Task VerifyRazorPageMatchesBaselineAsync(Compilation comp
testPath: testPath,
testName: testName,
suffix: suffix);
+ return html;
}
protected static Project CreateTestProject(
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorCshtmlTests/ConditionalAttributes/Pages_Index.html b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorCshtmlTests/ConditionalAttributes/Pages_Index.html
new file mode 100644
index 00000000000..6b2c1d20ecc
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorCshtmlTests/ConditionalAttributes/Pages_Index.html
@@ -0,0 +1,17 @@
+x
+x
+x
+x
+x
+
+x
+x
+
+x
+
+x
+x
+x
+
+x
+x
\ No newline at end of file
diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
index 98bfa6e9b26..ae9ba577a3b 100644
--- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
+++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
@@ -77,6 +77,8 @@ protected IntegrationTestBase(TestProject.Layer layer, string? projectDirectoryH
protected bool NullableEnable { get; set; }
+ protected Dictionary? ExpectedMissingSourceMappings { get; set; }
+
///
/// Gets the
///
@@ -91,7 +93,7 @@ protected IntegrationTestBase(TestProject.Layer layer, string? projectDirectoryH
protected string TestProjectRoot { get; }
- public virtual string GetTestFileName(string? testName)
+ public virtual string GetTestFileName([CallerMemberName] string? testName = null)
{
return $"TestFiles/IntegrationTests/{this.GetType().Name}/{testName}";
}
@@ -507,13 +509,33 @@ protected void AssertSourceMappingsMatchBaseline(RazorCodeDocument codeDocument,
}
}
- if (!found)
+ if (ExpectedMissingSourceMappings?.TryGetValue(SourceLocation.FromSpan(sourceSpan), out var expectedMissingSpan) == true)
+ {
+ if (found)
+ {
+ throw new XunitException($"Remove {sourceSpan} from {nameof(ExpectedMissingSourceMappings)}.");
+ }
+ else if (expectedSpan != expectedMissingSpan)
+ {
+ throw new XunitException($"Missing span {sourceSpan} has different content '{EscapeWhitespace(expectedSpan)}' " +
+ $"than expected '{EscapeWhitespace(expectedMissingSpan)}'.");
+ }
+
+ ExpectedMissingSourceMappings.Remove(SourceLocation.FromSpan(sourceSpan));
+ }
+ else if (!found)
{
throw new XunitException(
$"Could not find the span {sourceSpan} - containing '{EscapeWhitespace(expectedSpan)}' " +
$"in the output.");
}
}
+
+ if (ExpectedMissingSourceMappings?.Count > 0)
+ {
+ throw new XunitException($"Found unused {nameof(ExpectedMissingSourceMappings)} ({ExpectedMissingSourceMappings.Count}), " +
+ $"for example {ExpectedMissingSourceMappings.First()}.");
+ }
}
protected void AssertHtmlSourceMappingsMatchBaseline(RazorCodeDocument codeDocument, [CallerMemberName] string testName = "")