// Fields
private string msg;
private string type;
-
+
// Constructors
public TypeLoadException ()
: base (Locale.GetText ("A type load exception has occurred."))
{
- msg = Locale.GetText ("A type load exception has occured.");
}
public TypeLoadException (string message)
: base (message)
{
- msg = message;
}
public TypeLoadException (string message, Exception inner)
: base (message, inner)
{
- msg = message;
}
- public TypeLoadException (SerializationInfo info,
- StreamingContext context)
+ protected TypeLoadException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
+ if (info == null)
+ throw new ArgumentNullException ("info is null.");
+
+ type = info.GetString ("type");
}
// Properties
- public override string Message
- {
- get { return msg; }
+ public override string Message {
+ get {
+ if (type == null)
+ return base.Message;
+
+ if (msg == null)
+ msg = "Cannot load type '" + type + "'";
+
+ return msg;
+ }
}
- public string TypeName
- {
- get { return type; }
+ public string TypeName {
+ get {
+ if (type == null)
+ return "";
+
+ return type;
+ }
}
// Methods
- //
- // It seems like this object serializes more fields than those described.
- // Those fields are TypeLoadClassName, TypeLoadAssemblyName,
- // TypeLoadMessageArg and TypeLoadResourceID.
- //
- [MonoTODO]
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info is null.");
+
base.GetObjectData (info, context);
+ info.AddValue ("type", type, typeof (string));
}
}
}