Switch binary-serialization to an implementation that is supported by CoreClr
Description
Environment
dependant
Activity
I do not believe second level cache uses binary serialization.
For me, serialization is mainly a session feature used in some patterns like long conversations, allowing to serialize the session, dispose of it, then later deserialize it and go on with the "unit of work". I do not know if this feature is much used. From my point of view (which maybe lacks some reasons about why we can serialize sessions, session factories, ...), we could choose to not support serialization when targeting .Net Core / Standard.
With .NET Core 2.0, SerializableType
actually works, but most other binary serialization used throughout NHibernate do not work. Things like serializing the configuration or a session do not work because those types include fields that are System.Type
, System.Reflection.MethodInfo
, and System.Reflection.FieldInfo
.
For more information, refer to https://github.com/dotnet/corefx/issues/19119, specifically search for UnitySerializationHolder
, as that is what serializes System.Type in the .NET Framework.
Can serialization be made an optional feature instead of switching it out? Obviously SerializableType
would be disabled. What besides second-level caches would be otherwise affected?
JSON.NET or XmlSerializer