2003-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 24 Jul 2003 22:00:43 +0000 (22:00 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 24 Jul 2003 22:00:43 +0000 (22:00 -0000)
* TypeLoadException.cs: removed unused fields. TypeName returns "" if
cannot even get the type.

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

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/TypeLoadException.cs

index 0df74354b7ceb9640766ed2a7ef6418269c2ccd5..5fda4e92d8990d493a662c135b2e38c50fe831be 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TypeLoadException.cs: removed unused fields. TypeName returns "" if
+       cannot even get the type.
+
 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
 
        * Type.cs: Added generics stubs.
index 56e30d48d163947ea052a6120d3843cc6cd6e3e5..01c844b19cc4e0fa4a08c2d499f67036512a56a8 100644 (file)
@@ -20,28 +20,20 @@ namespace System {
                private string msg;
                private string type;
 
-                private string ClassName;
-                private string AssemblyName;
-                private string MessageArg;
-                private string ResourceID;
-                
                 // 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;
                }
 
                protected TypeLoadException (SerializationInfo info, StreamingContext context)
@@ -50,21 +42,29 @@ namespace System {
                        if (info == null)
                                throw new ArgumentNullException ("info is null.");
 
-                        ClassName = info.GetString ("TypeLoadClassName");
-                        AssemblyName = info.GetString ("TypeLoadAssemblyName");
-                        MessageArg = info.GetString ("MessageArg");
-                        ResourceID = info.GetString ("ResourceID");
+                       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
@@ -74,10 +74,7 @@ namespace System {
                                throw new ArgumentNullException ("info is null.");
 
                        base.GetObjectData (info, context);
-                        info.AddValue ("TypeLoadClassName", ClassName, typeof (string)); 
-                        info.AddValue ("TypeLoadAssemblyName", AssemblyName, typeof (string));
-                        info.AddValue ("TypeLoadMessageArg", MessageArg, typeof (string));
-                        info.AddValue ("TypeLoadResourceID", ResourceID);
+                       info.AddValue ("type", type, typeof (string)); 
                }
        }
 }