Skip to content

Break up ResolveElement method in DefaultTagHelperResolutionPhase #13000

Description

@chsienki

Background

The ResolveElement method in DefaultTagHelperResolutionPhase.cs grew significantly during PR #12957's deferred lowering refactoring. It handles the full resolution of unresolved elements into tag helpers or plain markup, including tag helper binding, diagnostic generation, and child attribute conversion. The method is now long enough that it would benefit from being split into logical pieces.

What to change

Break ResolveElement into smaller methods. Suggested split points:

  1. Tag helper binding and validation — the initial binding lookup, rule validation, and diagnostic generation
  2. Element construction — creating the TagHelperIntermediateNode or unwrapping back to markup
  3. Child attribute processing — the loop that converts children from unresolved to resolved form

Files to update

  • src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultTagHelperResolutionPhase.cs — the ResolveElement method

Notes

  • This is a pure refactoring — no behavioral changes.
  • The method is called from ProcessElement in the tree-walking logic.
  • Ensure any extracted methods are static where possible (the existing code favors static methods).

ref: PR #12957 review comment #12957 (comment)

Metadata

Metadata

Labels

area-compilerUmbrella for all compiler issues

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions