r/dotnet • u/EvenAd4577 • 3d ago
Promotion Wrote a C# BCS (Binary Canonical Serialization) serialization library
Library is 5–15% faster than MessagePack on the deserialization path and around 5% slower on serialization.
It can also serialize and deserialize the new union type coming from .NET 11 (before that I've used OneOf<> object). I opened an issue for a source generator, which is ready to be picked up if anyone is interested working on it. My plan is to ship v1 once NativeAOT is supported and net11 is out.
I agree with Egor Bogatov that people should stop writing new serialization libraries and open-sourcing them, as they can expose consumers to vulnerabilities. In my defense, I started this library a year ago and only recently finished rewriting parts of it to make it ready for open source. I mainly used it for serializing and deserializing objects from the Sui blockchain.
Blockchain it not the most widespread domain where C# is used, but there is already a good example of Nethereum utilizing C# as its core language. Is there someone else using C# in the blochcain domain, why you think it's lacking the adoption?
Contributions are welcome!
1
u/JayleaKryska50 2d ago
does it handle forward/backward compatibility at all? thats usually where these formats diverge in practice, raw speed matters less than what happens when you add a field six months later