Creating a serializable exception

M

Mantorok

Hi

We have a C3Exception class derived from ApplicationException, however when
the exeption is thrown from a remote-server it complains that the
C3Exception is not marked as serializable, however, when I implement
ISerializable it still complains, any ideas?

Here is the code:

// Class: C3Exception

// The base class for all C3 exceptions

public class C3Exception : ApplicationException, ISerializable

{

// Constructor: C3Exception

// Argument:

// msg - The exception error message

public C3Exception(string msg)

: base(msg)

{

}


// Constructor: C3Exception

// This version formats the msg string using String.Format() and accepts

// its arguments in the same way.

// Arguments:

// msg - The exception error message

// args - Arguments for insertion into the message

public C3Exception(string msg, params object [] args)

: base(string.Format(msg, args))

{

}

public C3Exception(SerializationInfo info, StreamingContext context) :
base(info, context)

{

}

public void GetObjectData(SerializationInfo info, StreamingContext context)

{

base.GetObjectData(info, context);

}

}



Thanks

Kev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top