Using a derived BinaryUnionSerializerBuilderCase to override SelectType with specified subclasses, serializing null will fail, throwing "Unexpected type encountered serializing..."
This is due to the check for null being inside each case, which is only executed when Expression.TypeIs returns true, which it will not for null values.
If there is only one case other than null, the serializer works as expected, because there is no type check.
Using a derived BinaryUnionSerializerBuilderCase to override SelectType with specified subclasses, serializing null will fail, throwing "Unexpected type encountered serializing..."
This is due to the check for null being inside each case, which is only executed when Expression.TypeIs returns true, which it will not for null values.
If there is only one case other than null, the serializer works as expected, because there is no type check.