Modify tag helper infrastructure to configure case sensitivity (dotnet/aspnetcore-tooling#793)
* Modify tag helper infrastructure to configure case sensitivity
* Cleanup and added more tests
* More cleanup and added necessary diagnostics
* More feedback
* Added more tests
\n\nCommit migrated from 20b8286751
This commit is contained in:
parent
810e32ffc4
commit
7aeaa72f25
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
|
|||
provider.Execute(context);
|
||||
|
||||
// Assert
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.CaseSensitive.Equals(d, expectedDescriptor));
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.Default.Equals(d, expectedDescriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -210,7 +210,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
provider.Execute(context);
|
||||
|
||||
// Assert
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.CaseSensitive.Equals(d, expectedDescriptor));
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.Default.Equals(d, expectedDescriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -210,7 +210,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var descriptor = factory.CreateDescriptor(viewComponent);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -1,9 +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.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
|
|
@ -66,7 +63,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
provider.Execute(context);
|
||||
|
||||
// Assert
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.CaseSensitive.Equals(d, expectedDescriptor));
|
||||
Assert.Single(context.Results, d => TagHelperDescriptorComparer.Default.Equals(d, expectedDescriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
|
|
@ -16,27 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public static readonly AllowedChildTagDescriptorComparer Default =
|
||||
new AllowedChildTagDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="AllowedChildTagDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly AllowedChildTagDescriptorComparer CaseSensitive =
|
||||
new AllowedChildTagDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
|
||||
private AllowedChildTagDescriptorComparer(bool caseSensitive = false)
|
||||
private AllowedChildTagDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
@ -55,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
return
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, _stringComparison) &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.DisplayName, descriptorY.DisplayName, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public virtual int GetHashCode(AllowedChildTagDescriptor descriptor)
|
||||
{
|
||||
var hash = HashCodeCombiner.Start();
|
||||
hash.Add(descriptor.Name, _stringComparer);
|
||||
hash.Add(descriptor.Name, StringComparer.Ordinal);
|
||||
|
||||
return hash.CombinedHash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public string DisplayName { get; protected set; }
|
||||
|
||||
public bool CaseSensitive { get; protected set; }
|
||||
|
||||
public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; }
|
||||
|
||||
public IReadOnlyDictionary<string, string> Metadata { get; protected set; }
|
||||
|
|
|
|||
|
|
@ -15,27 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// </summary>
|
||||
public static readonly BoundAttributeDescriptorComparer Default = new BoundAttributeDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="BoundAttributeDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly BoundAttributeDescriptorComparer CaseSensitive =
|
||||
new BoundAttributeDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
|
||||
private BoundAttributeDescriptorComparer(bool caseSensitive = false)
|
||||
private BoundAttributeDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(BoundAttributeDescriptor descriptorX, BoundAttributeDescriptor descriptorY)
|
||||
|
|
@ -55,8 +36,9 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
descriptorX.IsIndexerStringProperty == descriptorY.IsIndexerStringProperty &&
|
||||
descriptorX.IsEnum == descriptorY.IsEnum &&
|
||||
descriptorX.HasIndexer == descriptorY.HasIndexer &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, _stringComparison) &&
|
||||
string.Equals(descriptorX.IndexerNamePrefix, descriptorY.IndexerNamePrefix, _stringComparison) &&
|
||||
descriptorX.CaseSensitive == descriptorY.CaseSensitive &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.IndexerNamePrefix, descriptorY.IndexerNamePrefix, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.TypeName, descriptorY.TypeName, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.IndexerTypeName, descriptorY.IndexerTypeName, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.Documentation, descriptorY.Documentation, StringComparison.Ordinal) &&
|
||||
|
|
@ -75,7 +57,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var hash = HashCodeCombiner.Start();
|
||||
hash.Add(descriptor.Kind);
|
||||
hash.Add(descriptor.Name, _stringComparer);
|
||||
hash.Add(descriptor.Name, StringComparer.Ordinal);
|
||||
|
||||
return hash.CombinedHash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public string DisplayName { get; protected set; }
|
||||
|
||||
public bool CaseSensitive { get; protected set; }
|
||||
|
||||
public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; }
|
||||
|
||||
public IReadOnlyDictionary<string, string> Metadata { get; protected set; }
|
||||
|
|
|
|||
|
|
@ -15,27 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// </summary>
|
||||
public static readonly BoundAttributeParameterDescriptorComparer Default = new BoundAttributeParameterDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="BoundAttributeParameterDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly BoundAttributeParameterDescriptorComparer CaseSensitive =
|
||||
new BoundAttributeParameterDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
|
||||
private BoundAttributeParameterDescriptorComparer(bool caseSensitive = false)
|
||||
private BoundAttributeParameterDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(BoundAttributeParameterDescriptor descriptorX, BoundAttributeParameterDescriptor descriptorY)
|
||||
|
|
@ -53,7 +34,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
return
|
||||
string.Equals(descriptorX.Kind, descriptorY.Kind, StringComparison.Ordinal) &&
|
||||
descriptorX.IsEnum == descriptorY.IsEnum &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, _stringComparison) &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.TypeName, descriptorY.TypeName, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.Documentation, descriptorY.Documentation, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.DisplayName, descriptorY.DisplayName, StringComparison.Ordinal) &&
|
||||
|
|
@ -71,7 +52,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var hash = HashCodeCombiner.Start();
|
||||
hash.Add(descriptor.Kind);
|
||||
hash.Add(descriptor.Name, _stringComparer);
|
||||
hash.Add(descriptor.Name, StringComparer.Ordinal);
|
||||
|
||||
return hash.CombinedHash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,5 +421,48 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
|||
{
|
||||
return RazorDiagnostic.Create(RefSuppressFieldRequiredForGeneric, source ?? SourceSpan.Undefined);
|
||||
}
|
||||
|
||||
public static readonly RazorDiagnosticDescriptor ComponentNamesCannotStartWithLowerCase =
|
||||
new RazorDiagnosticDescriptor(
|
||||
$"{DiagnosticPrefix}10013",
|
||||
() => "Component '{0}' starts with a lowercase character. Component names cannot start with a lowercase character.",
|
||||
RazorDiagnosticSeverity.Error);
|
||||
|
||||
public static RazorDiagnostic Create_ComponentNamesCannotStartWithLowerCase(string componentName, SourceSpan? source = null)
|
||||
{
|
||||
return RazorDiagnostic.Create(
|
||||
ComponentNamesCannotStartWithLowerCase,
|
||||
source ?? SourceSpan.Undefined,
|
||||
componentName);
|
||||
}
|
||||
|
||||
public static readonly RazorDiagnosticDescriptor UnexpectedMarkupElement =
|
||||
new RazorDiagnosticDescriptor(
|
||||
$"{DiagnosticPrefix}10014",
|
||||
() => "Found markup element with unexpected name '{0}'. If this is intended to be a component, add a @using directive for its namespace.",
|
||||
RazorDiagnosticSeverity.Warning);
|
||||
|
||||
public static RazorDiagnostic Create_UnexpectedMarkupElement(string elementName, SourceSpan? source = null)
|
||||
{
|
||||
return RazorDiagnostic.Create(
|
||||
UnexpectedMarkupElement,
|
||||
source ?? SourceSpan.Undefined,
|
||||
elementName);
|
||||
}
|
||||
|
||||
public static readonly RazorDiagnosticDescriptor InconsistentStartAndEndTagName =
|
||||
new RazorDiagnosticDescriptor(
|
||||
$"{DiagnosticPrefix}10015",
|
||||
() => "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);
|
||||
|
||||
public static RazorDiagnostic Create_InconsistentStartAndEndTagName(string startTagName, string endTagName, SourceSpan? source = null)
|
||||
{
|
||||
return RazorDiagnostic.Create(
|
||||
InconsistentStartAndEndTagName,
|
||||
source ?? SourceSpan.Undefined,
|
||||
startTagName,
|
||||
endTagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
|||
computedClass = $"AspNetCore_{checksum}";
|
||||
}
|
||||
|
||||
var documentNode = codeDocument.GetDocumentIntermediateNode();
|
||||
if (char.IsLower(computedClass, 0))
|
||||
{
|
||||
// We don't allow component names to start with a lowercase character.
|
||||
documentNode.Diagnostics.Add(
|
||||
ComponentDiagnosticFactory.Create_ComponentNamesCannotStartWithLowerCase(computedClass, documentNode.Source));
|
||||
}
|
||||
|
||||
if (MangleClassNames)
|
||||
{
|
||||
computedClass = ComponentMetadata.MangleClassName(computedClass);
|
||||
|
|
@ -91,7 +99,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
|||
{
|
||||
@class.BaseType = ComponentsApi.ComponentBase.FullTypeName;
|
||||
|
||||
var documentNode = codeDocument.GetDocumentIntermediateNode();
|
||||
var typeParamReferences = documentNode.FindDirectiveReferences(ComponentTypeParamDirective.Directive);
|
||||
for (var i = 0; i < typeParamReferences.Count; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
string indexerTypeName,
|
||||
string documentation,
|
||||
string displayName,
|
||||
bool caseSensitive,
|
||||
BoundAttributeParameterDescriptor[] parameterDescriptors,
|
||||
Dictionary<string, string> metadata,
|
||||
RazorDiagnostic[] diagnostics)
|
||||
|
|
@ -30,6 +31,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
IndexerTypeName = indexerTypeName;
|
||||
Documentation = documentation;
|
||||
DisplayName = displayName;
|
||||
CaseSensitive = caseSensitive;
|
||||
BoundAttributeParameters = parameterDescriptors;
|
||||
|
||||
Metadata = metadata;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
}
|
||||
|
||||
internal bool CaseSensitive => _parent.CaseSensitive;
|
||||
|
||||
public override void BindAttributeParameter(Action<BoundAttributeParameterDescriptorBuilder> configure)
|
||||
{
|
||||
if (configure == null)
|
||||
|
|
@ -101,7 +103,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
if (_attributeParameterBuilders != null)
|
||||
{
|
||||
// Attribute parameters are case-sensitive.
|
||||
var parameterset = new HashSet<BoundAttributeParameterDescriptor>(BoundAttributeParameterDescriptorComparer.CaseSensitive);
|
||||
var parameterset = new HashSet<BoundAttributeParameterDescriptor>(BoundAttributeParameterDescriptorComparer.Default);
|
||||
for (var i = 0; i < _attributeParameterBuilders.Count; i++)
|
||||
{
|
||||
parameterset.Add(_attributeParameterBuilders[i].Build());
|
||||
|
|
@ -120,6 +122,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
IndexerValueTypeName,
|
||||
Documentation,
|
||||
GetDisplayName(),
|
||||
CaseSensitive,
|
||||
parameters,
|
||||
new Dictionary<string, string>(Metadata),
|
||||
diagnostics.ToArray());
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
bool isEnum,
|
||||
string documentation,
|
||||
string displayName,
|
||||
bool caseSensitive,
|
||||
Dictionary<string, string> metadata,
|
||||
RazorDiagnostic[] diagnostics)
|
||||
: base(kind)
|
||||
|
|
@ -23,6 +24,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
IsEnum = isEnum;
|
||||
Documentation = documentation;
|
||||
DisplayName = displayName;
|
||||
CaseSensitive = caseSensitive;
|
||||
|
||||
Metadata = metadata;
|
||||
Diagnostics = diagnostics;
|
||||
|
|
|
|||
|
|
@ -1,7 +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.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -48,6 +47,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
}
|
||||
|
||||
internal bool CaseSensitive => _parent.CaseSensitive;
|
||||
|
||||
public BoundAttributeParameterDescriptor Build()
|
||||
{
|
||||
var validationDiagnostics = Validate();
|
||||
|
|
@ -63,6 +64,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
IsEnum,
|
||||
Documentation,
|
||||
GetDisplayName(),
|
||||
CaseSensitive,
|
||||
new Dictionary<string, string>(Metadata),
|
||||
diagnostics.ToArray());
|
||||
|
||||
|
|
|
|||
|
|
@ -1162,7 +1162,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
Source = BuildSourceSpanFromNode(node),
|
||||
|
||||
// Could be empty while the tag is being typed in.
|
||||
TagName = node.StartTag?.GetTagNameWithOptionalBang() ?? node.EndTag?.GetTagNameWithOptionalBang() ?? string.Empty,
|
||||
TagName = node.StartTag?.Name?.Content ?? node.EndTag?.Name?.Content ?? string.Empty,
|
||||
};
|
||||
|
||||
if (node.StartTag != null && node.EndTag != null && node.StartTag.IsVoidElement())
|
||||
|
|
@ -1184,6 +1184,19 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
BuildSourceSpanFromNode(node.EndTag), node.EndTag.GetTagNameWithOptionalBang()));
|
||||
}
|
||||
|
||||
if (node.StartTag != null && !_document.Options.SuppressPrimaryMethodBody)
|
||||
{
|
||||
// We only want this error during the second phase of the two phase compilation.
|
||||
var startTagName = node.StartTag.GetTagNameWithOptionalBang();
|
||||
if (startTagName != null && startTagName.Length > 0 && char.IsUpper(startTagName, 0))
|
||||
{
|
||||
// A markup element that starts with an uppercase character.
|
||||
// It is most likely intended to be a component. Add a warning.
|
||||
element.Diagnostics.Add(
|
||||
ComponentDiagnosticFactory.Create_UnexpectedMarkupElement(startTagName, BuildSourceSpanFromNode(node.StartTag)));
|
||||
}
|
||||
}
|
||||
|
||||
_builder.Push(element);
|
||||
|
||||
base.VisitMarkupElement(node);
|
||||
|
|
@ -1640,6 +1653,19 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
// We don't want to track attributes from a previous tag helper element.
|
||||
_renderedBoundAttributeNames.Clear();
|
||||
|
||||
if (node.StartTag != null && node.EndTag != null)
|
||||
{
|
||||
var startTagName = node.StartTag.Name?.Content;
|
||||
var endTagName = node.EndTag.Name?.Content;
|
||||
if (!string.Equals(startTagName, endTagName, StringComparison.Ordinal))
|
||||
{
|
||||
// This is most likely a case mismatch in start and end tags. Otherwise the parser wouldn't have grouped them together.
|
||||
// But we can't have case mismatch in start and end tags in components. Add a diagnostic.
|
||||
tagHelperNode.Diagnostics.Add(
|
||||
ComponentDiagnosticFactory.Create_InconsistentStartAndEndTagName(startTagName, endTagName, BuildSourceSpanFromNode(node.EndTag)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public DefaultRequiredAttributeDescriptor(
|
||||
string name,
|
||||
NameComparisonMode nameComparison,
|
||||
bool caseSensitive,
|
||||
string value,
|
||||
ValueComparisonMode valueComparison,
|
||||
string displayName,
|
||||
|
|
@ -18,6 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
{
|
||||
Name = name;
|
||||
NameComparison = nameComparison;
|
||||
CaseSensitive = caseSensitive;
|
||||
Value = value;
|
||||
ValueComparison = valueComparison;
|
||||
DisplayName = displayName;
|
||||
|
|
|
|||
|
|
@ -9,9 +9,15 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
{
|
||||
internal class DefaultRequiredAttributeDescriptorBuilder : RequiredAttributeDescriptorBuilder
|
||||
{
|
||||
private DefaultTagMatchingRuleDescriptorBuilder _parent;
|
||||
private RazorDiagnosticCollection _diagnostics;
|
||||
private readonly Dictionary<string, string> _metadata = new Dictionary<string, string>();
|
||||
|
||||
public DefaultRequiredAttributeDescriptorBuilder(DefaultTagMatchingRuleDescriptorBuilder parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override string Name { get; set; }
|
||||
|
||||
public override RequiredAttributeDescriptor.NameComparisonMode NameComparisonMode { get; set; }
|
||||
|
|
@ -35,6 +41,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public override IDictionary<string, string> Metadata => _metadata;
|
||||
|
||||
internal bool CaseSensitive => _parent.CaseSensitive;
|
||||
|
||||
public RequiredAttributeDescriptor Build()
|
||||
{
|
||||
var validationDiagnostics = Validate();
|
||||
|
|
@ -48,6 +56,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
var rule = new DefaultRequiredAttributeDescriptor(
|
||||
Name,
|
||||
NameComparisonMode,
|
||||
CaseSensitive,
|
||||
Value,
|
||||
ValueComparisonMode,
|
||||
displayName,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
string displayName,
|
||||
string documentation,
|
||||
string tagOutputHint,
|
||||
bool caseSensitive,
|
||||
TagMatchingRuleDescriptor[] tagMatchingRules,
|
||||
BoundAttributeDescriptor[] attributeDescriptors,
|
||||
AllowedChildTagDescriptor[] allowedChildTags,
|
||||
|
|
@ -26,6 +27,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
DisplayName = displayName;
|
||||
Documentation = documentation;
|
||||
TagOutputHint = tagOutputHint;
|
||||
CaseSensitive = caseSensitive;
|
||||
TagMatchingRules = tagMatchingRules;
|
||||
BoundAttributes = attributeDescriptors;
|
||||
AllowedChildTags = allowedChildTags;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public override string TagOutputHint { get; set; }
|
||||
|
||||
public override bool CaseSensitive { get; set; }
|
||||
|
||||
public override string Documentation { get; set; }
|
||||
|
||||
public override IDictionary<string, string> Metadata => _metadata;
|
||||
|
|
@ -124,7 +126,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
EnsureTagMatchingRuleBuilders();
|
||||
|
||||
var builder = new DefaultTagMatchingRuleDescriptorBuilder();
|
||||
var builder = new DefaultTagMatchingRuleDescriptorBuilder(this);
|
||||
configure(builder);
|
||||
_tagMatchingRuleBuilders.Add(builder);
|
||||
}
|
||||
|
|
@ -180,6 +182,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
GetDisplayName(),
|
||||
Documentation,
|
||||
TagOutputHint,
|
||||
CaseSensitive,
|
||||
tagMatchingRules,
|
||||
attributes,
|
||||
allowedChildTags,
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
string tagName,
|
||||
string parentTag,
|
||||
TagStructure tagStructure,
|
||||
bool caseSensitive,
|
||||
RequiredAttributeDescriptor[] attributes,
|
||||
RazorDiagnostic[] diagnostics)
|
||||
{
|
||||
TagName = tagName;
|
||||
ParentTag = parentTag;
|
||||
TagStructure = tagStructure;
|
||||
CaseSensitive = caseSensitive;
|
||||
Attributes = attributes;
|
||||
Diagnostics = diagnostics;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language.Legacy;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
{
|
||||
internal class DefaultTagMatchingRuleDescriptorBuilder : TagMatchingRuleDescriptorBuilder
|
||||
{
|
||||
private DefaultTagHelperDescriptorBuilder _parent;
|
||||
private List<DefaultRequiredAttributeDescriptorBuilder> _requiredAttributeBuilders;
|
||||
private RazorDiagnosticCollection _diagnostics;
|
||||
|
||||
internal DefaultTagMatchingRuleDescriptorBuilder()
|
||||
internal DefaultTagMatchingRuleDescriptorBuilder(DefaultTagHelperDescriptorBuilder parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override string TagName { get; set; }
|
||||
|
|
@ -23,6 +24,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public override TagStructure TagStructure { get; set; }
|
||||
|
||||
internal bool CaseSensitive => _parent.CaseSensitive;
|
||||
|
||||
public override RazorDiagnosticCollection Diagnostics
|
||||
{
|
||||
get
|
||||
|
|
@ -55,7 +58,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
EnsureRequiredAttributeBuilders();
|
||||
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder();
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder(this);
|
||||
configure(builder);
|
||||
_requiredAttributeBuilders.Add(builder);
|
||||
}
|
||||
|
|
@ -85,6 +88,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
TagName,
|
||||
ParentTag,
|
||||
TagStructure,
|
||||
CaseSensitive,
|
||||
requiredAttributes,
|
||||
diagnostics.ToArray());
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public NameComparisonMode NameComparison { get; protected set; }
|
||||
|
||||
public bool CaseSensitive { get; protected set; }
|
||||
|
||||
public string Value { get; protected set; }
|
||||
|
||||
public ValueComparisonMode ValueComparison { get; protected set; }
|
||||
|
|
|
|||
|
|
@ -19,27 +19,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public static readonly RequiredAttributeDescriptorComparer Default =
|
||||
new RequiredAttributeDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="RequiredAttributeDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly RequiredAttributeDescriptorComparer CaseSensitive =
|
||||
new RequiredAttributeDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
|
||||
private RequiredAttributeDescriptorComparer(bool caseSensitive = false)
|
||||
private RequiredAttributeDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
@ -58,9 +39,10 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
return
|
||||
descriptorX.CaseSensitive == descriptorY.CaseSensitive &&
|
||||
descriptorX.NameComparison == descriptorY.NameComparison &&
|
||||
descriptorX.ValueComparison == descriptorY.ValueComparison &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, _stringComparison) &&
|
||||
string.Equals(descriptorX.Name, descriptorY.Name, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.Value, descriptorY.Value, StringComparison.Ordinal) &&
|
||||
string.Equals(descriptorX.DisplayName, descriptorY.DisplayName, StringComparison.Ordinal);
|
||||
}
|
||||
|
|
@ -68,8 +50,13 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// <inheritdoc />
|
||||
public virtual int GetHashCode(RequiredAttributeDescriptor descriptor)
|
||||
{
|
||||
if (descriptor == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(descriptor));
|
||||
}
|
||||
|
||||
var hash = HashCodeCombiner.Start();
|
||||
hash.Add(descriptor.Name, _stringComparer);
|
||||
hash.Add(descriptor.Name, StringComparer.Ordinal);
|
||||
|
||||
return hash.CombinedHash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public string TagOutputHint { get; protected set; }
|
||||
|
||||
public bool CaseSensitive { get; protected set; }
|
||||
|
||||
public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; }
|
||||
|
||||
public IReadOnlyDictionary<string, string> Metadata { get; protected set; }
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public abstract string TagOutputHint { get; set; }
|
||||
|
||||
public virtual bool CaseSensitive { get; set; }
|
||||
|
||||
public abstract string Documentation { get; set; }
|
||||
|
||||
public abstract IDictionary<string, string> Metadata { get; }
|
||||
|
|
|
|||
|
|
@ -15,36 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// </summary>
|
||||
public static readonly TagHelperDescriptorComparer Default = new TagHelperDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="TagHelperDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly TagHelperDescriptorComparer CaseSensitive =
|
||||
new TagHelperDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
private readonly AllowedChildTagDescriptorComparer _AllowedChildTagDescriptorComparer;
|
||||
private readonly BoundAttributeDescriptorComparer _boundAttributeComparer;
|
||||
private readonly TagMatchingRuleDescriptorComparer _tagMatchingRuleComparer;
|
||||
|
||||
private TagHelperDescriptorComparer(bool caseSensitive = false)
|
||||
private TagHelperDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
_AllowedChildTagDescriptorComparer = AllowedChildTagDescriptorComparer.CaseSensitive;
|
||||
_boundAttributeComparer = BoundAttributeDescriptorComparer.CaseSensitive;
|
||||
_tagMatchingRuleComparer = TagMatchingRuleDescriptorComparer.CaseSensitive;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
_AllowedChildTagDescriptorComparer = AllowedChildTagDescriptorComparer.Default;
|
||||
_boundAttributeComparer = BoundAttributeDescriptorComparer.Default;
|
||||
_tagMatchingRuleComparer = TagMatchingRuleDescriptorComparer.Default;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(TagHelperDescriptor descriptorX, TagHelperDescriptor descriptorY)
|
||||
|
|
@ -59,11 +31,6 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
return false;
|
||||
}
|
||||
|
||||
if (descriptorX == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string.Equals(descriptorX.Kind, descriptorY.Kind, StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
|
|
@ -80,17 +47,17 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
if (!Enumerable.SequenceEqual(
|
||||
descriptorX.BoundAttributes.OrderBy(attribute => attribute.Name, _stringComparer),
|
||||
descriptorY.BoundAttributes.OrderBy(attribute => attribute.Name, _stringComparer),
|
||||
_boundAttributeComparer))
|
||||
descriptorX.BoundAttributes.OrderBy(attribute => attribute.Name, StringComparer.Ordinal),
|
||||
descriptorY.BoundAttributes.OrderBy(attribute => attribute.Name, StringComparer.Ordinal),
|
||||
BoundAttributeDescriptorComparer.Default))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enumerable.SequenceEqual(
|
||||
descriptorX.TagMatchingRules.OrderBy(rule => rule.TagName, _stringComparer),
|
||||
descriptorY.TagMatchingRules.OrderBy(rule => rule.TagName, _stringComparer),
|
||||
_tagMatchingRuleComparer))
|
||||
descriptorX.TagMatchingRules.OrderBy(rule => rule.TagName, StringComparer.Ordinal),
|
||||
descriptorY.TagMatchingRules.OrderBy(rule => rule.TagName, StringComparer.Ordinal),
|
||||
TagMatchingRuleDescriptorComparer.Default))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -99,9 +66,14 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
(descriptorX.AllowedChildTags != null &&
|
||||
descriptorY.AllowedChildTags != null &&
|
||||
Enumerable.SequenceEqual(
|
||||
descriptorX.AllowedChildTags.OrderBy(childTag => childTag.Name, _stringComparer),
|
||||
descriptorY.AllowedChildTags.OrderBy(childTag => childTag.Name, _stringComparer),
|
||||
_AllowedChildTagDescriptorComparer))))
|
||||
descriptorX.AllowedChildTags.OrderBy(childTag => childTag.Name, StringComparer.Ordinal),
|
||||
descriptorY.AllowedChildTags.OrderBy(childTag => childTag.Name, StringComparer.Ordinal),
|
||||
AllowedChildTagDescriptorComparer.Default))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (descriptorX.CaseSensitive != descriptorY.CaseSensitive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -116,7 +88,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!string.Equals(descriptorX.TagOutputHint, descriptorY.TagOutputHint, _stringComparison))
|
||||
if (!string.Equals(descriptorX.TagOutputHint, descriptorY.TagOutputHint, StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
{
|
||||
|
|
@ -81,7 +82,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
if (rule.TagName != ElementCatchAllName &&
|
||||
rule.TagName != null &&
|
||||
!string.Equals(tagNameWithoutPrefix, rule.TagName, StringComparison.OrdinalIgnoreCase))
|
||||
!string.Equals(tagNameWithoutPrefix, rule.TagName, rule.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -96,7 +97,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
throw new ArgumentNullException(nameof(rule));
|
||||
}
|
||||
|
||||
if (rule.ParentTag != null && !string.Equals(parentTagNameWithoutPrefix, rule.ParentTag, StringComparison.OrdinalIgnoreCase))
|
||||
if (rule.ParentTag != null && !string.Equals(parentTagNameWithoutPrefix, rule.ParentTag, rule.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -137,7 +138,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
{
|
||||
return descriptor.IndexerNamePrefix != null &&
|
||||
!SatisfiesBoundAttributeName(name, descriptor) &&
|
||||
name.StartsWith(descriptor.IndexerNamePrefix, StringComparison.OrdinalIgnoreCase);
|
||||
name.StartsWith(descriptor.IndexerNamePrefix, descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public static bool SatisfiesBoundAttributeWithParameter(string name, BoundAttributeDescriptor parent, BoundAttributeParameterDescriptor descriptor)
|
||||
|
|
@ -146,7 +147,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
{
|
||||
var satisfiesBoundAttributeName = SatisfiesBoundAttributeName(attributeName, parent);
|
||||
var satisfiesBoundAttributeIndexer = SatisfiesBoundAttributeIndexer(attributeName, parent);
|
||||
var matchesParameter = string.Equals(descriptor.Name, parameterName, StringComparison.Ordinal);
|
||||
var matchesParameter = string.Equals(descriptor.Name, parameterName, descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||
return (satisfiesBoundAttributeName || satisfiesBoundAttributeIndexer) && matchesParameter;
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +221,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
private static bool SatisfiesBoundAttributeName(string name, BoundAttributeDescriptor descriptor)
|
||||
{
|
||||
return string.Equals(descriptor.Name, name, StringComparison.OrdinalIgnoreCase);
|
||||
return string.Equals(descriptor.Name, name, descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
// Internal for testing
|
||||
|
|
@ -229,13 +230,13 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
var nameMatches = false;
|
||||
if (descriptor.NameComparison == RequiredAttributeDescriptor.NameComparisonMode.FullMatch)
|
||||
{
|
||||
nameMatches = string.Equals(descriptor.Name, attributeName, StringComparison.OrdinalIgnoreCase);
|
||||
nameMatches = string.Equals(descriptor.Name, attributeName, descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else if (descriptor.NameComparison == RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch)
|
||||
{
|
||||
// attributeName cannot equal the Name if comparing as a PrefixMatch.
|
||||
nameMatches = attributeName.Length != descriptor.Name.Length &&
|
||||
attributeName.StartsWith(descriptor.Name, StringComparison.OrdinalIgnoreCase);
|
||||
attributeName.StartsWith(descriptor.Name, descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public TagStructure TagStructure { get; protected set; }
|
||||
|
||||
public bool CaseSensitive { get; protected set; }
|
||||
|
||||
public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; }
|
||||
|
||||
public bool HasErrors
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language.Legacy;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
|
|
@ -16,30 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// </summary>
|
||||
public static readonly TagMatchingRuleDescriptorComparer Default = new TagMatchingRuleDescriptorComparer();
|
||||
|
||||
/// <summary>
|
||||
/// A default instance of the <see cref="TagMatchingRuleDescriptorComparer"/> that does case-sensitive comparison.
|
||||
/// </summary>
|
||||
internal static readonly TagMatchingRuleDescriptorComparer CaseSensitive =
|
||||
new TagMatchingRuleDescriptorComparer(caseSensitive: true);
|
||||
|
||||
private readonly StringComparer _stringComparer;
|
||||
private readonly StringComparison _stringComparison;
|
||||
private readonly RequiredAttributeDescriptorComparer _requiredAttributeComparer;
|
||||
|
||||
private TagMatchingRuleDescriptorComparer(bool caseSensitive = false)
|
||||
private TagMatchingRuleDescriptorComparer()
|
||||
{
|
||||
if (caseSensitive)
|
||||
{
|
||||
_stringComparer = StringComparer.Ordinal;
|
||||
_stringComparison = StringComparison.Ordinal;
|
||||
_requiredAttributeComparer = RequiredAttributeDescriptorComparer.CaseSensitive;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringComparer = StringComparer.OrdinalIgnoreCase;
|
||||
_stringComparison = StringComparison.OrdinalIgnoreCase;
|
||||
_requiredAttributeComparer = RequiredAttributeDescriptorComparer.Default;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(TagMatchingRuleDescriptor ruleX, TagMatchingRuleDescriptor ruleY)
|
||||
|
|
@ -55,10 +32,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
return
|
||||
string.Equals(ruleX.TagName, ruleY.TagName, _stringComparison) &&
|
||||
string.Equals(ruleX.ParentTag, ruleY.ParentTag, _stringComparison) &&
|
||||
string.Equals(ruleX.TagName, ruleY.TagName, StringComparison.Ordinal) &&
|
||||
string.Equals(ruleX.ParentTag, ruleY.ParentTag, StringComparison.Ordinal) &&
|
||||
ruleX.CaseSensitive == ruleY.CaseSensitive &&
|
||||
ruleX.TagStructure == ruleY.TagStructure &&
|
||||
Enumerable.SequenceEqual(ruleX.Attributes, ruleY.Attributes, _requiredAttributeComparer);
|
||||
Enumerable.SequenceEqual(ruleX.Attributes, ruleY.Attributes, RequiredAttributeDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
public virtual int GetHashCode(TagMatchingRuleDescriptor rule)
|
||||
|
|
@ -69,7 +47,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
var hash = HashCodeCombiner.Start();
|
||||
hash.Add(rule.TagName, _stringComparer);
|
||||
hash.Add(rule.TagName, StringComparer.Ordinal);
|
||||
|
||||
return hash.CombinedHash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public void Build_DisplayNameIsName_NameComparisonFullMatch()
|
||||
{
|
||||
// Arrange
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder();
|
||||
var tagHelperBuilder = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
|
||||
var tagMatchingRuleBuilder = new DefaultTagMatchingRuleDescriptorBuilder(tagHelperBuilder);
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder(tagMatchingRuleBuilder);
|
||||
|
||||
builder
|
||||
.Name("asp-action")
|
||||
|
|
@ -28,7 +30,9 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
public void Build_DisplayNameIsNameWithDots_NameComparisonPrefixMatch()
|
||||
{
|
||||
// Arrange
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder();
|
||||
var tagHelperBuilder = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
|
||||
var tagMatchingRuleBuilder = new DefaultTagMatchingRuleDescriptorBuilder(tagHelperBuilder);
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder(tagMatchingRuleBuilder);
|
||||
|
||||
builder
|
||||
.Name("asp-route-")
|
||||
|
|
|
|||
|
|
@ -60,16 +60,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
|||
var create = Assert.IsType<DefaultTagHelperCreateIntermediateNode>(tagHelper.Children[1]);
|
||||
Assert.Equal("__TestTagHelper", create.FieldName);
|
||||
Assert.Equal("TestTagHelper", create.TypeName);
|
||||
Assert.Equal(tagHelpers[0], create.TagHelper, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(tagHelpers[0], create.TagHelper, TagHelperDescriptorComparer.Default);
|
||||
|
||||
var property = Assert.IsType<DefaultTagHelperPropertyIntermediateNode>(tagHelper.Children[2]);
|
||||
Assert.Equal("foo", property.AttributeName);
|
||||
Assert.Equal(AttributeStructure.DoubleQuotes, property.AttributeStructure);
|
||||
Assert.Equal(tagHelpers[0].BoundAttributes[0], property.BoundAttribute, BoundAttributeDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(tagHelpers[0].BoundAttributes[0], property.BoundAttribute, BoundAttributeDescriptorComparer.Default);
|
||||
Assert.Equal("__TestTagHelper", property.FieldName);
|
||||
Assert.False(property.IsIndexerNameMatch);
|
||||
Assert.Equal("FooProp", property.PropertyName);
|
||||
Assert.Equal(tagHelpers[0], property.TagHelper, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(tagHelpers[0], property.TagHelper, TagHelperDescriptorComparer.Default);
|
||||
|
||||
var htmlAttribute = Assert.IsType<DefaultTagHelperHtmlAttributeIntermediateNode>(tagHelper.Children[3]);
|
||||
Assert.Equal("attr", htmlAttribute.AttributeName);
|
||||
|
|
|
|||
|
|
@ -161,8 +161,10 @@ Some Content
|
|||
</RenderChildContent>");
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Same(ComponentDiagnosticFactory.ChildContentMixedWithExplicitChildContent.Id, diagnostic.Id);
|
||||
Assert.Collection(
|
||||
generated.Diagnostics,
|
||||
d => Assert.Equal("RZ10014", d.Id),
|
||||
d => Assert.Equal("RZ9996", d.Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -998,6 +998,24 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputWithoutType_IsCaseSensitive()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<input @BIND=""@ParentValue"" />
|
||||
@code {
|
||||
public int ParentValue { get; set; } = 42;
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuiltIn_BindToInputText_WithFormat_WritesAttributes()
|
||||
{
|
||||
|
|
@ -1829,12 +1847,12 @@ namespace Test3
|
|||
@using static Test2.SomeComponent
|
||||
@using Foo = Test3
|
||||
<MyComponent />
|
||||
<SomeComponent /> <!-- Not a component -->");
|
||||
<SomeComponent /> <!-- Not a component -->", throwOnFailure: false);
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
var result = CompileToAssembly(generated);
|
||||
CompileToAssembly(generated, throwOnFailure: false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -2650,6 +2668,25 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EventHandler_AttributeNameIsCaseSensitive()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<input @onCLICK=""OnClick"" />
|
||||
@code {
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
}");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Generics
|
||||
|
|
@ -3448,6 +3485,24 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Element_WithKey_AttributeNameIsCaseSensitive()
|
||||
{
|
||||
// Arrange/Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<elem attributebefore=""before"" @KEY=""someObject"" attributeafter=""after"">Hello</elem>
|
||||
|
||||
@code {
|
||||
private object someObject = new object();
|
||||
}
|
||||
");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Splat
|
||||
|
|
@ -3616,6 +3671,24 @@ namespace Test
|
|||
var generated = CompileToCSharp(@"
|
||||
<MyComponent Value=""18"" @attributes=""@(someAttributes)"" />
|
||||
|
||||
@code {
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
}
|
||||
");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Element_WithSplat_AttributeNameIsCaseSensitive()
|
||||
{
|
||||
// Arrange/Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<elem attributebefore=""before"" @ATTributes=""someAttributes"" attributeafter=""after"">Hello</elem>
|
||||
|
||||
@code {
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
}
|
||||
|
|
@ -3773,6 +3846,19 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Element_WithRef_AttributeNameIsCaseSensitive()
|
||||
{
|
||||
// Arrange/Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<elem attributebefore=""before"" @rEF=""myElem"" attributeafter=""after"">Hello</elem>");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Templates
|
||||
|
|
@ -4430,6 +4516,29 @@ namespace New.Test
|
|||
Assert.Same(ComponentDiagnosticFactory.DuplicateMarkupAttributeDirective.Id, diagnostic.Id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<div>
|
||||
<input type=""text"" Value=""17"" @bind=""@text""></input>
|
||||
</div>
|
||||
@functions {
|
||||
private string text = ""hi"";
|
||||
}
|
||||
");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Same(ComponentDiagnosticFactory.DuplicateMarkupAttributeDirective.Id, diagnostic.Id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DuplicateMarkupAttributes_IsAnError_BindOnInput()
|
||||
{
|
||||
|
|
@ -4871,6 +4980,81 @@ namespace Test
|
|||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Component_MatchingIsCaseSensitive()
|
||||
{
|
||||
// Arrange
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class MyComponent : ComponentBase
|
||||
{
|
||||
[Parameter] public int IntProperty { get; set; }
|
||||
[Parameter] public bool BoolProperty { get; set; }
|
||||
}
|
||||
}
|
||||
"));
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<MyComponent />
|
||||
<mycomponent />
|
||||
<MyComponent intproperty='1' BoolProperty='true' />");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Component_MultipleComponentsDifferByCase()
|
||||
{
|
||||
// Arrange
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class MyComponent : ComponentBase
|
||||
{
|
||||
[Parameter] public int IntProperty { get; set; }
|
||||
}
|
||||
|
||||
public class Mycomponent : ComponentBase
|
||||
{
|
||||
[Parameter] public int IntProperty { get; set; }
|
||||
}
|
||||
}
|
||||
"));
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<MyComponent IntProperty='1' />
|
||||
<Mycomponent IntProperty='2' />");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ElementWithUppercaseTagName_CanHideWarningWithBang()
|
||||
{
|
||||
// Arrange & Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<!NotAComponent />
|
||||
<!DefinitelyNotAComponent></!DefinitelyNotAComponent>");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
CompileToAssembly(generated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
|||
{
|
||||
internal override string FileKind => FileKinds.Component;
|
||||
|
||||
internal override bool UseTwoPhaseCompilation => true;
|
||||
|
||||
[Fact]
|
||||
public void RejectsEndTagWithNoStartTag()
|
||||
{
|
||||
|
|
@ -125,5 +127,79 @@ namespace Test
|
|||
"Component attributes do not support complex content (mixed C# and markup). Attribute: '@key', text: 'Foo @Text'",
|
||||
diagnostic.GetMessage());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Component_StartsWithLowerCase_ReportsError()
|
||||
{
|
||||
// Arrange & Act
|
||||
var generated = CompileToCSharp("lowerCase.razor", @"
|
||||
<input type=""text"" @bind=""Text"" />
|
||||
@functions {
|
||||
public string Text { get; set; } = ""text"";
|
||||
}", throwOnFailure: false);
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Equal("RZ10013", diagnostic.Id);
|
||||
Assert.Equal(
|
||||
"Component 'lowerCase' starts with a lowercase character. Component names cannot start with a lowercase character.",
|
||||
diagnostic.GetMessage());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Element_DoesNotStartWithLowerCase_ReportsWarning()
|
||||
{
|
||||
// Arrange & Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<PossibleComponent></PossibleComponent>
|
||||
|
||||
@functions {
|
||||
public string Text { get; set; } = ""text"";
|
||||
}");
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Equal("RZ10014", 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.",
|
||||
diagnostic.GetMessage());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Element_DoesNotStartWithLowerCase_OverrideWithBang_NoWarning()
|
||||
{
|
||||
// Arrange & Act
|
||||
var generated = CompileToCSharp(@"
|
||||
<!PossibleComponent></!PossibleComponent>");
|
||||
|
||||
// Assert
|
||||
Assert.Empty(generated.Diagnostics);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Component_StartAndEndTagCaseMismatch_ReportsError()
|
||||
{
|
||||
// Arrange & Act
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class MyComponent : ComponentBase
|
||||
{
|
||||
}
|
||||
}
|
||||
"));
|
||||
var generated = CompileToCSharp(@"
|
||||
<MyComponent></mycomponent>");
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Equal("RZ10015", 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
|||
{
|
||||
internal override string FileKind => FileKinds.Component;
|
||||
|
||||
internal override bool UseTwoPhaseCompilation => true;
|
||||
|
||||
// Razor doesn't parse this as a template, we don't need much special handling for
|
||||
// it because it will just be invalid in general.
|
||||
[Fact]
|
||||
|
|
@ -17,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
|||
// Arrange
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"<div attr=""@<div></div>"" />");
|
||||
var generated = CompileToCSharp(@"<div attr=""@<div></div>"" />", throwOnFailure: false);
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
|
|
@ -55,11 +57,13 @@ namespace Test
|
|||
"));
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"<MyComponent attr=""@<div></div>"" />");
|
||||
var generated = CompileToCSharp(@"<MyComponent attr=""@<div></div>"" />", throwOnFailure: false);
|
||||
|
||||
// Assert
|
||||
var diagnostic = Assert.Single(generated.Diagnostics);
|
||||
Assert.Equal("RZ1005", diagnostic.Id);
|
||||
Assert.Collection(
|
||||
generated.Diagnostics,
|
||||
d => Assert.Equal("RZ9986", d.Id),
|
||||
d => Assert.Equal("RZ1005", d.Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -1880,5 +1880,57 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
{
|
||||
RunParseTreeRewriterTest("<input>Foo</input>");
|
||||
}
|
||||
|
||||
public static TagHelperDescriptor[] CaseSensitive_Descriptors = new TagHelperDescriptor[]
|
||||
{
|
||||
TagHelperDescriptorBuilder.Create("pTagHelper", "SomeAssembly")
|
||||
.SetCaseSensitive()
|
||||
.BoundAttributeDescriptor(attribute =>
|
||||
attribute
|
||||
.Name("bound")
|
||||
.PropertyName("Bound")
|
||||
.TypeName(typeof(bool).FullName))
|
||||
.TagMatchingRuleDescriptor(rule =>
|
||||
rule
|
||||
.RequireTagName("p")
|
||||
.RequireAttributeDescriptor(attribute => attribute.Name("class")))
|
||||
.Build(),
|
||||
TagHelperDescriptorBuilder.Create("catchAllTagHelper", "SomeAssembly")
|
||||
.TagMatchingRuleDescriptor(rule =>
|
||||
rule
|
||||
.RequireTagName("*")
|
||||
.RequireAttributeDescriptor(attribute => attribute.Name("catchAll")))
|
||||
.Build(),
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void HandlesCaseSensitiveTagHelpersCorrectly1()
|
||||
{
|
||||
EvaluateData(CaseSensitive_Descriptors, "<p class='foo' catchAll></p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HandlesCaseSensitiveTagHelpersCorrectly2()
|
||||
{
|
||||
EvaluateData(CaseSensitive_Descriptors, "<p CLASS='foo' CATCHAll></p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HandlesCaseSensitiveTagHelpersCorrectly3()
|
||||
{
|
||||
EvaluateData(CaseSensitive_Descriptors, "<P class='foo' CATCHAll></P>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HandlesCaseSensitiveTagHelpersCorrectly4()
|
||||
{
|
||||
EvaluateData(CaseSensitive_Descriptors, "<P class='foo'></P>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HandlesCaseSensitiveTagHelpersCorrectly5()
|
||||
{
|
||||
EvaluateData(CaseSensitive_Descriptors, "<p Class='foo'></p>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,12 +32,12 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
parentIsTagHelper: false);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedDescriptors, bindingResult.Descriptors, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(expectedDescriptors, bindingResult.Descriptors, TagHelperDescriptorComparer.Default);
|
||||
Assert.Equal("th:div", bindingResult.TagName);
|
||||
Assert.Equal("body", bindingResult.ParentTagName);
|
||||
Assert.Equal(expectedAttributes, bindingResult.Attributes);
|
||||
Assert.Equal("th:", bindingResult.TagHelperPrefix);
|
||||
Assert.Equal(divTagHelper.TagMatchingRules, bindingResult.Mappings[divTagHelper], TagMatchingRuleDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal(divTagHelper.TagMatchingRules, bindingResult.Mappings[divTagHelper], TagMatchingRuleDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
public static TheoryData RequiredParentData
|
||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
parentIsTagHelper: false);
|
||||
|
||||
// Assert
|
||||
Assert.Equal((IEnumerable<TagHelperDescriptor>)expectedDescriptors, bindingResult.Descriptors, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal((IEnumerable<TagHelperDescriptor>)expectedDescriptors, bindingResult.Descriptors, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
public static TheoryData RequiredAttributeData
|
||||
|
|
@ -277,7 +277,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
var bindingResult = tagHelperBinder.GetBinding(tagName, providedAttributes, parentTagName: "p", parentIsTagHelper: false);
|
||||
|
||||
// Assert
|
||||
Assert.Equal((IEnumerable<TagHelperDescriptor>)expectedDescriptors, bindingResult?.Descriptors, TagHelperDescriptorComparer.CaseSensitive);
|
||||
Assert.Equal((IEnumerable<TagHelperDescriptor>)expectedDescriptors, bindingResult?.Descriptors, TagHelperDescriptorComparer.Default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -598,5 +598,59 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
// Assert
|
||||
Assert.False(bindingResult.IsAttributeMatch);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetBinding_CaseSensitiveRule_CaseMismatch_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var divTagHelper = TagHelperDescriptorBuilder.Create("DivTagHelper", "SomeAssembly")
|
||||
.TagMatchingRuleDescriptor(rule => rule.RequireTagName("div"))
|
||||
.SetCaseSensitive()
|
||||
.Build();
|
||||
var expectedDescriptors = new[] { divTagHelper };
|
||||
var expectedAttributes = new[]
|
||||
{
|
||||
new KeyValuePair<string, string>("class", "something")
|
||||
};
|
||||
var tagHelperBinder = new TagHelperBinder("th:", expectedDescriptors);
|
||||
|
||||
// Act
|
||||
var bindingResult = tagHelperBinder.GetBinding(
|
||||
tagName: "th:Div",
|
||||
attributes: expectedAttributes,
|
||||
parentTagName: "body",
|
||||
parentIsTagHelper: false);
|
||||
|
||||
// Assert
|
||||
Assert.Null(bindingResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetBinding_CaseSensitiveRequiredAttribute_CaseMismatch_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var divTagHelper = TagHelperDescriptorBuilder.Create("DivTagHelper", "SomeAssembly")
|
||||
.TagMatchingRuleDescriptor(rule => rule
|
||||
.RequireTagName("div")
|
||||
.RequireAttributeDescriptor(attribute => attribute.Name("class")))
|
||||
.SetCaseSensitive()
|
||||
.Build();
|
||||
var expectedDescriptors = new[] { divTagHelper };
|
||||
var expectedAttributes = new[]
|
||||
{
|
||||
new KeyValuePair<string, string>("CLASS", "something")
|
||||
};
|
||||
var tagHelperBinder = new TagHelperBinder(null, expectedDescriptors);
|
||||
|
||||
// Act
|
||||
var bindingResult = tagHelperBinder.GetBinding(
|
||||
tagName: "div",
|
||||
attributes: expectedAttributes,
|
||||
parentTagName: "body",
|
||||
parentIsTagHelper: false);
|
||||
|
||||
// Assert
|
||||
Assert.Null(bindingResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,8 +140,10 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
bool expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
var tagHelperBuilder = new DefaultTagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "TestTagHelper", "Test");
|
||||
var tagMatchingRuleBuilder = new DefaultTagMatchingRuleDescriptorBuilder(tagHelperBuilder);
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder(tagMatchingRuleBuilder);
|
||||
|
||||
var builder = new DefaultRequiredAttributeDescriptorBuilder();
|
||||
configure(builder);
|
||||
|
||||
var requiredAttibute = builder.Build();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o =
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
ParentValue
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
;
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
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 [30] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (6:0,6 [21] x:\dir\subdir\Test\TestComponent.cshtml) - @BIND=" - "
|
||||
CSharpExpressionAttributeValue - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
|
||||
HtmlContent - (30:0,30 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (30:0,30 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|ParentValue|
|
||||
Generated Location: (878:25,15 [11] )
|
||||
|ParentValue|
|
||||
|
||||
Source Location: (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
|
||||
Generated Location: (1082:35,7 [50] )
|
||||
|
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +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.
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
|
||||
}
|
||||
));
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
__o = typeof(MyComponent);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
__o = "";
|
||||
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Boolean>(
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
true
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
|
||||
}
|
||||
));
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
__o = typeof(MyComponent);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [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 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
HtmlContent - (15:0,15 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (15:0,15 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
MarkupElement - (17:1,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) - mycomponent
|
||||
HtmlContent - (32:1,15 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (32:1,15 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
Component - (34:2,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
ComponentAttribute - - intproperty - AttributeStructure.SingleQuotes
|
||||
HtmlContent - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 1
|
||||
ComponentAttribute - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - BoolProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - true
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Source Location: (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|true|
|
||||
Generated Location: (1301:36,43 [4] )
|
||||
|true|
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
1
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
|
||||
}
|
||||
));
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
__o = typeof(MyComponent);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
2
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
|
||||
}
|
||||
));
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
__o = typeof(Mycomponent);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
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 [31] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
ComponentAttribute - (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - IntProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 1
|
||||
HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
Component - (33:1,0 [31] x:\dir\subdir\Test\TestComponent.cshtml) - Mycomponent
|
||||
ComponentAttribute - (59:1,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - IntProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (59:1,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 2
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Source Location: (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|1|
|
||||
Generated Location: (960:25,26 [1] )
|
||||
|1|
|
||||
|
||||
Source Location: (59:1,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|2|
|
||||
Generated Location: (1515:44,26 [1] )
|
||||
|2|
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
text
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, text);
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private string text = "hi";
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1 @@
|
|||
x:\dir\subdir\Test\TestComponent.cshtml(2,3): Error RZ10008: The attribute 'Value' is used two or more times for this element. Attributes must be unique (case-insensitive). The attribute 'Value' is used by the '@bind' directive attribute.
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
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 [69] x:\dir\subdir\Test\TestComponent.cshtml) - div
|
||||
HtmlContent - (5:0,5 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (5:0,5 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
MarkupElement - (9:1,2 [52] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - - type=" - "
|
||||
HtmlAttributeValue - (22:1,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (22:1,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text
|
||||
HtmlAttribute - - Value=" - "
|
||||
HtmlAttributeValue - (35:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (35:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 17
|
||||
HtmlAttribute - (46:1,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (47:1,40 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - text
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (46:1,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value,
|
||||
IntermediateToken - - CSharp - text
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlContent - (61:1,54 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (61:1,54 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
HtmlContent - (69:2,6 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (69:2,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
HtmlContent - (119:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (119:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string text = "hi";\n
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Source Location: (47:1,40 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|text|
|
||||
Generated Location: (956:25,40 [4] )
|
||||
|text|
|
||||
|
||||
Source Location: (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private string text = "hi";
|
||||
|
|
||||
Generated Location: (1285:36,12 [35] )
|
||||
|
|
||||
private string text = "hi";
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
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 [18] x:\dir\subdir\Test\TestComponent.cshtml) - NotAComponent
|
||||
HtmlContent - (18:0,18 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (18:0,18 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
MarkupElement - (20:1,0 [53] x:\dir\subdir\Test\TestComponent.cshtml) - DefinitelyNotAComponent
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private object someObject = new object();
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
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 [84] x:\dir\subdir\Test\TestComponent.cshtml) - elem
|
||||
HtmlAttribute - (5:0,5 [25] x:\dir\subdir\Test\TestComponent.cshtml) - attributebefore=" - "
|
||||
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
|
||||
HtmlAttribute - (30:0,30 [18] x:\dir\subdir\Test\TestComponent.cshtml) - @KEY=" - "
|
||||
HtmlAttributeValue - (37:0,37 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (37:0,37 [10] x:\dir\subdir\Test\TestComponent.cshtml) - Html - someObject
|
||||
HtmlAttribute - (48:0,48 [23] x:\dir\subdir\Test\TestComponent.cshtml) - attributeafter=" - "
|
||||
HtmlAttributeValue - (65:0,65 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (65:0,65 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
|
||||
HtmlContent - (72:0,72 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (72:0,72 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
|
||||
HtmlContent - (84:0,84 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (84:0,84 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
|
||||
HtmlContent - (145:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (145:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private object someObject = new object();\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private object someObject = new object();
|
||||
|
|
||||
Generated Location: (899:26,7 [49] )
|
||||
|
|
||||
private object someObject = new object();
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [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 [80] x:\dir\subdir\Test\TestComponent.cshtml) - elem
|
||||
HtmlAttribute - (5:0,5 [25] x:\dir\subdir\Test\TestComponent.cshtml) - attributebefore=" - "
|
||||
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
|
||||
HtmlAttribute - (30:0,30 [14] x:\dir\subdir\Test\TestComponent.cshtml) - @rEF=" - "
|
||||
HtmlAttributeValue - (37:0,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (37:0,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - myElem
|
||||
HtmlAttribute - (44:0,44 [23] x:\dir\subdir\Test\TestComponent.cshtml) - 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 - (68:0,68 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (68:0,68 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
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 [95] x:\dir\subdir\Test\TestComponent.cshtml) - elem
|
||||
HtmlAttribute - (5:0,5 [25] x:\dir\subdir\Test\TestComponent.cshtml) - attributebefore=" - "
|
||||
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
|
||||
HtmlAttribute - (30:0,30 [29] x:\dir\subdir\Test\TestComponent.cshtml) - @ATTributes=" - "
|
||||
HtmlAttributeValue - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml) - Html - someAttributes
|
||||
HtmlAttribute - (59:0,59 [23] x:\dir\subdir\Test\TestComponent.cshtml) - attributeafter=" - "
|
||||
HtmlAttributeValue - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
|
||||
HtmlContent - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
|
||||
HtmlContent - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
|
||||
HtmlContent - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
|
||||
Generated Location: (899:26,7 [93] )
|
||||
|
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
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 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (6:0,6 [19] x:\dir\subdir\Test\TestComponent.cshtml) - @onCLICK=" - "
|
||||
HtmlAttributeValue - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - Html - OnClick
|
||||
HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIMouseEventArgs e) {\n }\n
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
Source Location: (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
|
||||
Generated Location: (899:26,7 [49] )
|
||||
|
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "input");
|
||||
builder.AddAttribute(1, "@BIND",
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
ParentValue
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
);
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
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 [30] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - (6:0,6 [21] x:\dir\subdir\Test\TestComponent.cshtml) - @BIND=" - "
|
||||
CSharpExpressionAttributeValue - (14:0,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (15:0,15 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
|
||||
CSharpCode - (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (39:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
|
||||
Generated Location: (925:30,7 [50] )
|
||||
|
|
||||
public int ParentValue { get; set; } = 42;
|
||||
|
|
||||
|
||||
|
|
@ -29,7 +29,9 @@ using Foo = Test3;
|
|||
{
|
||||
builder.OpenComponent<Test.MyComponent>(0);
|
||||
builder.CloseComponent();
|
||||
builder.AddMarkupContent(1, "\r\n<SomeComponent></SomeComponent>");
|
||||
builder.AddMarkupContent(1, "\r\n");
|
||||
builder.OpenElement(2, "SomeComponent");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +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.
|
||||
|
|
@ -10,4 +10,6 @@ Document -
|
|||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
Component - (55:2,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
MarkupBlock - - \n<SomeComponent></SomeComponent>
|
||||
HtmlContent - (70:2,15 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (70:2,15 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
MarkupElement - (72:3,0 [17] x:\dir\subdir\Test\TestComponent.cshtml) - SomeComponent
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenComponent<Test.MyComponent>(0);
|
||||
builder.CloseComponent();
|
||||
builder.AddMarkupContent(1, "\r\n<mycomponent></mycomponent>\r\n");
|
||||
builder.OpenComponent<Test.MyComponent>(2);
|
||||
builder.AddAttribute(3, "intproperty", "1");
|
||||
builder.AddAttribute(4, "BoolProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Boolean>(
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
true
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
));
|
||||
builder.CloseComponent();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
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 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
MarkupBlock - - \n<mycomponent></mycomponent>\n
|
||||
Component - (34:2,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
ComponentAttribute - - intproperty - AttributeStructure.SingleQuotes
|
||||
HtmlContent - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 1
|
||||
ComponentAttribute - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - BoolProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - true
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenComponent<Test.MyComponent>(0);
|
||||
builder.AddAttribute(1, "IntProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(
|
||||
#nullable restore
|
||||
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
1
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
));
|
||||
builder.CloseComponent();
|
||||
builder.AddMarkupContent(2, "\r\n");
|
||||
builder.OpenComponent<Test.Mycomponent>(3);
|
||||
builder.AddAttribute(4, "IntProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
2
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
));
|
||||
builder.CloseComponent();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
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 [31] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
|
||||
ComponentAttribute - (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - IntProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 1
|
||||
HtmlContent - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (31:0,31 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
Component - (33:1,0 [31] x:\dir\subdir\Test\TestComponent.cshtml) - Mycomponent
|
||||
ComponentAttribute - (59:1,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - IntProperty - AttributeStructure.SingleQuotes
|
||||
IntermediateToken - (59:1,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 2
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenElement(0, "div");
|
||||
builder.AddMarkupContent(1, "\r\n ");
|
||||
builder.OpenElement(2, "input");
|
||||
builder.AddAttribute(3, "type", "text");
|
||||
builder.AddAttribute(4, "Value", "17");
|
||||
builder.AddAttribute(5, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
text
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
));
|
||||
builder.AddAttribute(6, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, text));
|
||||
builder.SetUpdatesAttributeName("value");
|
||||
builder.CloseElement();
|
||||
builder.AddMarkupContent(7, "\r\n");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private string text = "hi";
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1 @@
|
|||
x:\dir\subdir\Test\TestComponent.cshtml(2,3): Error RZ10008: The attribute 'Value' is used two or more times for this element. Attributes must be unique (case-insensitive). The attribute 'Value' is used by the '@bind' directive attribute.
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
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 [69] x:\dir\subdir\Test\TestComponent.cshtml) - div
|
||||
HtmlContent - (5:0,5 [4] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (5:0,5 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
MarkupElement - (9:1,2 [52] x:\dir\subdir\Test\TestComponent.cshtml) - input
|
||||
HtmlAttribute - - type=" - "
|
||||
HtmlAttributeValue - (22:1,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (22:1,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text
|
||||
HtmlAttribute - - Value=" - "
|
||||
HtmlAttributeValue - (35:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) -
|
||||
IntermediateToken - (35:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 17
|
||||
HtmlAttribute - (46:1,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
|
||||
IntermediateToken - (47:1,40 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - text
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlAttribute - (46:1,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
|
||||
CSharpExpressionAttributeValue - -
|
||||
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value,
|
||||
IntermediateToken - - CSharp - text
|
||||
IntermediateToken - - CSharp - )
|
||||
HtmlContent - (61:1,54 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (61:1,54 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
CSharpCode - (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string text = "hi";\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (83:3,12 [35] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private string text = "hi";
|
||||
|
|
||||
Generated Location: (1504:38,12 [35] )
|
||||
|
|
||||
private string text = "hi";
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddMarkupContent(0, "<NotAComponent></NotAComponent>\r\n<DefinitelyNotAComponent></DefinitelyNotAComponent>");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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
|
||||
MarkupBlock - - <NotAComponent></NotAComponent>\n<DefinitelyNotAComponent></DefinitelyNotAComponent>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddMarkupContent(0, "<elem attributebefore=\"before\" @KEY=\"someObject\" attributeafter=\"after\">Hello</elem>");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private object someObject = new object();
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
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
|
||||
MarkupBlock - - <elem attributebefore="before" @KEY="someObject" attributeafter="after">Hello</elem>
|
||||
CSharpCode - (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private object someObject = new object();\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (95:2,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private object someObject = new object();
|
||||
|
|
||||
Generated Location: (767:20,7 [49] )
|
||||
|
|
||||
private object someObject = new object();
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddMarkupContent(0, "<elem attributebefore=\"before\" @rEF=\"myElem\" attributeafter=\"after\">Hello</elem>");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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
|
||||
MarkupBlock - - <elem attributebefore="before" @rEF="myElem" attributeafter="after">Hello</elem>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddMarkupContent(0, "<elem attributebefore=\"before\" @ATTributes=\"someAttributes\" attributeafter=\"after\">Hello</elem>");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
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
|
||||
MarkupBlock - - <elem attributebefore="before" @ATTributes="someAttributes" attributeafter="after">Hello</elem>
|
||||
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
|
||||
Generated Location: (778:20,7 [93] )
|
||||
|
|
||||
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
// <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.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
builder.AddMarkupContent(0, "<input @onCLICK=\"OnClick\">");
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
#nullable restore
|
||||
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
|
||||
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
#nullable disable
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
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
|
||||
MarkupBlock - - <input @onCLICK="OnClick">
|
||||
CSharpCode - (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n void OnClick(UIMouseEventArgs e) {\n }\n
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
Source Location: (37:1,7 [49] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
|
||||
Generated Location: (705:20,7 [49] )
|
||||
|
|
||||
void OnClick(UIMouseEventArgs e) {
|
||||
}
|
||||
|
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
Markup span at (10:0,10 [3] ) (Accepts:Any) - Parent: Tag block at (0:0,0 [28] )
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
RazorDocument - [0..28)::28 - [<p class='foo' catchAll></p>]
|
||||
MarkupBlock - [0..28)::28
|
||||
MarkupTagHelperElement - [0..28)::28 - p[StartTagAndEndTag] - pTagHelper - catchAllTagHelper
|
||||
MarkupTagHelperStartTag - [0..24)::24 - [<p class='foo' catchAll>] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
OpenAngle;[<];
|
||||
Text;[p];
|
||||
MarkupTagHelperAttribute - [2..14)::12 - class - SingleQuotes - Unbound - [ class='foo']
|
||||
MarkupTextLiteral - [2..3)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Whitespace;[ ];
|
||||
MarkupTextLiteral - [3..8)::5 - [class] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[class];
|
||||
Equals;[=];
|
||||
MarkupTextLiteral - [9..10)::1 - ['] - Gen<None> - SpanEditHandler;Accepts:Any
|
||||
SingleQuote;['];
|
||||
MarkupTagHelperAttributeValue - [10..13)::3
|
||||
MarkupLiteralAttributeValue - [10..13)::3 - [foo]
|
||||
MarkupTextLiteral - [10..13)::3 - [foo] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[foo];
|
||||
MarkupTextLiteral - [13..14)::1 - ['] - Gen<None> - SpanEditHandler;Accepts:Any
|
||||
SingleQuote;['];
|
||||
MarkupMinimizedTagHelperAttribute - [14..23)::9 - catchAll - Minimized - Unbound - [ catchAll]
|
||||
MarkupTextLiteral - [14..15)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Whitespace;[ ];
|
||||
MarkupTextLiteral - [15..23)::8 - [catchAll] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[catchAll];
|
||||
CloseAngle;[>];
|
||||
MarkupTagHelperEndTag - [24..28)::4 - [</p>]
|
||||
OpenAngle;[<];
|
||||
ForwardSlash;[/];
|
||||
Text;[p];
|
||||
CloseAngle;[>];
|
||||
|
|
@ -0,0 +1 @@
|
|||
TagHelper span at (0:0,0 [28] ) - pTagHelper - catchAllTagHelper
|
||||
|
|
@ -0,0 +1 @@
|
|||
Markup span at (10:0,10 [3] ) (Accepts:Any) - Parent: Tag block at (0:0,0 [28] )
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
RazorDocument - [0..28)::28 - [<p CLASS='foo' CATCHAll></p>]
|
||||
MarkupBlock - [0..28)::28
|
||||
MarkupTagHelperElement - [0..28)::28 - p[StartTagAndEndTag] - catchAllTagHelper
|
||||
MarkupTagHelperStartTag - [0..24)::24 - [<p CLASS='foo' CATCHAll>] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
OpenAngle;[<];
|
||||
Text;[p];
|
||||
MarkupTagHelperAttribute - [2..14)::12 - CLASS - SingleQuotes - Unbound - [ CLASS='foo']
|
||||
MarkupTextLiteral - [2..3)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Whitespace;[ ];
|
||||
MarkupTextLiteral - [3..8)::5 - [CLASS] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[CLASS];
|
||||
Equals;[=];
|
||||
MarkupTextLiteral - [9..10)::1 - ['] - Gen<None> - SpanEditHandler;Accepts:Any
|
||||
SingleQuote;['];
|
||||
MarkupTagHelperAttributeValue - [10..13)::3
|
||||
MarkupLiteralAttributeValue - [10..13)::3 - [foo]
|
||||
MarkupTextLiteral - [10..13)::3 - [foo] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[foo];
|
||||
MarkupTextLiteral - [13..14)::1 - ['] - Gen<None> - SpanEditHandler;Accepts:Any
|
||||
SingleQuote;['];
|
||||
MarkupMinimizedTagHelperAttribute - [14..23)::9 - CATCHAll - Minimized - Unbound - [ CATCHAll]
|
||||
MarkupTextLiteral - [14..15)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Whitespace;[ ];
|
||||
MarkupTextLiteral - [15..23)::8 - [CATCHAll] - Gen<Markup> - SpanEditHandler;Accepts:Any
|
||||
Text;[CATCHAll];
|
||||
CloseAngle;[>];
|
||||
MarkupTagHelperEndTag - [24..28)::4 - [</p>]
|
||||
OpenAngle;[<];
|
||||
ForwardSlash;[/];
|
||||
Text;[p];
|
||||
CloseAngle;[>];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue