core icon indicating copy to clipboard operation
core copied to clipboard

Caching issue in the booster when compiling multiple html projects

Open fischgeek opened this issue 2 years ago • 3 comments

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.

fischgeek avatar Aug 02 '22 14:08 fischgeek

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.

granicz avatar Aug 02 '22 14:08 granicz

@fischgeek @granicz Some testing bring us closer:

  1. the F# code being executed seems to be the correct, current one. Only WebSharper.UI.Templating type provider is caching incorrectly
  2. 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.

Jand42 avatar Aug 07 '22 17:08 Jand42

Wow, unusual turn of events there - awesome to have this figured out, thanks!

granicz avatar Aug 07 '22 19:08 granicz

@fischgeek Hello, this is now fixed in WebSharper.UI hotfix release https://github.com/dotnet-websharper/ui/releases/tag/6.0.0.230

Jand42 avatar Aug 10 '22 15:08 Jand42