Closed GoogleCodeExporter closed 9 years ago
Nullable values are on the edge of what the underlying spec can define; for
properties etc null is interpreted as "do not serialize". Inside
collections/arrays, it cannot handle nulls as there would be no spec-compliant
way to express that on the wire.
Original comment by marc.gravell
on 8 Aug 2011 at 6:53
This is fixed in current trunk, **HOWEVER**, protobuf has no direct support for
nulls. There is a new optional mechanism for this ("SupportNulls") which *if
enabled* will allow nulls in lists/arrays to be captured, **but** it is a
breaking change for that member (and requires a very small amount of overhead
per item).
Original comment by marc.gravell
on 2 Nov 2011 at 9:59
Hi there,
I am using a string[] and would like to keep the null values inside the array.
You mentioned that SupportNull option but I couldn't find how to enable that
behaviour. If I try to set attributes on the ProtoMember, I can see the
IsPacked, IsRequired, OverwriteLists booleans but SupportNull does not appear..
I just grabbed the r480.
Please can you advice how to use it?
Many thanks.
Original comment by edward.a...@bigjimmyindustries.com
on 14 Dec 2011 at 11:47
I haven't documented that option yet (it was added as a specific request), but
- *at the moment* you can only enable this via (for example):
RuntimeTypeModel.Default[typeof (YourType)][3].SupportNull = true;
where 3 is the field-number.
This should probably be available on the attribute model too...
Original comment by marc.gravell
on 14 Dec 2011 at 12:10
It did it, Thank you so much!!
Original comment by edward.a...@bigjimmyindustries.com
on 14 Dec 2011 at 12:38
Any chance of this being added to the attribute model?
Original comment by j...@jdh28.co.uk
on 14 Mar 2014 at 4:27
Just had the same problem.
While I do understand that the protocol is not capeable of handling this
(seriously google?), I do not understand that a nullref is thrown from deep
inside your code.
What about adding a much more meaningfull Exception here? Something like
ProtoBufProtocolException("Arrays and lists are not allowed to contain
'null'-values.")?
Original comment by bastianm...@googlemail.com
on 5 Aug 2014 at 9:17
Original issue reported on code.google.com by
rdingw...@gmail.com
on 8 Aug 2011 at 6:14