G
I'm seeing something very odd with binary serialization, and I wanted
to make sure I'm not misunderstanding what goes on under the hood.
Let's say you have a graph with two objects, one referencing the other
(parent/child):
A -> B
Now you have a totally separate but identical graph with an A' and B':
A' -> B'
Property-by-property these objects have the same primitive values.
They're clones, essentially. And let's say there's a grandparent X.
X -> A' -> B'
What I *think* I'm seeing is that the bytes coming out of binary
serialization with an input of A are different than those coming from
binary serialization with an input of A'. The only thing I can seem to
point at as a cause is the sheer existence of X, even though A' has no
direct knowledge of X.
If this is the case, it definitely breaks everything I thought I knew
about binary serialization. I'm actually hoping that I'm totally wrong
here, but after spending about 8 hrs digging deeply into the issue,
this is the only straw left to grasp at.
My specific issue is of course much more complicated. My A->B graph
has more items, with some circular references between them. There are
some structs. Maybe even some Equals overrides (which I know get used
by XML serialization). I've taken a fine toothed comb to this using
the "Make Object ID" functionality of the Watch window... And for the
life of me I can't locate any difference between "the graph starting
from A" and "the graph starting from A' "... But yet the binary
serializations of each, when compared byte-by-byte, are different. One
is always exactly 183 bytes longer. Any ideas would be greatly
appreciated.
This is .NET 2.0, C#.
Thanks,
James
to make sure I'm not misunderstanding what goes on under the hood.
Let's say you have a graph with two objects, one referencing the other
(parent/child):
A -> B
Now you have a totally separate but identical graph with an A' and B':
A' -> B'
Property-by-property these objects have the same primitive values.
They're clones, essentially. And let's say there's a grandparent X.
X -> A' -> B'
What I *think* I'm seeing is that the bytes coming out of binary
serialization with an input of A are different than those coming from
binary serialization with an input of A'. The only thing I can seem to
point at as a cause is the sheer existence of X, even though A' has no
direct knowledge of X.
If this is the case, it definitely breaks everything I thought I knew
about binary serialization. I'm actually hoping that I'm totally wrong
here, but after spending about 8 hrs digging deeply into the issue,
this is the only straw left to grasp at.
My specific issue is of course much more complicated. My A->B graph
has more items, with some circular references between them. There are
some structs. Maybe even some Equals overrides (which I know get used
by XML serialization). I've taken a fine toothed comb to this using
the "Make Object ID" functionality of the Watch window... And for the
life of me I can't locate any difference between "the graph starting
from A" and "the graph starting from A' "... But yet the binary
serializations of each, when compared byte-by-byte, are different. One
is always exactly 183 bytes longer. Any ideas would be greatly
appreciated.
This is .NET 2.0, C#.
Thanks,
James