I am trying to serialize the configuration object of Nhibernate. While doing so I got the following error,
Unhandled exception. System.Runtime.Serialization.SerializationException: Type 'System.Type' in Assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(Type type) at System.Runtime.Serialization.FormatterServices.<>c.<GetSerializableMembers>b__5_0(MemberHolder mh) at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
Any help would be appreciated. Thanks
I found that the root cause of this error is , there is mapping in the configuration which maps a model using class Mapping. If I didn’t do any mapping in the configuration the serialization is done without any errors.
Krishna Pravesh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.