Description
Summary
The Razor compiler today represents a significant portion of time experienced by developers in inner-loop scenarios. We should investigate reimplementing it to be based on source generators to avoid the cost of an extra discrete step and removal of another process associated with building.
Today, the Razor compilation process is non-incremental, meaning even the smallest change to any Razor file results in a complete build of all Razor assets in a project. We should investigate the potential for adding further incrementality to Razor compilation so that unnecessary compilation time is not spent between edits.
Notes
The hypothesis is that an additional compile step can be eliminated along with state management if we are able to use source generators. We might also benefit of not producing janky types in design time builds.
Tasks
- Draft PR: Use source generators to compile Razor files #28807
- SDK PR PR: Add support for source generators in Razor compiler/SDK sdk#15756
- Combine views and app assembly: Combine the contents of the views dll in to the app as part of hot reload / source generator effort #29862
- Add tests for SourceGenerators
- Migrate tests for SG-specific SourceDocuments from Razor.Language
- Add integration tests for SG-specific scenarios
- Tooling EnC support for source generated files: Edit and Continue does not support modifications to source generated files roslyn#50039 (ETA 2/8)
- Tooling EnC support for swapping between Razor design time and source generated files: ETA 2/15. No tracking issue.
- Compiler: Framework to support incrementalism in source generators: No tracking issue, but this is not blocking (Granular Source Generator APIs roslyn#51257)