Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with serialize/deserialize Hashtable which has Value the same as Key #2

Open
nstvsn opened this issue Nov 25, 2016 · 3 comments

Comments

@nstvsn
Copy link

nstvsn commented Nov 25, 2016

The GroBuf misses values if the value is the same as a key. So if key == "testval" and value == "testval", so after serialization/deserialization your hashtable["testval"] will be null.

Steps to reproduce (just pseudo-code):

  1. Create simple Hashtable ht = new Hashtable();
  2. hashtable.Add("testval", "testval")
    3, serializer.Serialize(hashtable) and then serializer.Deserialize(byte[]....)
  3. check that deserialized hashtable["testval"] == null
@homuroll
Copy link
Contributor

homuroll commented Dec 6, 2016

Hmm, this test passes:
var ht = new Hashtable();
ht.Add("testval", "testval");
var bytes = serializer.Serialize(ht);
var ht2 = serializer.Deserialize(bytes);
Assert.AreEqual("testval", ht2["testval"]);

May be you tested on some old version?

@nstvsn
Copy link
Author

nstvsn commented Dec 6, 2016

Hi,
I have figured out the issue. It happens if serializer is created with GroBufOptions.PackReferences.

@homuroll
Copy link
Contributor

homuroll commented Dec 13, 2016

Ok, I'l look at it. By the way do you really need to use GroBufOptions.PackReferences? GroBuf works slower with this option, we only used when there was a need to serialize/deserialize graphs with loops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants