Class PlatformJson
System.Text.Json (de)serialization for rich platform payloads that ride a JSON-RPC method as an opaque string.
public static class PlatformJson
- Inheritance
-
PlatformJson
- Inherited Members
Remarks
The JSON-RPC transport (OmniSharp) serializes with Newtonsoft.Json, which does not
understand the model's [JsonPolymorphic]/[JsonDerivedType] types (the AST) or its
custom converters (VBTypedValueJsonConverter). Payloads that use those are serialized here
with System.Text.Json and carried inside a PlatformJsonEnvelope whose
only wire field is a string the transport passes through untouched. Shares Options rather than its own bare JsonSerializerOptions so an AST payload
(ModuleParseResult) gets the same size-reducing resolver on the wire as it does under test —
see that type's remarks for why serializing every AST node's generic Children spine
unconditionally, alongside its typed properties, made the wire payload exponential in tree depth.
Methods
Deserialize<T>(string)
Deserializes a System.Text.Json string produced by Serialize<T>(T).
public static T Deserialize<T>(string json)
Parameters
jsonstring
Returns
- T
Type Parameters
T
Exceptions
- InvalidOperationException
The string deserialized to
null.
Serialize<T>(T)
Serializes payload to a System.Text.Json string.
public static string Serialize<T>(T payload)
Parameters
payloadT
Returns
Type Parameters
T