Things work fine if I the C# type I use contains the new field:
class InnerObject
{
public int Value { get; set; }
}
class Order
{
public int Id { get; set; }
public InnerObject[] Values { get; set; } = Array.Empty<InnerObject>();
}
// OK
var serializer = new BinarySerializerBuilder().BuildDelegate<Order>(schema);
But if I attempt to generate the serializer with the "old" version of my C# type, ie without the Values property, the serializer builder fails with this error:
System.InvalidOperationException: 'variable '' of type 'System.Collections.Generic.IEnumerator'1[System.Object]' referenced from scope 'InnerObject serializer', but it is not defined'
class OrderLegacy
{
public int Id { get; set; }
}
// FAIL: System.InvalidOperationException
var serializer = new BinarySerializerBuilder().BuildDelegate<Order>(schema);
I'm getting an error when attempting to create a serializer for my schema.
Here's the schema, which include a new field called
Values
, which is an array of records with a default value of[]
:Things work fine if I the C# type I use contains the new field:
But if I attempt to generate the serializer with the "old" version of my C# type, ie without the
Values
property, the serializer builder fails with this error:System.InvalidOperationException: 'variable '' of type 'System.Collections.Generic.IEnumerator'1[System.Object]' referenced from scope 'InnerObject serializer', but it is not defined'