Open GoogleCodeExporter opened 9 years ago
I am having the same problem with double?[], but I don't think it's because
values are null, because I have no null values. Basically I have a double?[]
set up in my class. I see that my array is correctly sized double?[20]
immediately before being serialized, but when de-serialilzed, they are double
the expected size, double?[40], and the actual values are located at index
20-39 and index 0-19 are null.
Original comment by michaels...@gmail.com
on 3 Apr 2013 at 6:12
By the way, changing an array to int[] hasn't fixed it.
The strange thing about it is, that on deserializing object protobuf calls
getter of the int[] property before calling setter.
I've added that array property to wrap a 2d array property. Firstly the
deserializer has thrown a nullref exception, cause of calling getter, which
couldn't access 2d array. I've expected protobuf to call only setter on
deserializing. That's why I've placed initialization of the 2d array in the
setter of the int[] property.
Then I've "fixed" it by initializing 2d array property by deserializing of
another property, which came earlier. But the length of the wrapper int[]
property then was doubled. Is it an expected behavior?
Finally I could get it to work by returning null in the getter of int[]
property after the default constructor (which is only used by the protobuf).
After calling getter the protobuf deserializer has called setter of int[] with
the correct length. Elements were also correct.
Original comment by lambh...@gmail.com
on 4 May 2013 at 7:33
If someone wants to see an example - you can find it on bitbucket:
https://bitbucket.org/kostgr/sudokusolver/overview
The serializable class can be found under Sudoku/Grid/SudokuGrid.cs
Steps to reproduce: compile and try to load one of the samples.
Original comment by lambh...@gmail.com
on 4 May 2013 at 7:38
Original issue reported on code.google.com by
lambh...@gmail.com
on 2 Apr 2013 at 10:01