Re: [protobuf] protobuf calling getter on deserialization?

2013-09-19 Thread Marc Gravell
What is the property? A sub-object? A List? If the serializer doesn't think
it needs to call the setter: it won't. For example, the typical list
handling code could be paraphrased (not the actual implementation) as:

var list = obj.SomeList;
bool setValue = false;
if(list == null) {
list = new ListSomeType();
setValue = true;
}
while(nextTag == expected) {
 list.Add(ReadSomeType());
}
if(setValue) obj.SomeList = list;

Indeed, it is not uncommon that there *is no setter* (for a list / child
object), so the library needs to support those scenarios too.

There are some flags you can set to help steer it to always write - but an
example of your scenario would help.

Also, note that the library supports deserialization callbacks (to perform
any pre-deserialization steps), custom type factories (to initialize
objects in a different way) and constructor-skipping (to bypass any fields
initializers) - these are all optional switches etc.

Marc
On 18 Sep 2013 22:09, David Deutsch da...@reverenddave.com wrote:

 I know this is a long shot, but is there any reason protobuf-net would
 call the getter of a property on deserialization, and not the setter? Most
 of my properties serialize and deserialize fine, but for one particular
 property only the getter is called, and thus deserialization fails.

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to protobuf+unsubscr...@googlegroups.com.
 To post to this group, send email to protobuf@googlegroups.com.
 Visit this group at http://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


[protobuf] protobuf calling getter on deserialization?

2013-09-18 Thread David Deutsch
I know this is a long shot, but is there any reason protobuf-net would call 
the getter of a property on deserialization, and not the setter? Most of my 
properties serialize and deserialize fine, but for one particular property 
only the getter is called, and thus deserialization fails. 

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.