A couple of optimizations we can implement:
-
Remove design-time build from the startup path. We run dotnet build and then we run in-proc design-time build to get pretty much the same information that already exists within dotnet build. The build could save it to a file in obj dir that we read. The same applies not just watch but also to IDEs (VS and CDK).
-
VBCSCompiler server that runs during dotnet build has all source files parsed and all metadata references loaded and decoded. Loading the baseline Roslyn Solution in watch needs exactly the same artifacts, which need to be recreated. Instead, the server could create HotReloadWorkspace upon request from dotnet watch and keep it up-to-date based on information sent to it from dotnet watch as files change on disk. This workspace would be disposed of when dotnet watch terminates. It might even be possible to seed the workspace with the project compilations created during the build, as those are exactly the compilations we need to use as a baseline for Hot Reload.
The EnC service in IDE (VS/CDK) would also benefit from fetching baseline source file snapshots loaded in VBCSCompiler for recent build. See https://github.com/dotnet/roslyn/blob/a1696ddfa684b7044ba4429e1c9c1171e698b63c/src/Features/Core/Portable/EditAndContinue/CommittedSolution.cs#L347
Related: https://github.com/orgs/dotnet/projects/618/views/2?pane=issue&itemId=143278174
A couple of optimizations we can implement:
Remove design-time build from the startup path. We run
dotnet buildand then we run in-proc design-time build to get pretty much the same information that already exists withindotnet build. The build could save it to a file in obj dir that we read. The same applies not just watch but also to IDEs (VS and CDK).VBCSCompiler server that runs during
dotnet buildhas all source files parsed and all metadata references loaded and decoded. Loading the baseline Roslyn Solution in watch needs exactly the same artifacts, which need to be recreated. Instead, the server could createHotReloadWorkspaceupon request fromdotnet watchand keep it up-to-date based on information sent to it fromdotnet watchas files change on disk. This workspace would be disposed of whendotnet watchterminates. It might even be possible to seed the workspace with the project compilations created during the build, as those are exactly the compilations we need to use as a baseline for Hot Reload.The EnC service in IDE (VS/CDK) would also benefit from fetching baseline source file snapshots loaded in VBCSCompiler for recent build. See https://github.com/dotnet/roslyn/blob/a1696ddfa684b7044ba4429e1c9c1171e698b63c/src/Features/Core/Portable/EditAndContinue/CommittedSolution.cs#L347
Related: https://github.com/orgs/dotnet/projects/618/views/2?pane=issue&itemId=143278174