Fixed exception with non taghelper start/end void tags

\n\nCommit migrated from ee8fdae756
This commit is contained in:
Ajay Bhargav Baaskaran 2019-01-07 19:37:08 -08:00 committed by Ryan Nowak
parent f87d9b5335
commit 77bd9d343c
1 changed files with 4 additions and 1 deletions

View File

@ -144,8 +144,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
// Non-TagHelper tag.
ValidateParentAllowsPlainStartTag(startTag);
if (!startTag.IsSelfClosing() && !startTag.IsVoidElement())
if (node.EndTag != null || (!startTag.IsSelfClosing() && !startTag.IsVoidElement()))
{
// Ideally we don't want to keep track of self-closing or void tags.
// But if a matching end tag exists, keep track of the start tag no matter what.
// We will just assume the parser had a good reason to do this.
var tracker = new TagTracker(tagName, isTagHelper: false);
_trackerStack.Push(tracker);
}