Binary serialization and PCL


Recently, I’ve seen some cases where there is a library, which would benefit from being [Serializable], but can’t, because it’s a PCL and it wants to also support profiles where binary serialization is not available.

Is there some way that this could be made to work? So that types in those libraries could be marked [Serializable] and it would mean that in profiles where binary serialization is available, they would actually be serializable. In profiles where it’s not available, it wouldn’t do anything.

The cases are:


Sounds like the discussion is probably better had in the corefx issues repository … that being said, it feels like serialization should just be a separate concern (ie. nuget) rather than something that’s baked into the underlying framework. For example, you probably won’t be able to just slap [Serializable] on the type and be done with it … you’ll probably have to implement ISerializable, and then what do you do about deserializing blobs made on one platform, from another platform with different endianness? and on and on … there should probably just be a great library out there that does binary serialization, and supports all of the collections and other types that people are interested in.


Hey I am working on a new serializer

And it will be portable to .NET core… soon…ish…
Give it a look! :wink:

.NET Foundation Website | Blog | Projects | Code of Conduct