-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement the Razor compiler using source generators & support incrementality #26902
Comments
Speaking as someone who implemented a few source generators for Blazor, I absolutely love that this is one of the things potentially coming in net6.0! However, please make sure that SGs should also support some sort of sequencing by that time. Otherwise all current SGs which rely on evaluating any of the generated code (the .g.cs files, e.g. for analyzing parameters) would break. Thanks! (See also: dotnet/roslyn#48358) |
@captainsafia let's use the smaller line items to track further work. We'll consider this issue resolved for preview4. @stefanloerwald we made the Roslyn folks aware of your requirement. In addition, there are some ordering requirements for some of the in-box source generators e.g. System.Text.Json's source generator needs to run after the Razor one, so we have vested interest in seeing it addressed. |
@pranavkm Agreed -- I removed the working label for that very reason. Up, up, and away. |
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
The text was updated successfully, but these errors were encountered: