adam-dot-cohen / HyperSerializer

.Net Binary Serializer - 17x faster than Protobuf and Messagepack, 2x faster than MemoryPack for C#, F# , VB, etc...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HS throws a compile error when a class instance contains complex Type

billwoo opened this issue · comments

error at: Span bytes = HyperSerializer.Serialize(stree);

System.TypeInitializationException: 'The type initializer for 'Hyper.HyperSerializer`1' threw an exception.'

InnerException: Compilation failed, first error is: CS7036: There is no argument given that corresponds to the required formal parameter 'name' of 'SimpleTree.SimpleTree(string, string)';

'name' is used in the ctor, but there is no use of any (string, string)

@billwoo - The complex type property should be ignored during serialization per the Read Me. Is the type a struct without a default constructor? If you can post some sample code to reproduce, I'll take a look.

HyperSerializer does not support heap based reference types or collections containing heap based reference types (see Read Me > Limitations) at this time. I've been meaning to support for complex types / full object graph, but haven't gotten around to it.

If you want to take a crack at adding support, let me know. Happy to collaborate and work on it with you. Basically need to update CodeGeneratorV3 and CodeSnippetsV3 and add calls to HyperSerializer.Serialize/Deserialize inside the generated class (from CodeSnippetsV3) so the library uses itself when it encounters complex types.

Closing the issue as the desired functionality is not supported at this time