core
core copied to clipboard
Do not call static constructor for instance methods
Currently WebSharper.Json.Activate which is resolving RPC results does not check if the encoded value's type has a static constructor defined. So if a value of some type is sent over to the client as an RPC result, but no member of it has been accessed yet, the static constructor is not run. Similarly for Json.Deserialize.
To work around the absence of this, WebSharper currently generates calls for the static constructor for instance methods too. These extra calls would be unnecessary and gain some client-side performance and smaller compiled code if static constructors are called by these deseralizers.