Switch binary-serialization to an implementation that is supported by CoreClr

Description

JSON.NET or XmlSerializer

Environment

None

Activity

Show:

Frédéric Delaporte May 31, 2018 at 5:52 PM

Moved here.

.Net Core and .Net Standard support is done, with serialization support delegated to using serialization surrogates. This surrogates can be provided by the user. NHibernate 5.2 will provide default ones, see #1693. And see here for how these default ones could be used.

Frédéric Delaporte July 16, 2017 at 8:40 PM

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.

Nathan Brown July 16, 2017 at 8:15 PM
Edited

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.

Nathan Brown August 14, 2016 at 7:58 PM

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?

Obsolete

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created February 29, 2016 at 12:54 PM
Updated May 31, 2018 at 5:52 PM
Resolved May 31, 2018 at 5:52 PM
Who's Looking?