[Mono-list] RegistrationException

Lluis Sanchez lluis@ideary.com
Tue, 4 Feb 2003 12:30:48 +0100


Hello!

> I am working on RegistrationException class in System.EnterpriseServices
> namepace. the method i am working on is GetObjectData(). I am trying to
> figure out how .net serializes the Errors in GetObjectData() method in

In fact GetObjectData does not serialize information, it just says what
information needs to be serialized...

> this class. There is one hitch. It serializes a whole array of
> RegistrationErrorInfo classes.
> I am using serializer.cs. how should i modify serializer.cs to have it
> find out serialize all this data. i have attached the xml file that was
> created so far.
> thanks to duncan for helping me so far.
> all the best,

In GetObjectData() you only have to fill the provided SerializationInfo with
the data of the exception. You could for example add a new entry named
"ErrorInfo" and with the array of RegistrationErrorInfo as value. Don't
forget to call the base.GetObjectData(), so information of base classes is
also serialized.

You need also to implement a serialization constructor. It is a constructor
with the same parameters as GetObjectData(), but that must do the inverse
operation: it has to take the information from the SerializationInfo and
initialize the fields of the object.

The serialization formatter you use for serializing the exception will see
that RegistrationException implements ISerializable and will call
GetObjectData() to get the information to serialize. This is currently
supported by BinaryFormatter, but not yet by SoapFormatter.

Regards,
Lluis