Skip to content

Commit 9f10012

Browse files
authored
Merge release/dev17.11 to main (#10483)
This is an automatically generated pull request from release/dev17.11 into main. Once all conflicts are resolved and all the tests pass, you are free to merge the pull request. 🐯 ## Troubleshooting conflicts ### Identify authors of changes which introduced merge conflicts Scroll to the bottom, then for each file containing conflicts copy its path into the following searches: - https://github.com/dotnet/razor/find/release/dev17.11 - https://github.com/dotnet/razor/find/main Usually the most recent change to a file between the two branches is considered to have introduced the conflicts, but sometimes it will be necessary to look for the conflicting lines and check the blame in each branch. Generally the author whose change introduced the conflicts should pull down this PR, fix the conflicts locally, then push up a commit resolving the conflicts. ### Resolve merge conflicts using your local repo Sometimes merge conflicts may be present on GitHub but merging locally will work without conflicts. This is due to differences between the merge algorithm used in local git versus the one used by GitHub. ``` bash git fetch --all git checkout -t upstream/merges/release/dev17.11-to-main git reset --hard upstream/main git merge upstream/release/dev17.11 # Fix merge conflicts git commit git push upstream merges/release/dev17.11-to-main --force ```
2 parents d8690ff + 6927837 commit 9f10012

24 files changed

+664
-30
lines changed

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/TestTagHelperDescriptors.cs

+9
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,19 @@ public static IEnumerable<TagHelperDescriptor> SimpleTagHelperDescriptors
4444
.Name("age")
4545
.Metadata(PropertyName("AgeProp"))
4646
.TypeName("System.Int32"),
47+
builder => builder
48+
.Name("alive")
49+
.Metadata(PropertyName("AliveProp"))
50+
.TypeName("System.Boolean"),
4751
builder => builder
4852
.Name("tag")
4953
.Metadata(PropertyName("TagProp"))
5054
.TypeName("System.Object"),
55+
builder => builder
56+
.Name("tuple-dictionary")
57+
.Metadata(PropertyName("DictionaryOfBoolAndStringTupleProperty"))
58+
.TypeName(typeof(IDictionary<string, int>).Namespace + ".IDictionary<System.String, (System.Boolean, System.String)>")
59+
.AsDictionaryAttribute("tuple-prefix-", typeof((bool, string)).FullName)
5160
})
5261
};
5362
}

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperBlockRewriterTest.cs

+60
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ public void CreatesErrorForMalformedTagHelper8()
475475
.Name("name")
476476
.Metadata(PropertyName("Name"))
477477
.TypeName(typeof(string).FullName))
478+
.BoundAttributeDescriptor(attribute =>
479+
attribute
480+
.Name("alive")
481+
.Metadata(PropertyName("Alive"))
482+
.TypeName(typeof(bool).FullName))
478483
.BoundAttributeDescriptor(attribute =>
479484
attribute
480485
.Name("tag")
@@ -638,6 +643,61 @@ public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes19()
638643
""");
639644
}
640645

646+
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
647+
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes20()
648+
{
649+
EvaluateData(CodeTagHelperAttributes_Descriptors, """
650+
@{
651+
var isAlive = true;
652+
}
653+
<person alive="!@isAlive" />
654+
""");
655+
}
656+
657+
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
658+
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes21()
659+
{
660+
EvaluateData(CodeTagHelperAttributes_Descriptors, """
661+
@{
662+
var obj = new { Prop = (object)1 };
663+
}
664+
<person age="(int)@obj.Prop" />
665+
""");
666+
}
667+
668+
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
669+
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes22()
670+
{
671+
EvaluateData(CodeTagHelperAttributes_Descriptors, """
672+
@{
673+
var obj = new { Prop = (object)1 };
674+
}
675+
<person tag="new { @params = 1 }" />
676+
""");
677+
}
678+
679+
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
680+
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes23()
681+
{
682+
EvaluateData(
683+
[TagHelperDescriptorBuilder
684+
.Create("InputTagHelper", "SomeAssembly")
685+
.TagMatchingRuleDescriptor(rule => rule.RequireTagName("input"))
686+
.BoundAttributeDescriptor(attribute =>
687+
attribute
688+
.Name("tuple-dictionary")
689+
.Metadata(PropertyName("DictionaryOfBoolAndStringTupleProperty"))
690+
.TypeName(typeof(IDictionary<string, int>).Namespace + ".IDictionary<System.String, (System.Boolean, System.String)>")
691+
.AsDictionaryAttribute("tuple-prefix-", typeof((bool, string)).FullName))
692+
.Build()],
693+
"""
694+
@{
695+
var item = new { Items = new System.List<string>() { "one", "two" } };
696+
}
697+
<input tuple-prefix-test='(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))' />
698+
""");
699+
}
700+
641701
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10426")]
642702
public void CreatesMarkupCodeSpans_EscapedExpression_01()
643703
{

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22

33
@{
44
var count = "1";
5+
var alive = true;
6+
var obj = new { age = (object)1 };
7+
var item = new { Items = new System.List<string>() { "one", "two" } };
58
}
6-
<input age="Convert.ToInt32(@count)" />
9+
<input age="Convert.ToInt32(@count)" alive="!@alive" />
10+
<input age="(int)@obj.age" tag="new { @params = 1 }" />
11+
<input tuple-prefix-test='(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))' />

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs

+36-1
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,50 @@ private void __RazorDirectiveTokenHelpers__() {
4949
#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
5050

5151
var count = "1";
52+
var alive = true;
53+
var obj = new { age = (object)1 };
54+
var item = new { Items = new System.List<string>() { "one", "two" } };
5255

5356
#line default
5457
#line hidden
5558
#nullable disable
5659
__InputTagHelper = CreateTagHelper<global::InputTagHelper>();
5760
#nullable restore
58-
#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
61+
#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
5962
__InputTagHelper.AgeProp = Convert.ToInt32(@count);
6063

64+
#line default
65+
#line hidden
66+
#nullable disable
67+
#nullable restore
68+
#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
69+
__InputTagHelper.AliveProp = !@alive;
70+
71+
#line default
72+
#line hidden
73+
#nullable disable
74+
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
75+
__InputTagHelper = CreateTagHelper<global::InputTagHelper>();
76+
#nullable restore
77+
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
78+
__InputTagHelper.AgeProp = (int)@obj.age;
79+
80+
#line default
81+
#line hidden
82+
#nullable disable
83+
#nullable restore
84+
#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
85+
__InputTagHelper.TagProp = new { @params = 1 };
86+
87+
#line default
88+
#line hidden
89+
#nullable disable
90+
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
91+
__InputTagHelper = CreateTagHelper<global::InputTagHelper>();
92+
#nullable restore
93+
#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml"
94+
__InputTagHelper.DictionaryOfBoolAndStringTupleProperty["test"] = (@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""));
95+
6196
#line default
6297
#line hidden
6398
#nullable disable

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22

33
~~
44
~~~ ~~~~~ ~ ~~~~
5+
~~~ ~~~~~ ~ ~~~~~
6+
~~~ ~~~ ~ ~~~ ~ ~~~ ~ ~~~~~~~~~ ~~
7+
~~~ ~~~~ ~ ~~~ ~ ~~~~~ ~ ~~~ ~~~~~~~~~~~~~~~~~~~~~ ~ ~~~~~~ ~~~~~ ~ ~~
58
~
6-
<input age="~~~~~~~~~~~~~~~~~~~~~~~" />
9+
<input age="~~~~~~~~~~~~~~~~~~~~~~~" alive="~~~~~~~" />
10+
<input age="~~~~~~~~~~~~~" tag="~~~ ~ ~~~~~~~ ~ ~ ~" />
11+
<input tuple-prefix-test='~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~' />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml(7,41): error CS0234: The type or namespace name 'List<>' does not exist in the namespace 'System' (are you missing an assembly reference?)
2+
// var item = new { Items = new System.List<string>() { "one", "two" } };
3+
Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "List<string>").WithArguments("List<>", "System").WithLocation(7, 41)

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.html.mappings.txt

+29-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,41 @@ Generated Location: (31:0,31 [4] )
1212

1313
|
1414

15-
Source Location: (62:4,1 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
15+
Source Location: (201:7,1 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
1616
|
1717
<input age="|
18-
Generated Location: (62:4,1 [14] )
18+
Generated Location: (201:7,1 [14] )
1919
|
2020
<input age="|
2121

22-
Source Location: (99:5,35 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
22+
Source Location: (238:8,35 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
23+
|" alive="|
24+
Generated Location: (238:8,35 [9] )
25+
|" alive="|
26+
27+
Source Location: (254:8,51 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
2328
|" />
24-
|
25-
Generated Location: (99:5,35 [6] )
29+
<input age="|
30+
Generated Location: (254:8,51 [18] )
31+
|" />
32+
<input age="|
33+
34+
Source Location: (285:9,25 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
35+
|" tag="|
36+
Generated Location: (285:9,25 [7] )
37+
|" tag="|
38+
39+
Source Location: (311:9,51 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
40+
|" />
41+
<input tuple-prefix-test='|
42+
Generated Location: (311:9,51 [32] )
2643
|" />
44+
<input tuple-prefix-test='|
45+
46+
Source Location: (467:10,150 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
47+
|' />
48+
|
49+
Generated Location: (467:10,150 [6] )
50+
|' />
2751
|
2852

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt

+27-7
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,36 @@
3737
MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
3838
HtmlContent - (31:0,31 [4] EscapedIdentifier.cshtml)
3939
LazyIntermediateToken - (31:0,31 [4] EscapedIdentifier.cshtml) - Html - \n\n
40-
CSharpCode - (37:2,2 [24] EscapedIdentifier.cshtml)
41-
LazyIntermediateToken - (37:2,2 [24] EscapedIdentifier.cshtml) - CSharp - \n var count = "1";\n
42-
TagHelper - (64:5,0 [39] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing
40+
CSharpCode - (37:2,2 [163] EscapedIdentifier.cshtml)
41+
LazyIntermediateToken - (37:2,2 [163] EscapedIdentifier.cshtml) - CSharp - \n var count = "1";\n var alive = true;\n var obj = new { age = (object)1 };\n var item = new { Items = new System.List<string>() { "one", "two" } };\n
42+
TagHelper - (203:8,0 [55] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing
4343
DefaultTagHelperBody -
4444
DefaultTagHelperCreate - - InputTagHelper
45-
DefaultTagHelperProperty - (76:5,12 [23] EscapedIdentifier.cshtml) - age - int InputTagHelper.AgeProp - HtmlAttributeValueStyle.DoubleQuotes
46-
LazyIntermediateToken - (76:5,12 [23] EscapedIdentifier.cshtml) - CSharp - Convert.ToInt32(@count)
45+
DefaultTagHelperProperty - (215:8,12 [23] EscapedIdentifier.cshtml) - age - int InputTagHelper.AgeProp - HtmlAttributeValueStyle.DoubleQuotes
46+
LazyIntermediateToken - (215:8,12 [23] EscapedIdentifier.cshtml) - CSharp - Convert.ToInt32(@count)
47+
DefaultTagHelperProperty - (247:8,44 [7] EscapedIdentifier.cshtml) - alive - bool InputTagHelper.AliveProp - HtmlAttributeValueStyle.DoubleQuotes
48+
LazyIntermediateToken - (247:8,44 [7] EscapedIdentifier.cshtml) - CSharp - !@alive
4749
DefaultTagHelperExecute -
48-
HtmlContent - (103:5,39 [2] EscapedIdentifier.cshtml)
49-
LazyIntermediateToken - (103:5,39 [2] EscapedIdentifier.cshtml) - Html - \n
50+
HtmlContent - (258:8,55 [2] EscapedIdentifier.cshtml)
51+
LazyIntermediateToken - (258:8,55 [2] EscapedIdentifier.cshtml) - Html - \n
52+
TagHelper - (260:9,0 [55] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing
53+
DefaultTagHelperBody -
54+
DefaultTagHelperCreate - - InputTagHelper
55+
DefaultTagHelperProperty - (272:9,12 [13] EscapedIdentifier.cshtml) - age - int InputTagHelper.AgeProp - HtmlAttributeValueStyle.DoubleQuotes
56+
LazyIntermediateToken - (272:9,12 [13] EscapedIdentifier.cshtml) - CSharp - (int)@obj.age
57+
DefaultTagHelperProperty - (292:9,32 [19] EscapedIdentifier.cshtml) - tag - object InputTagHelper.TagProp - HtmlAttributeValueStyle.DoubleQuotes
58+
LazyIntermediateToken - (292:9,32 [19] EscapedIdentifier.cshtml) - CSharp - new { @params = 1 }
59+
DefaultTagHelperExecute -
60+
HtmlContent - (315:9,55 [2] EscapedIdentifier.cshtml)
61+
LazyIntermediateToken - (315:9,55 [2] EscapedIdentifier.cshtml) - Html - \n
62+
TagHelper - (317:10,0 [154] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing
63+
DefaultTagHelperBody -
64+
DefaultTagHelperCreate - - InputTagHelper
65+
DefaultTagHelperProperty - (343:10,26 [124] EscapedIdentifier.cshtml) - tuple-prefix-test - System.Collections.Generic.IDictionary<System.String, (System.Boolean, System.String)> InputTagHelper.DictionaryOfBoolAndStringTupleProperty - HtmlAttributeValueStyle.SingleQuotes
66+
LazyIntermediateToken - (343:10,26 [124] EscapedIdentifier.cshtml) - CSharp - (@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))
67+
DefaultTagHelperExecute -
68+
HtmlContent - (471:10,154 [2] EscapedIdentifier.cshtml)
69+
LazyIntermediateToken - (471:10,154 [2] EscapedIdentifier.cshtml) - Html - \n
5070
Inject -
5171
Inject -
5272
Inject -

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt

+30-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,43 @@
33
Generated Location: (1707:32,37 [17] )
44
|"*, TestAssembly"|
55

6-
Source Location: (37:2,2 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
6+
Source Location: (37:2,2 [163] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
77
|
88
var count = "1";
9+
var alive = true;
10+
var obj = new { age = (object)1 };
11+
var item = new { Items = new System.List<string>() { "one", "two" } };
912
|
10-
Generated Location: (2215:49,2 [24] )
13+
Generated Location: (2215:49,2 [163] )
1114
|
1215
var count = "1";
16+
var alive = true;
17+
var obj = new { age = (object)1 };
18+
var item = new { Items = new System.List<string>() { "one", "two" } };
1319
|
1420

15-
Source Location: (76:5,12 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
21+
Source Location: (215:8,12 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
1622
|Convert.ToInt32(@count)|
17-
Generated Location: (2503:58,27 [23] )
23+
Generated Location: (2642:61,27 [23] )
1824
|Convert.ToInt32(@count)|
1925

26+
Source Location: (247:8,44 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
27+
|!@alive|
28+
Generated Location: (2874:68,44 [7] )
29+
|!@alive|
30+
31+
Source Location: (272:9,12 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
32+
|(int)@obj.age|
33+
Generated Location: (3225:77,27 [13] )
34+
|(int)@obj.age|
35+
36+
Source Location: (292:9,32 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
37+
|new { @params = 1 }|
38+
Generated Location: (3436:84,32 [19] )
39+
|new { @params = 1 }|
40+
41+
Source Location: (343:10,26 [124] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
42+
|(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))|
43+
Generated Location: (3838:93,66 [124] )
44+
|(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))|
45+

0 commit comments

Comments
 (0)