core
core copied to clipboard
Caching issue in the booster when compiling multiple html projects
There seems to be some caching going on in the wsfscservice.exe
Given two separate html projects, the first html project will compile fin and output the .html files. However, another project separate from that will compile but the output will be the same as the first project. As a work-around, I have to kill that wsfscservice.exe and recompile and the output was as expected for project 2.
I have verified this to be a bug indeed. Just some clarification, in case someone else is reading this ticket: wsfscservice.exe (aka the WebSharper Booster) manages different WebSharper runtimes (different versions of WebSharper) and provides cached compilation services for projects using those runtimes. Instead of killing the Booster process, it is sufficient to stop the particular runtime the affected project is using. This can be done either by specifying the exact WebSharper version or just stopping every runtime loaded (see the WebSharper CLI for instructions):
dotnet ws stop --version "6.0.0.228"
or
dotnet ws stop
~~But this is not sufficient if you are expecting to regenerate the HTML output but have made no source changes (to .fs files). In that case, you should also touch a source file or do a clean (dotnet clean), followed by a rebuild (dotnet build or dotnet ws build).~~
Edit: Please note that dotnet build will not regenerate HTML output with no source changes (to .fs files). Simply use dotnet ws build - this works regardless of untouched source files.
@fischgeek @granicz Some testing bring us closer:
- the F# code being executed seems to be the correct, current one. Only WebSharper.UI.Templating type provider is caching incorrectly
- If you change the type provider instantiation to use ServerLoad.PerRequest, html files are reloaded correctly
So as a workaround, use TP like this type MainTemplate = Templating.Template<"Main.html", ClientLoad.FromDocument, ServerLoad.PerRequest>
The issue seems to be caused by ServerLoad.WhenChanged, and should be fixed in WebSharper.UI.Templating: caching should use full file path instead of only relative so the TP can be now be used inside wsfscservice without projects interfering with each other.
Wow, unusual turn of events there - awesome to have this figured out, thanks!
@fischgeek Hello, this is now fixed in WebSharper.UI hotfix release https://github.com/dotnet-websharper/ui/releases/tag/6.0.0.230