1

Resolved

XamException should be marked as [Serializable]

description

It is reasonably standard practice to mark custom Exception classes as [Serializable]. As a part of this the following using statement and the default serialization constructor must be added:
 
using System.Runtime.Serialization;
 
    protected XAMException(SerializationInfo info, StreamingContext ctxt)
        : base(info, ctxt)
    {}
 
GetObjectData should also be overridden
 
    public override void GetObjectData(SerializationInfo info, StreamingContext context)
    {
        if (info == null)
        {
            throw new ArgumentNullException("info");
        }
 
        info.AddValue("Status", status);
        info.AddValue("ErrorToken", errorToken);
        info.AddValue("UserMessage", userMessage);
 
        base.GetObjectData(info, context);
    }

comments