[Fixes #698] Removed unnecessary Debug.Assert in TagHelperBlockRewriter
This commit is contained in:
parent
23e7d85ccf
commit
32c75fc78e
|
|
@ -105,6 +105,11 @@ namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal
|
|||
attributes.Add(
|
||||
new KeyValuePair<string, SyntaxTreeNode>(result.AttributeName, result.AttributeValueNode));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error occured while parsing the attribute. Don't try parsing the rest to avoid misleading errors.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return attributes;
|
||||
|
|
@ -205,10 +210,6 @@ namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal
|
|||
}
|
||||
else if (symbol.Type == HtmlSymbolType.Equals)
|
||||
{
|
||||
Debug.Assert(
|
||||
name != null,
|
||||
"Name should never be null here. The parser should guarantee an attribute has a name.");
|
||||
|
||||
// We've captured all leading whitespace and the attribute name.
|
||||
// We're now at: " asp-for|='...'" or " asp-for|=..."
|
||||
// The goal here is to consume the equal sign and the optional single/double-quote.
|
||||
|
|
|
|||
|
|
@ -757,7 +757,23 @@ namespace Microsoft.AspNetCore.Razor.Compilation.TagHelpers
|
|||
RazorResources.FormatParseError_UnexpectedEndTag("p"),
|
||||
absoluteIndex: 31, lineIndex: 0, columnIndex: 31, length: 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"<p class=some=thing attr=\"@value\"></p>",
|
||||
new MarkupBlock(
|
||||
new MarkupTagHelperBlock("p",
|
||||
new List<KeyValuePair<string, SyntaxTreeNode>>
|
||||
{
|
||||
new KeyValuePair<string, SyntaxTreeNode>("class", factory.Markup("some"))
|
||||
})),
|
||||
new []
|
||||
{
|
||||
new RazorError(
|
||||
"TagHelper attributes must be well-formed.",
|
||||
new SourceLocation(13, 0, 13),
|
||||
length: 13)
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue