adam-dot-cohen / HyperSerializer

Dot Net Binary Serializer - 17x faster than Protobuf and Messagepack, 2x faster than MemoryPack
Apache License 2.0
64 stars 5 forks source link

There was lost possibility to serialize property of byte array type #5

Closed ot-roman-molchanov closed 10 months ago

ot-roman-molchanov commented 10 months ago

In the HyperSerializer v1.0.15 was possible to serialize the object like that, without lost of ImageBytes array value: public sealed class ScreenshotContent { public int Width { get; set; } public int Height { get; set; } public byte[]? ImageBytes { get; set; } } var content = new ScreenshotContent { Width = 100, Height = 200, ImageBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7 } }; var serializedContent = HyperSerializer.Serialize(content).ToArray(); Starting from HyperSerializer v1.0.17 this possibility was lost. This property is just ignored now. Is it possible to return the possibility of byte array serialization?

adam-dot-cohen commented 10 months ago

Looking into it.

adam-dot-cohen commented 10 months ago

Issue has been resolved. See link to test class with the code you posted below.

Also, you can continue using HyperSerializer<T> as you were or the new non-generic convenience type that I added HyperSerializer (only have to specify type param on Deserialize.

I released a NuGet as well. v1.2

I'll wait to for you to confirm the fix before closing this out. LMK.

https://github.com/adam-dot-cohen/HyperSerializer/blob/01a7e9da7612b96fe6fbfa8569df604bcc8c8129/HyperSerializer.Test/SerializerTests.cs#L274C40-L274C40

ot-roman-molchanov commented 10 months ago

I confirm the fix. Good job! Thanks a lot for fast response and fix!