When building Schema Registry serializers for dynamic types, serialization may fail:
using var builder = new SchemaRegistrySerializerBuilder(registry);
var context = new SerializationContext(MessageComponentType.Value, "some-topic");
var serializer = await builder.Build<dynamic>(schemaId);
dynamic value = new ExpandoObject();
value.Field = "some text";
serializer.Serialize(value, context);
Error:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
at CallSite.Target(Closure , CallSite , ExpandoObject )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at ExampleRecord serializer(Closure , ExpandoObject , BinaryWriter )
at Chr.Avro.Confluent.DelegateSerializer`1.Serialize(T data, SerializationContext context)
When building Schema Registry serializers for dynamic types, serialization may fail: