Skip to content

NH-3853 - Switch binary-serialization to an implementation that is supported by CoreClr #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nhibernate-bot opened this issue Oct 12, 2017 · 1 comment

Comments

@nhibernate-bot
Copy link
Collaborator

nhibernate-bot commented Oct 12, 2017

Johannes Rauber created an issue — 29th February 2016, 12:54:58:

JSON.NET or XmlSerializer


Nathan Brown added a comment — 14th August 2016, 19:58:29:

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?


Nathan Brown added a comment — 16th July 2017, 20:15:19:

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(https://github.com/dotnet/corefx/issues/19119), specifically search for UnitySerializationHolder, as that is what serializes System.Type in the .NET Framework.


Frédéric Delaporte added a comment — 16th July 2017, 20:40:06:

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.

@fredericDelaporte
Copy link
Member

.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.

An update about:

What besides second-level caches would be otherwise affected?

I do not believe second level cache uses binary serialization.

In fact it depends on the cache provider. Non distributed ones usually do not use it, while distributed ones may use it. So that part is a cache provider subject, not a core NHibernate one. On NHibernate side, the entities to be cached are disassembled in an object array representation made of simple types, and that is this object array which is actually cached. No binary serialization is involved for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants