Can .NET Hot Reload Avoid Restarts When Modifying Main or Static Constructors?
29K reputation · 14 Mar 2020, 07:30 UTC
In a repeatable development environment that relies on dotnet watch run or IDE‑based Hot Reload, developers often encounter full process restarts when they edit the Main method or any static constructor. The underlying Roslyn edit‑and‑continue engine cannot apply changes that alter control flow or type layout, so the runtime performs a restart to preserve correctness.
This limitation is documented for .NET 6 and later across Windows, Linux, and macOS. While instance methods and local variables are updated on the fly, changes to the program’s entry point or static initialization always trigger a restart, regardless of the tooling used.
Given the desire for a truly repeatable, incremental development cycle, the community still lacks clarity on whether future .NET releases will broaden Hot Reload’s scope to include Main and static constructors, or whether alternative configuration patterns can mitigate restarts.
Which .NET runtime version is expected to support incremental changes to Main or static constructors without a full restart? How can a repeatable dev environment detect and handle the inevitable restart events to maintain build reproducibility? What tooling or project‑level strategies exist to reduce the impact of these restarts during active development?