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

Null of comlex type in List<T> and Dictionary<TKey, TValue> deserialized as non-null object #211

Closed
tchekjunior opened this issue Feb 2, 2017 · 6 comments
Labels
bug Detected as bug

Comments

@tchekjunior
Copy link

hi,
i have some problems to unpack list with null elements.
how to fix it please

public class SimpleItem
{
    public int Id;
    public SimpleItem()
    {
}
}
var items= new List<SimpleItem>();
                    items.Add(null);
items[0] = new SimpleItem();

var stream = new MemoryStream();
var context = new SerializationContext();
var serializer = context.GetSerializer<SimpleItem>();

serializer .Pack(stream, items);
stream.Position = 0;
var cloneItems = serializer .Unpack(stream);

cloneItems null item in list is not null, why?

@yfakariya
Copy link
Member

Sorry, it is a critical bug. Thank you for reporting!

@yfakariya yfakariya added the bug Detected as bug label Feb 2, 2017
@tchekjunior
Copy link
Author

hi, thank, i can investigate if you help me, i want to fix it quilkly.
i use build dotNet3.5.
I have meet order dysfonctionnement ,I write other issue after.
but good job is very fast serializer.

@yfakariya yfakariya changed the title Why null item in list, no null after unpack Null of comlex type in List<T> and Dictionary<TKey, TValue> deserialized as non-null object Feb 2, 2017
yfakariya added a commit that referenced this issue Feb 2, 2017
Some built-in serializers use UnpackFromCore instead of UnpackFrom for items deserialization.
This causes bypass of null check, then null items are deserialized as non-null objects.
@tchekjunior
Copy link
Author

Thank you very much for your reactivity to this problem. i try it now. good job

yfakariya added a commit that referenced this issue Feb 2, 2017
Some built-in serializers use UnpackFromCore instead of UnpackFrom for items deserialization.
This causes bypass of null check, then null items are deserialized as non-null objects.
@yfakariya
Copy link
Member

yfakariya commented Feb 2, 2017

Thank you. I will release it as 0.8.1 soon, and port to 0.9.0 branch in this weekend.

@yfakariya
Copy link
Member

BTW, your "order dysfonctionnement" is related to #71?

yfakariya added a commit that referenced this issue Feb 11, 2017
This commit is imported from 0.8.1 branch.

Some built-in serializers use UnpackFromCore instead of UnpackFrom for items deserialization.
This causes bypass of null check, then null items are deserialized as non-null objects.
@yfakariya
Copy link
Member

Fixed in 7e73aff

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

No branches or pull requests

2 participants