.NET 6 hot reload support.
See original GitHub issueYesterday I hacked together rudimental hot reload support that is coming in .NET 6 for asp.net projects. For me this is useful because with Service Fabric and angular I’m having inner development loop times of several minutes, and it’s untenable. I’m looking at tye with Dapr with Blazor, just for this reason. This is just a trial to see whether it would work, but to make it into a decent PR, a bit of discussion might be necessary. Also, I’m not familiar with the inner workings of tye, which is why this may seem rather hacky. I’m very open to suggestions for improvement.
The changes are here:
https://github.com/dotnet/tye/compare/main...jspuij:net6hotreload
The way I did it was to disable the internal file watching of tye and run dotnet watch run
instead of the executable directly. There are some advantages and disadvantages to this approach:
Advantages:
- Hot reload seems to be working and certainly improves inner loop time.
- RCL static web asset resolution works, which doesn’t work when you start the executable directly. (this is another issue with the current tye).
Disadvantages:
- Tye file watching is replaced with dotnet file watching. With hot reload the executable will keep running. With hot reload disabled, or in case of a failure, tye routines that would normally run when a process is restarted, won’t be run because
dotnet watch run
will keep running, even though the child process might be restarted. No idea whether this is important, but it’s a consequence. - Hot reload does not work with the
--no-build
switch, so tye will do another build of the asp.net project. This might be something that can be debated with the aspnetcore team. @SteveSandersonMS might have some tips on the hot reload mechanism. - I think there might be very wonky results if two microservices have hot reload enabled and have a reference to a shared library. I’m not sure that the shared library is even monitored for changes, but if it is, this is a scenario that should be tested and looked at.
- Nothing tried or tested with projects run inside a container instead of directly on the host.
This might not be the route to take at all, but even then this issue can serve as a starting point for implementing hot reload support in Tye.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:27
- Comments:8
Top GitHub Comments
Any words on this? It would greatly improve the dev flow if hot reload was supported.
I think this is not necessary as @jspuij demonstrated it in his commit.