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:
- Tag helper binding and validation — the initial binding lookup, rule validation, and diagnostic generation
- Element construction — creating the
TagHelperIntermediateNode or unwrapping back to markup
- 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)
Background
The
ResolveElementmethod inDefaultTagHelperResolutionPhase.csgrew 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
ResolveElementinto smaller methods. Suggested split points:TagHelperIntermediateNodeor unwrapping back to markupFiles to update
src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultTagHelperResolutionPhase.cs— theResolveElementmethodNotes
ProcessElementin the tree-walking logic.staticwhere possible (the existing code favors static methods).ref: PR #12957 review comment #12957 (comment)