Open GoogleCodeExporter opened 8 years ago
Now I think that problem is in this code:
private object DeserializeCore(ProtoReader reader, Type type, object value, bool noAutoCreate)
{
int key = GetKey(ref type);
if (key >= 0)
{
return Deserialize(key, value, reader);
}
// this returns true to say we actively found something, but a value is assigned either way (or throws)
TryDeserializeAuxiliaryType(reader, DataFormat.Default, Serializer.ListItemTag, type, ref value, true, false, noAutoCreate, false);
return value;
}
As you can see 'autoCreate' parameter (which called 'noAutoCreate' by mistake)
not passed to Deserialize() so default value for all value-types (including
enums) will be created. But inside the TryDeserializeAuxiliaryType() it is only
created for 'autoCreate=true' case.
P.S.: I put all my fixes to github - see
https://github.com/vadimskipin/protobuf-net for details.
P.P.S.: It is very sad that there is no official github mirror :(
Original comment by vadim.sk...@gmail.com
on 24 Jan 2012 at 8:07
Fixed as side-effect of 265, in r481
Original comment by marc.gravell
on 24 Jan 2012 at 11:37
In debug build we have failed debug assertion in EnumSerializer.cs:
public object Read(object value, ProtoReader source)
{
Helpers.DebugAssert(value == null); // since replaces
...
Again, it looks like 'ser.Read(Activator.CreateInstance(ser.ExpectedType),
source)' line in RuntimeTypeMode.cs is the cause of problem.
Original comment by vadim.sk...@gmail.com
on 25 Jan 2012 at 12:49
...and assertion in TagDecarator.cs:
public override object Read(object value, ProtoReader source)
{
Helpers.DebugAssert(fieldNumber == source.FieldNumber);
...
Original comment by vadim.sk...@gmail.com
on 25 Jan 2012 at 1:27
Darn - will check
Original comment by marc.gravell
on 25 Jan 2012 at 3:31
The first part is fixed next build; do you have a repro for the tagdecorator
issue?
Original comment by marc.gravell
on 29 Feb 2012 at 2:31
Original issue reported on code.google.com by
vadim.sk...@gmail.com
on 23 Jan 2012 at 3:03Attachments: