Thanks! JohnAskew. That does the trick. To those who are interested:
//............
protected FooException(SerializationInfo info, StreamingContext context)
:
base(info, context)
{
this._errorNumber = info.GetInt32("_errorNumber");
initialize();
}
[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("_errorNumber", this._errorNumber);
}