2
Vote

Mark Exception class as serializable

description

When serialize the exception, i got bellow error

Error Details

Type : System.ApplicationException
Message : Unhandled Exception: System.Runtime.Serialization.SerializationException: Type 'AlexPilotti.FTPS.Common.FTPCommandException' in Assembly 'AlexPilotti.FTPS.Client, Version=1.1.1.25793, Culture=neutral, PublicKeyToken=48316da1e84b328d' is not marked as serializable.
Server stack trace:
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit,

comments

xiper wrote Jun 19, 2013 at 5:57 AM

Exceptions must also include the below constructor:

protected FTPException( SerializationInfo info, StreamingContext context ) : base( info, context ) { }

Applies to:

FTPException
FTPReplyParseException
FTPProtocolException
FTPOperationCancelledException
FTPCommandException
FTPSslException