mbraceproject / FsPickler

A fast multi-format message serializer for .NET
http://mbraceproject.github.io/FsPickler/
MIT License
324 stars 52 forks source link

NonSerializableTypeException with ISerializable types #42

Closed danielrbradley closed 9 years ago

danielrbradley commented 9 years ago

I'm trying to serialize types (e.g. ZonedDateTime) from the NodaTime library which are marked as ISerializable (source), though also contain non-serializable fields. When generating a pickler using:

let p : Nessos.FsPickler.Pickler<NodaTime.OffsetDateTime> = Nessos.FsPickler.FsPickler.GeneratePickler()

it throws NonSerializableTypeException: Type 'NodaTime.OffsetDateTime' contains non-serializable field of type 'NodaTime.CalendarSystem'.

Should FsPickler prefer the ISerializable implementation over field based serialization? Alternatively, should we encourage NodaTime to support DataContract based serialization instead?

eiriktsarpalis commented 9 years ago

That's clearly a bug. Fixed in 3bea2d5f2887f7cce51a56a809c7b2cdf82d0411.

danielrbradley commented 9 years ago

Amazing, thanks for the quick response! :+1:

eiriktsarpalis commented 9 years ago

Just updated to nuget package version 1.0.17.