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
{{ message }}
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
The following C# code should fail to serialize as sf is null.
namespace bug
{
using System;
using System.IO;
using Bond;
using Bond.Protocols;
internal static class Program
{
private static void Main()
{
var obj = new NonNullableStringField
{
sf = null
};
var ser = new Serializer<SimpleJsonWriter>(typeof (NonNullableStringField));
var stream = new StringWriter();
var jw = new SimpleJsonWriter(stream);
ser.Serialize(obj, jw);
jw.Flush();
Console.WriteLine(stream.ToString());
}
}
}
Instead, the following is output.
{"sf":null}
Other types than string, like sub-struct fields, are also affected.
SimpleXmlWriter is also affected. CompactBinaryWriter, FastBinaryWriter, and SimpleBinaryWriter all fail with a NullReferenceException, as expected.
Given the following .bond file
The following C# code should fail to serialize as
sfisnull.Instead, the following is output.
Other types than string, like sub-struct fields, are also affected.
SimpleXmlWriteris also affected.CompactBinaryWriter,FastBinaryWriter, andSimpleBinaryWriterall fail with aNullReferenceException, as expected.