Skip to content

Clean up RewrittenSyntaxTree naming and null handling in resolution phase #12996

@chsienki

Description

@chsienki

Background

PR #12957 introduced the deferred tag helper lowering pipeline which changed how RewrittenSyntaxTree is used. The resolution phase (DefaultTagHelperResolutionPhase) no longer accesses the syntax tree directly — it works purely with IR nodes. However, the RewrittenSyntaxTree property on RazorCodeDocument is still set and checked in ways that feel inconsistent after the refactoring.

What to change

  1. Review the naming of RewrittenSyntaxTree — now that the resolution phase doesn't use the syntax tree, the name may be misleading about when/why it's set.
  2. Review the null handling: if the resolution phase runs on the pre-rewrite tree, RewrittenSyntaxTree being null at certain points should either be an error (assert) or handled gracefully with a new/empty tree — not silently allowed.
  3. Update invariants/comments to reflect the new pipeline architecture.

Files to update

  • src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultTagHelperResolutionPhase.cs
  • src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeDocument.cs (or wherever RewrittenSyntaxTree is defined)

Notes

  • This is a naming/documentation/invariant cleanup — behavioral changes should be minimal.
  • Be careful with null semantics: the current null-means-fallback behavior may be load-bearing.

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

Metadata

Metadata

Labels

area-compilerUmbrella for all compiler issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions