This project is read-only.

Renci.SshNet.SftpClient - Serialization Exception

Nov 15, 2013 at 5:01 PM
Hi,

I'm using Renci.SshNet in my library project, but when my class is executed the following exception occurs (pasted below):

Does anyone know how to "mark the Renci.SshNet.SftpClient as serializable"? The library is being called by a Silverlight app

Many thanks
Andy

{System.Runtime.Serialization.SerializationException: Type 'Renci.SshNet.SftpClient' in Assembly 'Renci.SshNet, Version=2013.4.7.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) 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) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders,
__BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at Csla.Serialization.BinaryFormatterWrapper.Serialize(Stream serializationStream, Object graph) at Csla.Core.ObjectCloner.Clone(Object obj) at Csla.CommandBase1.GetClone() at Csla.CommandBase1.System.ICloneable.Clone() at Csla.DataPortal.Update[T](T obj) at Csla.Server.Hosts.Silverlight.SilverlightRequestProcessor.Update(SilverlightUpdateRequest request) }
Csla.DataPortalException: {System.Runtime.Serialization.SerializationException: Type 'Renci.SshNet.SftpClient' in Assembly 'Renci.SshNet, Version=2013.4.7.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.     at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)     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)     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Obj
ect graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at Csla.Serialization.BinaryFormatterWrapper.Serialize(Stream serializationStream, Object graph) at Csla.Core.ObjectCloner.Clone(Object obj) at Csla.CommandBase1.GetClone() at Csla.CommandBase1.System.ICloneable.Clone() at Csla.DataPortal.Update[T](T obj) at Csla.Server.Hosts.Silverlight.SilverlightRequestProcessor.Update(SilverlightUpdateRequest request) }