Commit af94f21
Add failing test for ArgumentOutOfRangeException in tag helper resolution
When an orphan end tag (e.g. </input> without a matching start tag)
immediately follows HTML text content and the tag name matches a legacy
tag helper, DefaultTagHelperResolutionPhase throws
ArgumentOutOfRangeException.
Root cause: the legacy resolver's ConvertToPlainElement removes the
wrapper at parent.Children[index], inserts the lowered HTML for the
orphan end tag, then calls MergeAdjacentHtmlContent, which merges those
tokens into the preceding text sibling and removes one item from
parent.Children. The caller then indexes parent.Children[index] using
the now-stale index.
This is the same class of bug fixed by PR #83516, just in a different
code path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8086386 commit af94f21
1 file changed
Lines changed: 39 additions & 0 deletions
File tree
- src/Compiler/Microsoft.AspNetCore.Razor.Language/test
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
498 | 537 | | |
499 | 538 | | |
500 | 539 | | |
| |||
0 commit comments