You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If creating a new project with dotnet new websharper-web -lang f# and adding this to Client.Main:
letevent= Event<int>()
Running it locally, a runtime error happens on new FSharpEvent.New() because script link to WebSharper.Control.js is not included as it should be.
Explanation
This is because .NET Core is not copying dlls from packages to output folder (except when publishing or using <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>). WebSharper.Control.dll is an assembly that contains only proxies for .NET types, nothing that is directly referenced. So project output dll will have no assembly references for it (neither direct or indirect).
Compiler knows about it because it is a project reference and compiles fine. But Sitelet runtime won't be able to discover it, and so metadata information for it will not be loaded, so dependency graph will be incoplete, and when discovering needed scripts, WebSharper.Control.js (containing the FSharpEvent among many others) will not be included as a script link in page header.
Proposed solution
WebSharper compiler would add extra assembly references to the output dll targeting any assemblies that are containing WebSharper metadata and are not referenced by the build yet.
The text was updated successfully, but these errors were encountered:
Workaround: add <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> to project properties.
Jand42
changed the title
F# Event not including WS.Control.js link on netcore
Sitelets runtime not loading metadata from all needed assemblies on .NET Core
Mar 13, 2018
I would rather fix the underlying cause than introduce an opaque compiler "feature". One such fix would be to output the meta data at build time to the output folder, so the sitelet runtime doesn't have to reconstruct it.
Reproducing issue
If creating a new project with
dotnet new websharper-web -lang f#
and adding this toClient.Main
:Running it locally, a runtime error happens on
new FSharpEvent.New()
because script link toWebSharper.Control.js
is not included as it should be.Explanation
This is because .NET Core is not copying dlls from packages to output folder (except when publishing or using
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
).WebSharper.Control.dll
is an assembly that contains only proxies for .NET types, nothing that is directly referenced. So project outputdll
will have no assembly references for it (neither direct or indirect).Compiler knows about it because it is a project reference and compiles fine. But Sitelet runtime won't be able to discover it, and so metadata information for it will not be loaded, so dependency graph will be incoplete, and when discovering needed scripts,
WebSharper.Control.js
(containing theFSharpEvent
among many others) will not be included as a script link in page header.Proposed solution
WebSharper compiler would add extra assembly references to the output dll targeting any assemblies that are containing WebSharper metadata and are not referenced by the build yet.
The text was updated successfully, but these errors were encountered: