This happens when trying to use the JsonFormatter for types with any optional fields.
Simple proto file:
message TestMessage {
optional string TestField = 1;
}
Simple test:
let x = { TestMessage.empty() with TestField = ValueSome "hello" }
let string = Google.Protobuf.JsonFormatter.Default.Format(x)
Result:
Message:
System.ArgumentException : Unable to format value of type Microsoft.FSharp.Core.FSharpValueOption`1[System.String]
Stack Trace:
JsonFormatter.WriteValue(TextWriter writer, Object value)
JsonFormatter.WriteMessageFields(TextWriter writer, IMessage message, Boolean assumeFirstFieldWritten)
JsonFormatter.WriteMessage(TextWriter writer, IMessage message)
JsonFormatter.Format(IMessage message, TextWriter writer)
JsonFormatter.Format(IMessage message)
This happens when trying to use the
JsonFormatterfor types with anyoptionalfields.Simple proto file:
Simple test:
Result: