I have the following C# code of a class which I create an object of that I am trying to send in a MessageQueue that keeps giving me the InvalidOperationException "There was an error generating the XML document" that I cannot figure out how to get rid of. What am I doing wrong?
[Serializable()]
public class InMessage : ISerializable
{
public bool IsSubscription;
public String Type;
public DateTime TimeStamp;
public String SenderID;
public Object Content;
public InMessage()
{
IsSubscription = false;
Type = "";
TimeStamp = DateTime.Now;
SenderID = "";
Content = "";
}
public InMessage(bool isSubscription, String type, DateTime timeStamp, String senderID, Object content)
{
IsSubscription = isSubscription;
Type = type;
TimeStamp = timeStamp;
SenderID = senderID;
Content = content;
}
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("IsSubscription", IsSubscription);
info.AddValue("Type", Type);
info.AddValue("TimeStamp", TimeStamp);
info.AddValue("SenderID", SenderID);
info.AddValue("Content", Content);
}
}
The error was actually irrelevant to this class but was a problem with the formatter.