🚀 Host Your RPC Anywhere
Until now, Serde.FS relied on the source-generated entry point (via [<Serde.FS.EntryPoint>]) to register generated JSON codecs and RPC client factories at startup. That worked great — until your API assembly was hosted by a process that never runs your entry point: a desktop shell embedding Kestrel in-process, a WebApplicationFactory integration test, an AutoCAD/Revit add-in, or a C# host referencing your F# API assembly as a library.
As of beta.4, registration happens at the point of use. No entry-point ceremony required.
✨ What's New
MapRpcApiself-initializes. On first call it discovers and runs the generated bootstraps (JSON codecs + RPC dispatch) for the relevant assemblies. In-process Kestrel hosts, test hosts, and add-ins now just work.RpcClient.createself-initializes. On a factory miss it runs the bootstrap scan (interface's assembly first, then all loaded assemblies) before failing.- New public escape hatch:
Serde.FS.Bootstrap. For cases where you need registrations before the first RPC call (e.g. standaloneSerdeJson.serializeduring startup):
Serde.FS.Bootstrap.Run() // scan all loaded assemblies
Serde.FS.Bootstrap.Run(typeof<MyApi>.Assembly) // target one assembly (Init failures propagate)Idempotent and thread-safe — each generated bootstrap runs at most once per process, no matter how many times or from how many threads it's invoked.
🔧 Fixes & Internals
SerdeJson.registerCodecsnow merges into the global codec registry (under a lock) instead of rebuilding it from scratch. Previously, if two assemblies both carried generated codecs, the second registration silently wiped the first. Registrations remain last-write-wins per type, so single-assembly behavior is unchanged.- The generated entry point is now three lines. Instead of inlining its own reflection scan, it simply calls
Serde.FS.Bootstrap.Run()— one scan implementation, one idempotency tracker, shared by every host style.
📌 Notes
[<Serde.FS.EntryPoint>]is still recommended for apps that serialize outside RPC before the firstMapRpcApi/RpcClient.createcall.- All packages ship in lockstep at
1.0.0-beta.4:Serde.FS,Serde.FS.Json,Serde.FS.AspNet,Serde.FS.Fable. - No breaking changes — existing apps using the generated entry point behave exactly as before.
This release was motivated by (and battle-tested in) the fable-lit-fullstack-template's new cross-platform desktop host,
which runs the same ASP.NET Core + Fable.Lit app in a native window via in-process Kestrel — with zero bootstrap code.