Vogen icon indicating copy to clipboard operation
Vogen copied to clipboard

MemoryPack support

Open SteveDunn opened this issue 1 year ago • 5 comments

          I'd love MemoryPack support to be added to Vogen.

Originally posted by @aradalvand in https://github.com/SteveDunn/Vogen/issues/305#issuecomment-2452321670

SteveDunn avatar Nov 02 '24 06:11 SteveDunn

@aradalvand - I started working on this, but hit a brick wall: MemoryPack uses source generators, but so does Vogen. There is no way to order which source generator runs first, so MP was emitting errors because value objects were empty (i.e. they hadn't been augmented with fields/constructors etc.)

This won't be a problem if the value objects are in a separate assembly.

SteveDunn avatar Nov 14 '24 07:11 SteveDunn

@SteveDunn You're right; I realized the same thing quickly after I suggested this :) However, it would still have been possible for Vogen to support MemoryPack via generating custom formatters, if MemoryPack had support for this kind of thing. I've created an issue on their repo, but no response yet. MemoryPack effectively lacks proper extensibility points at the moment, until it adds the feature I described in that issue.

aradalvand avatar Nov 14 '24 10:11 aradalvand

This won't be a problem if the value objects are in a separate assembly.

Then we'd still be back to square one because the value objects would be considered "foreign" types that the user would have to manually write formatters for — see this other issue I created in MemoryPack's repo.

aradalvand avatar Nov 14 '24 10:11 aradalvand

The MessagePack is a big step forward & good enough for now; thanks for adding it.

aradalvand avatar Nov 14 '24 10:11 aradalvand

👍👍 I'll add the formatters as it'll still be useful for value objects in other assemblies.

SteveDunn avatar Nov 14 '24 10:11 SteveDunn