2002-01-31 Duncan Mak <duncan@ximian.com>
authorDuncan Mak <duncan@mono-cvs.ximian.com>
Thu, 31 Jan 2002 03:20:31 +0000 (03:20 -0000)
committerDuncan Mak <duncan@mono-cvs.ximian.com>
Thu, 31 Jan 2002 03:20:31 +0000 (03:20 -0000)
    * AppDomainUnloadedException.cs:
    * ApplicationException.cs:
    * ArgumentOutOfRangeException.cs:
    * ArithmeticException.cs:
    * ArrayTypeMismatchException:
    * BadImageFormatException.cs:
    * Exception.cs:
    * MissingMemberException.cs:
    * TypeLoadException.cs: Added missing bits for serialization.

    * FileLoadException.cs:
    * FileNotFoundException: Added missing bits for serialization.

svn path=/trunk/mcs/; revision=2203

13 files changed:
mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/FileLoadException.cs
mcs/class/corlib/System.IO/FileNotFoundException.cs
mcs/class/corlib/System/AppDomainUnloadedException.cs
mcs/class/corlib/System/ApplicationException.cs
mcs/class/corlib/System/ArgumentOutOfRangeException.cs
mcs/class/corlib/System/ArithmeticException.cs
mcs/class/corlib/System/ArrayTypeMismatchException.cs
mcs/class/corlib/System/BadImageFormatException.cs
mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/Exception.cs
mcs/class/corlib/System/MissingMemberException.cs
mcs/class/corlib/System/TypeLoadException.cs

index d62e7ca85a42b3a429fd2e09ffef8ab87f013b3b..6443ed16a003dd929db2d2f5cf00443c67cb36c0 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-31  Duncan Mak  <duncan@ximian.com>
+
+       * FileLoadException.cs:
+       * FileNotFoundException: Added missing bits for serialization.
 
 Thu Jan 24 17:42:54 CET 2002 Paolo Molaro <lupus@ximian.com>
 
index 533e261f094eaef9275861615e989dae7fedcbd8..cf125c98be2b031db3d600abd3248fdda9077b0a 100755 (executable)
@@ -3,35 +3,73 @@
 //
 // Author:
 //   Paolo Molaro (lupus@ximian.com)
+//   Duncan Mak (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-namespace System.IO {
+using System.Globalization;
+using System.Runtime.Serialization;
 
+namespace System.IO {
+       [Serializable]
        public class FileLoadException : SystemException {
+
+               // Fields
+               string msg;
+               Exception inner;
+               string fileName;
+               string fusionLog;
+               
                // Constructors
                public FileLoadException ()
-                       : base ("I/O Error")
+                       : base (Locale.GetText ("I/O Error"))
                {
+                       msg = Locale.GetText ("I/O Error");
                }
 
                public FileLoadException (string message)
                        : base (message)
                {
+                       msg = message;
                }
 
                public FileLoadException (string message, Exception inner)
                        : base (message, inner)
                {
+                       msg = message;
+                       this.inner = inner;
+               }
+
+               protected FileLoadException (SerializationInfo info, StreamingContext context)
+               {
+                       fileName = info.GetString ("FileLoad_FileName");
+                       fusionLog = info.GetString ("FileLoad_FusionLog");
                }
 
-               [MonoTODO]
-               public string FusionLog {
-                       get {
-                               // FIXME
-                               return null;
-                       }
+               // Properties
+               public override string Message
+               {
+                       get { return msg; }
+               }
+
+               public string FileName
+               {
+                       get { return fileName; }
+               }
+               
+               public string FusionLog
+               {
+                       get { return fusionLog; }
+               }
+
+               // Methods
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("FileLoad_FileName", fileName);
+                       info.AddValue ("FileLoad_FusionLog", fusionLog);
                }
+               
        }
 }
index d88ca254d6bbff0b281920fbf5600b7fb1a04a21..e5b772193ed9f52662a18a048cdd9c42cfa2e809 100755 (executable)
@@ -3,49 +3,88 @@
 //
 // Author:
 //   Paolo Molaro (lupus@ximian.com)
+//   Duncan Mak (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
+using System.Globalization;
+using System.Runtime.Serialization;
 
 namespace System.IO {
 
        public class FileNotFoundException : SystemException {
-               private string _fileName;
+               private string fileName;
+               private string fusionLog;
+               private string msg;
+               private Exception inner;
 
                // Constructors
                public FileNotFoundException ()
-                       : base ("File not found")
+                       : base (Locale.GetText ("File not found"))
                {
+                       msg = "File not found";
                }
 
                public FileNotFoundException (string message)
                        : base (message)
                {
+                       msg = message;
                }
 
                public FileNotFoundException (string message, Exception inner)
                        : base (message, inner)
                {
+                       msg = message;
+                       this.inner = inner;
                }
 
                public FileNotFoundException (string message, string fileName)
                        : base (message)
                {
-                       _fileName = fileName;
+                       msg = message;
+                       this.fileName = fileName;
                }
 
-               public string FileName {
-                       get {
-                               return _fileName;
-                       }
+               public FileNotFoundException (string message, string fileName, Exception innerException)
+                       : base (message, innerException)
+               {
+                       msg = message;
+                       this.fileName = fileName;
+                       inner = innerException;
                }
 
-               [MonoTODO]
-               public string FusionLog {
-                       get {
-                               // FIXME
-                               return null;
-                       }
+               protected FileNotFoundException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       fileName = info.GetString ("FileNotFound_FileName");
+                       fusionLog = info.GetString ("FileNotFound_FusionLog");
+                       
+               }
+
+               public string FileName
+               {
+                       get { return fileName; }
+               }
+
+               public string FusionLog
+               {
+                       get { return fusionLog; }
+               }
+
+               public override string Message
+               {
+                       get { return Locale.GetText (msg); }
+               }
+
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       info.AddValue ("FileNotFound_FileName", fileName);
+                       info.AddValue ("FileNotFound_FusionLog", fusionLog);
+               }
+
+               public override string ToString ()
+               {
+                       return inner.ToString();
                }
        }
 }
index f41824e8bba4715f84726cfa2cc9774dab18b91b..9ca65e65c9cd67145bf7a72be292973cc4ebff2f 100644 (file)
@@ -13,30 +13,30 @@ using System.Runtime.Serialization;
 
 namespace System
 {
-          [Serializable]
-          public class AppDomainUnloadedException : SystemException
-          {
-                        // Constructors
-                        public AppDomainUnloadedException ()
-                                   : base (Locale.GetText ("Can't access an unloaded application domain."))
-                        {
-                        }
+       [Serializable]
+       public class AppDomainUnloadedException : SystemException
+       {
+                // Constructors
+                public AppDomainUnloadedException ()
+                           : base (Locale.GetText ("Can't access an unloaded application domain."))
+                {
+                }
 
-                        public AppDomainUnloadedException (string message)
-                                   : base (message)
-                        {
-                        }
+                public AppDomainUnloadedException (string message)
+                           : base (message)
+                {
+                }
                         
-                        protected AppDomainUnloadedException (SerializationInfo info,
-                                   StreamingContext context)
-                                   : base (info, context)
-                        {
-                        }
+                protected AppDomainUnloadedException (SerializationInfo info,
+                           StreamingContext context)
+                           : base (info, context)
+                {
+                }
 
-                        public AppDomainUnloadedException (string message, Exception innerException)
-                                   :base (message, innerException)
-                        {
-                        }
-                                   
-          }
+                public AppDomainUnloadedException (string message, Exception innerException)
+                           :base (message, innerException)
+                {
+                }
+                           
+       }
 }
index 30f15fcc67c5db5ad1f10a4fa2cdf066802befd5..9420c119430dda20e68f86fee0cb6d141f0fd9c5 100644 (file)
@@ -15,7 +15,7 @@ using System.Runtime.Serialization;
 namespace System
 {
 
-     [Serializable]
+       [Serializable]
        public class ApplicationException : Exception
        {
                // Constructors
index 923e06f93dc0318fc99e43f966f482b4d0218d43..b6f21f1f3dd6e4e6887d671e0ba389c0e91a3667 100644 (file)
@@ -3,11 +3,13 @@
 //
 // Author:
 //   Joe Shaw (joe@ximian.com)
+//   Duncan Mak (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
 using System.Globalization;
+using System.Runtime.Serialization;
 
 namespace System {
 
@@ -36,11 +38,25 @@ namespace System {
                        this.actual_value = actual_value;
                }
 
+               public ArgumentOutOfRangeException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       actual_value = info.GetString ("ActualValue");
+               }
                // Properties
                public virtual object ActualValue {
                        get {
                                return actual_value;
                        }
                }
+
+               // Methods
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("ActualValue", actual_value);
+               }
+               
        }
 }
index 94d17043a5371916e03b13b1a4a8a31362203efe..ff6c98cbb35b82c04b3bcb699732feead786172e 100644 (file)
@@ -3,14 +3,16 @@
 //
 // Author:
 //   Joe Shaw (joe@ximian.com)
+//   Duncan Mak  (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
 using System.Globalization;
+using System.Runtime.Serialization;
 
 namespace System {
-
+       [Serializable]
        public class ArithmeticException : SystemException {
                // Constructors
                public ArithmeticException ()
@@ -27,5 +29,10 @@ namespace System {
                        : base (message, inner)
                {
                }
+
+               protected ArithmeticException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+               }
        }
 }
index 32d6b328f08c92c616f287036d8511b10e4b7971..2938300de6158935dc3bda257f44c5cd29d3019d 100644 (file)
@@ -7,9 +7,10 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 using System.Globalization;
+using System.Runtime.Serialization;
 
 namespace System {
-
+       [Serializable]
        public class ArrayTypeMismatchException : SystemException {
                // Constructors
                public ArrayTypeMismatchException ()
@@ -26,5 +27,12 @@ namespace System {
                        : base (message, inner)
                {
                }
+
+               protected ArrayTypeMismatchException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+               }
+
+               
        }
 }
index bb1c68c77c00b286a3504e8f241cfde7a62967a2..8ea5857f5fa126e27e01a7973f7eee7866671a34 100644 (file)
@@ -1,18 +1,93 @@
 // System.BadImageFormatException
 //
 // Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.
 
 using System.Globalization;
+using System.Runtime.Serialization;
+
 namespace System
 {
-       public class BadImageFormatException : Exception
+       [Serializable]
+       public class BadImageFormatException : SystemException
        {
-               public string FusionLog {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               // Fields
+               private string msg; // we need this because System.Exception's message is private.
+               private Exception inner;
+               private string fileName;
+               private string fusionLog;
+               
+               // Constructors
+               public BadImageFormatException ()
+                       : base (Locale.GetText ("Invalid file image."))
+               {
+                       msg = "Invalid file image.";
+               }
+               
+               public BadImageFormatException (string message)
+                       : base (message)
+               {
+                       msg = message;
+               }
+
+               protected BadImageFormatException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       fileName = info.GetString ("BadImageFormat_FileName");
+                       fusionLog = info.GetString ("BadImageFormat_FusionLog");
+               }
+
+               public BadImageFormatException (string message, Exception inner)
+                       : base (message, inner)
+               {
+                       msg = message;
+                       this.inner = inner;
+               }
+
+               public BadImageFormatException (string message, string fileName)
+                       : base (message)
+               {
+                       msg = message;
+                       this.fileName = fileName;
+               }
+
+               public BadImageFormatException (string message, string fileName, Exception inner)
+                       : base (message, inner)
+               {
+                       msg = message;
+                       this.inner = inner;
+                       this.fileName = fileName;
+               }
+                   
+               // Properties
+               public override string Message
+               {
+                       get { return Locale.GetText (msg); }
+               }
+
+               public string FileName
+               {
+                       get { return fileName; }
+               }
+                               
+               public string FusionLog
+               {
+                       get { return fusionLog; }
+               }
+
+               // Methods
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("BadImageFormat_FileName", fileName);
+                       info.AddValue ("BadImageFormat_FusionLog", fusionLog);
+               }
+
+               public override string ToString ()
+               {
+                       return inner.ToString();
                }
        }
 }
index db8d7ce3b38bcff10d844adc588f3acc0f8bcc7c..35a4c7706045945c4b095deafa9d94dd8ae18439 100644 (file)
@@ -1,3 +1,15 @@
+2002-01-31  Duncan Mak  <duncan@ximian.com>
+
+       * AppDomainUnloadedException.cs:
+       * ApplicationException.cs:
+       * ArgumentOutOfRangeException.cs:
+       * ArithmeticException.cs:
+       * ArrayTypeMismatchException:
+       * BadImageFormatException.cs:
+       * Exception.cs:
+       * MissingMemberException.cs:
+       * TypeLoadException.cs: Added missing bits for serialization.
+
 2002-01-30  Duco Fijma <duco@lorentz.xs4all.nl>
        * Guid.cs: implemented everything but Guid.NewGuid
 
index 74a26ac66bc03b1b94c10ce87a94547a9a1a67b5..6a70f9f55b079c40783f995fd00151f36ad5016e 100644 (file)
@@ -138,7 +138,7 @@ namespace System {
                {
                        info.AddValue ("ClassName", class_name);
                        info.AddValue ("Message",   message);
-                       info.AddValue  ("InnerException", inner_exception);
+                       info.AddValue ("InnerException", inner_exception);
                        info.AddValue ("HelpURL",   help_link);
                        info.AddValue ("StackTraceString", stack_trace);
                        info.AddValue ("RemoteStackTrace", remote_stack_trace);
index fa48f83bef20731a2de5b159db502ff090a6a1fc..5f1f72d9d7aaf8c89fdb143eee9647523b7b67fa 100644 (file)
@@ -1,3 +1,10 @@
+//
+// System.MissingMemberException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
 using System;
 using System.Globalization;
 using System.Runtime.Serialization;
@@ -7,49 +14,59 @@ namespace System {
        [Serializable]
        public class MissingMemberException : MemberAccessException {
 
-            // Fields
+               // Fields
                protected string ClassName;
                protected string MemberName;
                protected byte[] Signature;
-                  
+               private string msg;                
 
                // Constructors
                public MissingMemberException ()
                        : base (Locale.GetText ("A missing member exception has occurred."))
                {
+                       msg = Locale.GetText ("A missing member exception has occured.");
                }
 
                public MissingMemberException (string message)
                        : base (message)
                {
+                       msg = message;
                }
 
                protected MissingMemberException (SerializationInfo info, StreamingContext context)
-                       : base (info, context) {
+                       : base (info, context)
+               {
+                       ClassName = info.GetString ("MMClassName");
+                       MemberName = info.GetString ("MMMemberName");
+                       Signature = (byte[]) info.GetValue ("MMSignature", Signature.GetType ());
                }
                
                public MissingMemberException (string message, Exception inner)
                        : base (message, inner)
                {
+                       msg = message;
                }
 
-               [MonoTODO]
                public MissingMemberException (string className, string memberName)
                {
+                       ClassName = className;
+                       MemberName = memberName;
                }
 
-            // Properties
-               [MonoTODO]
+               // Properties
                public override string Message
                {
-                          get { return null; }
+                          get { return msg; }
                }
 
                // Methods
-               [MonoTODO]
-               public override void GetObjectData (SerializationInfo info,
-                                                                        StreamingContext context)
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
                {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("MMClassName", ClassName);
+                       info.AddValue ("MMMemberName", MemberName);
+                       info.AddValue ("MMSignature", Signature);
+                               
                }
                   
        }
index d498d2b661c2e7d41aaa6d8af39f22f56cea05e5..64b3b6d6f5fe8cc8a86626afe46f1b584aa30bcf 100644 (file)
@@ -24,16 +24,19 @@ namespace System {
                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,
@@ -42,24 +45,24 @@ namespace System {
                {
                }
 
-               // Methods
-               [MonoTODO]
-               public override void GetObjectData (SerializationInfo info,
-                                                   StreamingContext context)
-               {
-               }
-
                // Properties
-               [MonoTODO]
                public override string Message
                {
-                       get { return null; }
+                       get { return msg; }
                }
 
-               [MonoTODO]
                public string TypeName
                {
-                       get { return null; }
+                       get { return type; }
+               }
+
+               // Method
+               [MonoTODO] // it seems like this object serializes more fields than those described.
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info is null.");
+                       base.GetObjectData (info, context);
                }
        }
 }