Revert "Fix: dotnet/aspnetcore-tooling#11197 automatic backing-field for @ref (dotnet/aspnetcore-tooling#707)"

This reverts commit dadf9fa.
\n\nCommit migrated from afddfcb49e
This commit is contained in:
N. Taylor Mullen 2019-08-15 14:07:12 -07:00
parent 9584c7e34f
commit f3536ca403
76 changed files with 326 additions and 864 deletions

View File

@ -196,10 +196,7 @@
<value>route template</value>
</data>
<data name="RefTagHelper_Documentation" xml:space="preserve">
<value>Generates the specified field, and populates it during rendering with a reference to the element or component.</value>
</data>
<data name="RefTagHelper_SuppressField_Documentation" xml:space="preserve">
<value>Suppresses the generation of a field by '@ref'. Specify '@ref:suppressField' to define your own property or field.</value>
<value>Populates the specified field or property with a reference to the element or component.</value>
</data>
<data name="SplatTagHelper_Documentation" xml:space="preserve">
<value>Merges a collection of attributes into the current element or component.</value>

View File

@ -396,35 +396,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return RazorDiagnostic.Create(DuplicateComponentParameterDirective, source ?? SourceSpan.Undefined, attributeName, directiveAttributeName);
}
public static readonly RazorDiagnosticDescriptor RefSuppressFieldNotMinimized =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}10011",
() =>
"The directive attribute '@ref:suppressField' must be used as a minimized attribute. Providing an attribute value like '@ref:suppressField=\"false\"' " +
"is not supported.",
RazorDiagnosticSeverity.Error);
public static RazorDiagnostic Create_RefSuppressFieldNotMinimized(SourceSpan? source = null)
{
return RazorDiagnostic.Create(RefSuppressFieldNotMinimized, source ?? SourceSpan.Undefined);
}
public static readonly RazorDiagnosticDescriptor RefSuppressFieldRequiredForGeneric =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}10012",
() =>
"Using '@ref' on a generic-typed component requires manually defining a field to hold the component reference. Use '@ref:suppressField' to " +
"suppress field generation, and manually define a field inside '@code {{ }}' to contain the reference.",
RazorDiagnosticSeverity.Error);
public static RazorDiagnostic Create_RefSuppressFieldRequiredForGeneric(SourceSpan? source = null)
{
return RazorDiagnostic.Create(RefSuppressFieldRequiredForGeneric, source ?? SourceSpan.Undefined);
}
public static readonly RazorDiagnosticDescriptor ComponentNamesCannotStartWithLowerCase =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}10013",
$"{DiagnosticPrefix}10011",
() => "Component '{0}' starts with a lowercase character. Component names cannot start with a lowercase character.",
RazorDiagnosticSeverity.Error);
@ -438,7 +412,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static readonly RazorDiagnosticDescriptor UnexpectedMarkupElement =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}10014",
$"{DiagnosticPrefix}10012",
() => "Found markup element with unexpected name '{0}'. If this is intended to be a component, add a @using directive for its namespace.",
RazorDiagnosticSeverity.Warning);
@ -452,7 +426,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static readonly RazorDiagnosticDescriptor InconsistentStartAndEndTagName =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}10015",
$"{DiagnosticPrefix}10013",
() => "The start tag name '{0}' does not match the end tag name '{1}'. Components must have matching start and end tag names (case-sensitive).",
RazorDiagnosticSeverity.Error);

View File

@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
namespace Microsoft.AspNetCore.Razor.Language.Components
@ -35,109 +33,34 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
if (node.TagHelper.IsRefTagHelper())
{
// We've found an @ref directive attribute.
//
// If we can't get a nonempty identifier, do nothing because there will
// already be a diagnostic for empty values
var identifier = DetermineIdentifierToken(node);
if (identifier == null)
{
continue;
}
var rewritten = RewriteUsage(reference.Parent, identifier);
reference.Replace(rewritten);
// Now we need to check if the field generation has been suppressed.
//
// You have to suppress field generation for generic types because we don't know the
// type name to create the field.
var generateField = ShouldGenerateField(reference.Parent);
// Insert the field with other fields, near the top of the class.
if (generateField)
{
var position = 0;
while (position < @class.Children.Count && @class.Children[i] is FieldDeclarationIntermediateNode)
{
position++;
}
@class.Children.Insert(position, CreateField(rewritten.FieldTypeName, identifier));
}
reference.Replace(RewriteUsage(@class, reference.Parent, node));
}
}
}
private ReferenceCaptureIntermediateNode RewriteUsage(IntermediateNode parent, IntermediateToken identifier)
private IntermediateNode RewriteUsage(ClassDeclarationIntermediateNode classNode, IntermediateNode parent, TagHelperDirectiveAttributeIntermediateNode node)
{
// If we can't get a nonempty attribute name, do nothing because there will
// already be a diagnostic for empty values
var identifierToken = DetermineIdentifierToken(node);
if (identifierToken == null)
{
return node;
}
// Determine whether this is an element capture or a component capture, and
// if applicable the type name that will appear in the resulting capture code
var componentTagHelper = (parent as ComponentIntermediateNode)?.Component;
if (componentTagHelper != null)
{
return new ReferenceCaptureIntermediateNode(identifier, componentTagHelper.GetTypeName());
return new ReferenceCaptureIntermediateNode(identifierToken, componentTagHelper.GetTypeName());
}
else
{
return new ReferenceCaptureIntermediateNode(identifier);
return new ReferenceCaptureIntermediateNode(identifierToken);
}
}
private bool ShouldGenerateField(IntermediateNode parent)
{
var parameters = parent.FindDescendantNodes<TagHelperDirectiveAttributeParameterIntermediateNode>();
for (var i = 0; i < parameters.Count; i++)
{
var parameter = parameters[i];
if (parameter.TagHelper.IsRefTagHelper() && parameter.BoundAttributeParameter.Name == "suppressField")
{
if (parameter.HasDiagnostics)
{
parent.Diagnostics.AddRange(parameter.GetAllDiagnostics());
}
parent.Children.Remove(parameter);
if (parameter.AttributeStructure == AttributeStructure.Minimized)
{
return false;
}
// We do not support non-minimized attributes here because we can't allow the value to be dynamic.
// As a design/experience decision, we don't let you write @ref:suppressField="false" even though
// we could parse it. The rationale is that it's misleading, you type something that looks like code,
// but it's not really.
parent.Diagnostics.Add(ComponentDiagnosticFactory.Create_RefSuppressFieldNotMinimized(parameter.Source));
}
}
if (parent is ComponentIntermediateNode component && component.Component.IsGenericTypedComponent())
{
// We cannot automatically generate a 'ref' field for generic components because we don't know
// how to write the type.
parent.Diagnostics.Add(ComponentDiagnosticFactory.Create_RefSuppressFieldRequiredForGeneric(parent.Source));
return false;
}
return true;
}
private IntermediateNode CreateField(string fieldType, IntermediateToken identifier)
{
return new FieldDeclarationIntermediateNode()
{
FieldName = identifier.Content,
FieldType = fieldType,
Modifiers = { "private" },
SuppressWarnings =
{
"0414", // Field is assigned by never used
"0169", // Field is never used
},
};
}
private IntermediateToken DetermineIdentifierToken(TagHelperDirectiveAttributeIntermediateNode attributeNode)
{
IntermediateToken foundToken = null;

View File

@ -8,8 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
{
internal sealed class EliminateMethodBodyPass : IntermediateNodePassBase, IRazorOptimizationPass
{
// Run early in the optimization phase
public override int Order => int.MinValue;
// Run late in the optimization phase
public override int Order => int.MaxValue;
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode)
{

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate

View File

@ -163,7 +163,7 @@ Some Content
// Assert
Assert.Collection(
generated.Diagnostics,
d => Assert.Equal("RZ10014", d.Id),
d => Assert.Equal("RZ10012", d.Id),
d => Assert.Equal("RZ9996", d.Id));
}

View File

@ -3305,39 +3305,10 @@ namespace Test
// Act
var generated = CompileToCSharp(@"
<MyComponent TItem=int Item=""3"" @ref=""_my"" />
@code {
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
}
", throwOnFailure: false);
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Same(diagnostic.Id, ComponentDiagnosticFactory.RefSuppressFieldRequiredForGeneric.Id);
}
[Fact]
public void GenericComponent_WithComponentRef_SuppressField()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent<TItem> : ComponentBase
{
[Parameter] public TItem Item { get; set; }
}
}
"));
// Act
var generated = CompileToCSharp(@"
<MyComponent TItem=int Item=""3"" @ref=""_my"" @ref:suppressField />
@code {
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
}
");
@ -3367,38 +3338,6 @@ namespace Test
var generated = CompileToCSharp(@"
<MyComponent Item=""3"" @ref=""_my"" />
@code {
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
}
", throwOnFailure: true);
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Same(diagnostic.Id, ComponentDiagnosticFactory.RefSuppressFieldRequiredForGeneric.Id);
}
[Fact]
public void GenericComponent_WithComponentRef_TypeInference_SuppressField()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent<TItem> : ComponentBase
{
[Parameter] public TItem Item { get; set; }
}
}
"));
// Act
var generated = CompileToCSharp(@"
<MyComponent Item=""3"" @ref=""_my"" @ref:suppressField />
@code {
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
@ -3900,7 +3839,13 @@ namespace Test
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem attributebefore=""before"" @ref=""myElem"" attributeafter=""after"">Hello</elem>");
<elem attributebefore=""before"" @ref=""myElem"" attributeafter=""after"">Hello</elem>
@code {
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -3916,7 +3861,10 @@ namespace Test
<input type=""text"" data-slider-min=""@Min"" @ref=""@_element"" />
@code {
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
}
");
@ -3926,35 +3874,6 @@ namespace Test
CompileToAssembly(generated);
}
[Fact]
public void Element_WithRef_SuppressField()
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem @ref=""myElem"" @ref:suppressField>Hello</elem>
@code {
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
}");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Element_WithRef_SuppressFieldWithValue_ResultsInDiagnostic()
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem @ref=""myElem"" @ref:suppressField=""false"">Hello</elem>", throwOnFailure: false);
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Same(diagnostic.Id, ComponentDiagnosticFactory.RefSuppressFieldNotMinimized.Id);
}
[Fact]
public void Component_WithRef()
{
@ -3972,7 +3891,13 @@ namespace Test
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent ParamBefore=""before"" @ref=""myInstance"" ParamAfter=""after"" />");
<MyComponent ParamBefore=""before"" @ref=""myInstance"" ParamAfter=""after"" />
@code {
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -4000,36 +3925,12 @@ namespace Test
<MyComponent @ref=""myInstance"" SomeProp=""val"">
Some <el>further</el> content
</MyComponent>
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Component_WithRef_SuppressField()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent : ComponentBase
{
}
}
"));
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent @ref=""myInstance"" @ref:suppressField />
@code {
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
}");
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);

View File

@ -140,7 +140,7 @@ namespace Test
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Equal("RZ10013", diagnostic.Id);
Assert.Equal("RZ10011", diagnostic.Id);
Assert.Equal(
"Component 'lowerCase' starts with a lowercase character. Component names cannot start with a lowercase character.",
diagnostic.GetMessage());
@ -159,7 +159,7 @@ namespace Test
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Equal("RZ10014", diagnostic.Id);
Assert.Equal("RZ10012", diagnostic.Id);
Assert.Equal(RazorDiagnosticSeverity.Warning, diagnostic.Severity);
Assert.Equal(
"Found markup element with unexpected name 'PossibleComponent'. If this is intended to be a component, add a @using directive for its namespace.",
@ -196,7 +196,7 @@ namespace Test
// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Equal("RZ10015", diagnostic.Id);
Assert.Equal("RZ10013", diagnostic.Id);
Assert.Equal(
"The start tag name 'MyComponent' does not match the end tag name 'mycomponent'. Components must have matching start and end tag names (case-sensitive).",
diagnostic.GetMessage());

View File

@ -1 +1 @@
x:\dir\subdir\Test\TestComponent.cshtml(4,1): Warning RZ10014: Found markup element with unexpected name 'SomeComponent'. If this is intended to be a component, add a @using directive for its namespace.
x:\dir\subdir\Test\TestComponent.cshtml(4,1): Warning RZ10012: Found markup element with unexpected name 'SomeComponent'. If this is intended to be a component, add a @using directive for its namespace.

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent myInstance;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
@ -46,6 +41,15 @@ __o = typeof(MyComponent);
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent - myInstance
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
@ -23,3 +22,9 @@ Document -
ComponentAttribute - - ParamAfter - AttributeStructure.DoubleQuotes
HtmlContent - (64:0,64 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (64:0,64 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (73:0,73 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (73:0,73 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (189:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (189:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n

View File

@ -1,5 +1,16 @@
Source Location: (40:0,40 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (1283:34,40 [10] )
Generated Location: (1085:29,40 [10] )
|myInstance|
Source Location: (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|
Generated Location: (1450:45,7 [104] )
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|

View File

@ -1,53 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
));
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myInstance = default(Test.MyComponent);
#line default
#line hidden
#nullable disable
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(MyComponent);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -1,22 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [52] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ReferenceCapture - (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml) - myInstance
HtmlContent - (52:0,52 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (52:0,52 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n MyComponent myInstance;\n void DoStuff() { GC.KeepAlive(myInstance); }\n

View File

@ -1,16 +0,0 @@
Source Location: (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (1018:27,19 [10] )
|myInstance|
Source Location: (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml)
|
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
|
Generated Location: (1383:43,7 [81] )
|
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent myInstance;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
@ -45,6 +40,15 @@ __o = typeof(MyComponent);
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 5 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent - myInstance
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
@ -28,5 +27,9 @@ Document -
ComponentAttribute - - SomeProp - AttributeStructure.DoubleQuotes
HtmlContent - (41:0,41 [3] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (41:0,41 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - val
HtmlContent - (97:2,14 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (97:2,14 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
HtmlContent - (97:2,14 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (97:2,14 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (213:7,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (213:7,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n

View File

@ -1,5 +1,16 @@
Source Location: (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (1239:33,19 [10] )
Generated Location: (1041:28,19 [10] )
|myInstance|
Source Location: (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|
Generated Location: (1406:44,7 [104] )
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementReference myElem;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
@ -34,6 +29,15 @@ namespace Test
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementReference - myElem
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
@ -25,3 +24,9 @@ Document -
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (61:0,61 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (61:0,61 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (80:0,80 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (80:0,80 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (220:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (220:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Microsoft.AspNetCore.Components.ElementReference myElem;\n public void Foo() { System.GC.KeepAlive(myElem); }\n

View File

@ -1,5 +1,16 @@
Source Location: (37:0,37 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (1115:29,37 [6] )
Generated Location: (881:24,37 [6] )
|myElem|
Source Location: (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
|
Generated Location: (1126:33,7 [128] )
|
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementReference _element;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
@ -46,7 +41,10 @@ namespace Test
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
#line default

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementReference - _element
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
@ -25,7 +24,7 @@ Document -
ReferenceCapture - (49:0,49 [8] x:\dir\subdir\Test\TestComponent.cshtml) - _element
HtmlContent - (61:0,61 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (61:0,61 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (129:4,5 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (129:4,5 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter] public int Min { get; set; }\n
HtmlContent - (237:7,5 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (237:7,5 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private ElementReference _element;\n\n [Parameter] public int Min { get; set; }\n public void Foo() { System.GC.KeepAlive(_element); }\n

View File

@ -1,19 +1,25 @@
Source Location: (37:0,37 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|Min|
Generated Location: (1137:30,37 [3] )
Generated Location: (901:25,37 [3] )
|Min|
Source Location: (49:0,49 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|_element|
Generated Location: (1326:38,49 [8] )
Generated Location: (1090:33,49 [8] )
|_element|
Source Location: (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml)
|
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
|
Generated Location: (1573:47,7 [56] )
Generated Location: (1337:42,7 [164] )
|
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
|

View File

@ -1,43 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myElem = default(Microsoft.AspNetCore.Components.ElementReference);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -1,24 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (39:0,39 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (39:0,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
ReferenceCapture - (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml) - myElem
HtmlContent - (51:0,51 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (51:0,51 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n ElementReference myElem;\n void DoStuff() { GC.KeepAlive(myElem); }\n

View File

@ -1,16 +0,0 @@
Source Location: (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (856:24,12 [6] )
|myElem|
Source Location: (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml)
|
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
|
Generated Location: (1101:33,7 [78] )
|
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
|

View File

@ -1,39 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementRef myElem;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myElem = default(Microsoft.AspNetCore.Components.ElementRef);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591

View File

@ -1 +0,0 @@
x:\dir\subdir\Test\TestComponent.cshtml(1,41): Error RZ10011: The directive attribute '@ref:suppressField' must be used as a minimized attribute. Providing an attribute value like '@ref:suppressField="false" is not supported.

View File

@ -1,21 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementRef - myElem
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [59] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (47:0,47 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (47:0,47 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
ReferenceCapture - (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml) - myElem

View File

@ -1,5 +0,0 @@
Source Location: (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (1083:29,12 [6] )
|myElem|

View File

@ -58,10 +58,10 @@ __o = typeof(MyComponent<>);
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
#line default
#line hidden

View File

@ -14,15 +14,15 @@ Document -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
Component - (0:0,0 [45] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentTypeArgument - (19:0,19 [3] x:\dir\subdir\Test\TestComponent.cshtml) - TItem
IntermediateToken - (19:0,19 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - int
ComponentAttribute - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes
IntermediateToken - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 3
ReferenceCapture - (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml) - _my
HtmlContent - (64:0,64 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (64:0,64 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
HtmlContent - (146:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (146:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n MyComponent<int> _my;\n void DoStuff() { GC.KeepAlive(_my); }\n
HtmlContent - (45:0,45 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (45:0,45 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (147:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (147:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n

View File

@ -13,14 +13,14 @@ Source Location: (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (1491:45,38 [3] )
|_my|
Source Location: (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
|
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|
Generated Location: (1856:61,7 [72] )
Generated Location: (1856:61,7 [90] )
|
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|

View File

@ -14,16 +14,16 @@ Document -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [54] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
Component - (0:0,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (19:0,19 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes
IntermediateToken - (19:0,19 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 3
ReferenceCapture - (28:0,28 [3] x:\dir\subdir\Test\TestComponent.cshtml) - _my
HtmlContent - (54:0,54 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (54:0,54 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (156:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (156:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n
HtmlContent - (35:0,35 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (35:0,35 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (137:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (137:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n
NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -8,7 +8,7 @@ Source Location: (28:0,28 [3] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (1143:33,28 [3] )
|_my|
Source Location: (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }

View File

@ -1 +1 @@
x:\dir\subdir\Test\TestComponent.cshtml(4,1): Warning RZ10014: Found markup element with unexpected name 'SomeComponent'. If this is intended to be a component, add a @using directive for its namespace.
x:\dir\subdir\Test\TestComponent.cshtml(4,1): Warning RZ10012: Found markup element with unexpected name 'SomeComponent'. If this is intended to be a component, add a @using directive for its namespace.

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent myInstance;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
@ -34,6 +29,15 @@ namespace Test
__builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent - myInstance
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - ParamBefore - AttributeStructure.DoubleQuotes
@ -16,3 +15,5 @@ Document -
ComponentAttribute - - ParamAfter - AttributeStructure.DoubleQuotes
HtmlContent - (64:0,64 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (64:0,64 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n

View File

@ -1,5 +1,16 @@
Source Location: (40:0,40 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (1071:26,40 [10] )
Generated Location: (873:21,40 [10] )
|myInstance|
Source Location: (84:2,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|
Generated Location: (1162:33,7 [104] )
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|

View File

@ -1,41 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenComponent<Test.MyComponent>(0);
__builder.AddComponentReferenceCapture(1, (__value) => {
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myInstance = (Test.MyComponent)__value;
#line default
#line hidden
#nullable disable
}
);
__builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -1,13 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [52] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ReferenceCapture - (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml) - myInstance
CSharpCode - (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n MyComponent myInstance;\n void DoStuff() { GC.KeepAlive(myInstance); }\n

View File

@ -1,16 +0,0 @@
Source Location: (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (724:19,19 [10] )
|myInstance|
Source Location: (61:1,7 [81] x:\dir\subdir\Test\TestComponent.cshtml)
|
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
|
Generated Location: (1013:31,7 [81] )
|
MyComponent myInstance;
void DoStuff() { GC.KeepAlive(myInstance); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent myInstance;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
@ -38,6 +33,15 @@ namespace Test
__builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 5 "x:\dir\subdir\Test\TestComponent.cshtml"
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent - myInstance
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [97] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentChildContent - - ChildContent - context
@ -17,3 +16,5 @@ Document -
ComponentAttribute - - SomeProp - AttributeStructure.DoubleQuotes
HtmlContent - (41:0,41 [3] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (41:0,41 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - val
CSharpCode - (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Test.MyComponent myInstance;\n public void Foo() { System.GC.KeepAlive(myInstance); }\n

View File

@ -1,5 +1,16 @@
Source Location: (19:0,19 [10] x:\dir\subdir\Test\TestComponent.cshtml)
|myInstance|
Generated Location: (1282:32,19 [10] )
Generated Location: (1084:27,19 [10] )
|myInstance|
Source Location: (108:4,7 [104] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|
Generated Location: (1373:39,7 [104] )
|
private Test.MyComponent myInstance;
public void Foo() { System.GC.KeepAlive(myInstance); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementReference myElem;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
@ -35,6 +30,15 @@ namespace Test
__builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementReference - myElem
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [80] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (68:0,68 [5] x:\dir\subdir\Test\TestComponent.cshtml)
@ -18,3 +17,5 @@ Document -
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (61:0,61 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (61:0,61 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Microsoft.AspNetCore.Components.ElementReference myElem;\n public void Foo() { System.GC.KeepAlive(myElem); }\n

View File

@ -1,5 +1,16 @@
Source Location: (37:0,37 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (1098:26,37 [6] )
Generated Location: (864:21,37 [6] )
|myElem|
Source Location: (91:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
|
Generated Location: (1176:34,7 [128] )
|
private Microsoft.AspNetCore.Components.ElementReference myElem;
public void Foo() { System.GC.KeepAlive(myElem); }
|

View File

@ -10,11 +10,6 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementReference _element;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
@ -45,7 +40,10 @@ namespace Test
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
#line default

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementReference - _element
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [61] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - - type=" - "
@ -16,5 +15,5 @@ Document -
CSharpExpressionAttributeValue - (36:0,36 [4] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (37:0,37 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - Min
ReferenceCapture - (49:0,49 [8] x:\dir\subdir\Test\TestComponent.cshtml) - _element
CSharpCode - (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter] public int Min { get; set; }\n
CSharpCode - (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private ElementReference _element;\n\n [Parameter] public int Min { get; set; }\n public void Foo() { System.GC.KeepAlive(_element); }\n

View File

@ -1,14 +1,20 @@
Source Location: (49:0,49 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|_element|
Generated Location: (1270:34,49 [8] )
Generated Location: (1034:29,49 [8] )
|_element|
Source Location: (72:2,7 [56] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (72:2,7 [164] x:\dir\subdir\Test\TestComponent.cshtml)
|
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
|
Generated Location: (1537:46,7 [56] )
Generated Location: (1301:41,7 [164] )
|
private ElementReference _element;
[Parameter] public int Min { get; set; }
public void Foo() { System.GC.KeepAlive(_element); }
|

View File

@ -1,42 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenElement(0, "elem");
__builder.AddElementReferenceCapture(1, (__value) => {
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myElem = __value;
#line default
#line hidden
#nullable disable
}
);
__builder.AddContent(2, "Hello");
__builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -1,15 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (39:0,39 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (39:0,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
ReferenceCapture - (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml) - myElem
CSharpCode - (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n ElementReference myElem;\n void DoStuff() { GC.KeepAlive(myElem); }\n

View File

@ -1,16 +0,0 @@
Source Location: (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (703:19,12 [6] )
|myElem|
Source Location: (60:1,7 [78] x:\dir\subdir\Test\TestComponent.cshtml)
|
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
|
Generated Location: (1015:32,7 [78] )
|
ElementReference myElem;
void DoStuff() { GC.KeepAlive(myElem); }
|

View File

@ -1,38 +0,0 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private global::Microsoft.AspNetCore.Components.ElementRef myElem;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddElementReferenceCapture(1, (__value) => {
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
myElem = __value;
#line default
#line hidden
#nullable disable
}
);
builder.AddContent(2, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591

View File

@ -1 +0,0 @@
x:\dir\subdir\Test\TestComponent.cshtml(1,41): Error RZ10011: The directive attribute '@ref:suppressField' must be used as a minimized attribute. Providing an attribute value like '@ref:suppressField="false" is not supported.

View File

@ -1,14 +0,0 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - global::Microsoft.AspNetCore.Components.ElementRef - myElem
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [59] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (47:0,47 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (47:0,47 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
ReferenceCapture - (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml) - myElem

View File

@ -1,5 +0,0 @@
Source Location: (12:0,12 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|myElem|
Generated Location: (926:24,12 [6] )
|myElem|

View File

@ -10,16 +10,11 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent<TItem> _my;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
builder.OpenComponent<Test.MyComponent<int>>(0);
builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<int>(
__builder.OpenComponent<Test.MyComponent<int>>(0);
__builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<int>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
3
@ -28,7 +23,7 @@ namespace Test
#line hidden
#nullable disable
));
builder.AddComponentReferenceCapture(2, (__value) => {
__builder.AddComponentReferenceCapture(2, (__value) => {
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
_my = (Test.MyComponent<int>)__value;
@ -38,9 +33,18 @@ namespace Test
#nullable disable
}
);
builder.CloseComponent();
__builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent<TItem> - _my
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [45] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentTypeArgument - (19:0,19 [3] x:\dir\subdir\Test\TestComponent.cshtml) - TItem
@ -14,3 +13,5 @@ Document -
ComponentAttribute - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes
IntermediateToken - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 3
ReferenceCapture - (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml) - _my
CSharpCode - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n

View File

@ -1,5 +1,16 @@
Source Location: (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|_my|
Generated Location: (1218:33,38 [3] )
Generated Location: (1044:28,38 [3] )
|_my|
Source Location: (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|
Generated Location: (1331:40,7 [90] )
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|

View File

@ -37,10 +37,10 @@ namespace Test
}
#pragma warning restore 1998
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
#line default
#line hidden

View File

@ -7,11 +7,11 @@ Document -
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
Component - (0:0,0 [45] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentTypeArgument - (19:0,19 [3] x:\dir\subdir\Test\TestComponent.cshtml) - TItem
IntermediateToken - (19:0,19 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - int
ComponentAttribute - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes
IntermediateToken - (29:0,29 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 3
ReferenceCapture - (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml) - _my
CSharpCode - (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n MyComponent<int> _my;\n void DoStuff() { GC.KeepAlive(_my); }\n
CSharpCode - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n

View File

@ -0,0 +1,16 @@
Source Location: (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|_my|
Generated Location: (1044:28,38 [3] )
|_my|
Source Location: (56:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|
Generated Location: (1331:40,7 [90] )
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|

View File

@ -1,16 +0,0 @@
Source Location: (38:0,38 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|_my|
Generated Location: (1044:28,38 [3] )
|_my|
Source Location: (73:1,7 [72] x:\dir\subdir\Test\TestComponent.cshtml)
|
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
|
Generated Location: (1331:40,7 [72] )
|
MyComponent<int> _my;
void DoStuff() { GC.KeepAlive(_my); }
|

View File

@ -10,15 +10,10 @@ namespace Test
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 0414
#pragma warning disable 0169
private Test.MyComponent<TItem> _my;
#pragma warning restore 0169
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1,
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
3
@ -54,12 +49,12 @@ namespace __Blazor.Test.TestComponent
#line hidden
internal static class TypeInference
{
public static void CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder, int seq, int __seq0, TItem __arg0, int __seq1, global::System.Action<global::Test.MyComponent<TItem>> __arg1)
public static void CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TItem __arg0, int __seq1, global::System.Action<global::Test.MyComponent<TItem>> __arg1)
{
builder.OpenComponent<global::Test.MyComponent<TItem>>(seq);
builder.AddAttribute(__seq0, "Item", __arg0);
builder.AddComponentReferenceCapture(__seq1, (__value) => { __arg1((global::Test.MyComponent<TItem>)__value); });
builder.CloseComponent();
__builder.OpenComponent<global::Test.MyComponent<TItem>>(seq);
__builder.AddAttribute(__seq0, "Item", __arg0);
__builder.AddComponentReferenceCapture(__seq1, (__value) => { __arg1((global::Test.MyComponent<TItem>)__value); });
__builder.CloseComponent();
}
}
}

View File

@ -6,7 +6,6 @@ Document -
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
FieldDeclaration - - private - Test.MyComponent<TItem> - _my
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (19:0,19 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes

View File

@ -1,6 +1,6 @@
Source Location: (28:0,28 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|_my|
Generated Location: (1067:31,28 [3] )
Generated Location: (872:26,28 [3] )
|_my|
Source Location: (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
@ -8,7 +8,7 @@ Source Location: (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }
|
Generated Location: (1290:42,7 [90] )
Generated Location: (1095:37,7 [90] )
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }

View File

@ -7,12 +7,12 @@ Document -
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [54] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
Component - (0:0,0 [35] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (19:0,19 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Item - AttributeStructure.DoubleQuotes
IntermediateToken - (19:0,19 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 3
ReferenceCapture - (28:0,28 [3] x:\dir\subdir\Test\TestComponent.cshtml) - _my
CSharpCode - (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n
CSharpCode - (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private MyComponent<int> _my;\n public void Foo() { System.GC.KeepAlive(_my); }\n
NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -3,7 +3,7 @@ Source Location: (28:0,28 [3] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (872:26,28 [3] )
|_my|
Source Location: (65:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (46:2,7 [90] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyComponent<int> _my;
public void Foo() { System.GC.KeepAlive(_my); }

View File

@ -62,24 +62,16 @@ namespace Microsoft.CodeAnalysis.Razor
});
});
builder.BindAttribute(@ref =>
builder.BindAttribute(attribute =>
{
@ref.Documentation = ComponentResources.RefTagHelper_Documentation;
@ref.Name = "@ref";
attribute.Documentation = ComponentResources.RefTagHelper_Documentation;
attribute.Name = "@ref";
// WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips.
@ref.SetPropertyName("Ref");
@ref.TypeName = typeof(object).FullName;
@ref.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString;
@ref.BindAttributeParameter(suppressField =>
{
suppressField.Name = "suppressField";
suppressField.Documentation = ComponentResources.RefTagHelper_SuppressField_Documentation;
suppressField.TypeName = typeof(bool).FullName;
suppressField.SetPropertyName("SuppressField");
});
attribute.SetPropertyName("Ref");
attribute.TypeName = typeof(object).FullName;
attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString;
});
return builder.Build();

View File

@ -39,7 +39,7 @@ namespace Microsoft.CodeAnalysis.Razor
Assert.True(item.CaseSensitive);
Assert.Equal(
"Generates the specified field, and populates it during rendering with a reference to the element or component.",
"Populates the specified field or property with a reference to the element or component.",
item.Documentation);
Assert.Equal("Microsoft.AspNetCore.Components", item.AssemblyName);
@ -75,7 +75,7 @@ namespace Microsoft.CodeAnalysis.Razor
Assert.False(attribute.IsIndexerStringProperty);
Assert.Equal(
"Generates the specified field, and populates it during rendering with a reference to the element or component.",
"Populates the specified field or property with a reference to the element or component.",
attribute.Documentation);
Assert.Equal("@ref", attribute.Name);
@ -85,13 +85,6 @@ namespace Microsoft.CodeAnalysis.Razor
Assert.False(attribute.IsStringProperty);
Assert.False(attribute.IsBooleanProperty);
Assert.False(attribute.IsEnum);
var parameter = Assert.Single(attribute.BoundAttributeParameters);
Assert.Empty(parameter.Diagnostics);
Assert.Equal(":suppressField", parameter.DisplayName);
Assert.Equal("Suppresses the generation of a field by '@ref'. Specify '@ref:suppressField' to define your own property or field.", parameter.Documentation);
Assert.True(parameter.IsBooleanProperty);
Assert.Equal("suppressField", parameter.Name);
}
}
}

View File

@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Verify component compilation succeeded
Assert.AssemblyContainsType(result, Path.Combine(OutputPath, "ComponentApp.dll"), "ComponentApp.Components.Pages.Counter");
Assert.BuildWarning(result, "RZ10014");
Assert.BuildWarning(result, "RZ10012");
}
[Fact]