2007-10-27 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / class / corlib / System / Exception.cs
index 0ef050e45fb201855c2e7c6b52c5658a8a2fe5de..97a6d5bd3fd9d77d644c89aa93a72282ffb289ae 100644 (file)
@@ -40,22 +40,31 @@ using System.Security.Permissions;
 namespace System
 {
        [Serializable]
+#if NET_2_0
+       [ComVisible(true)]
+       [ComDefaultInterface (typeof (_Exception))]
+       [ClassInterface (ClassInterfaceType.None)]
+#else
        [ClassInterface (ClassInterfaceType.AutoDual)]
+#endif
        public class Exception : ISerializable 
 #if NET_2_0
        , _Exception
 #endif
        {
+               #region Sync with object-internals.h
                IntPtr [] trace_ips;
                Exception inner_exception;
-               string message;
+               internal string message;
                string help_link;
                string class_name;
                string stack_trace;
                string remote_stack_trace;
                int remote_stack_index;
-               int hresult = unchecked ((int)0x80004005);
+               internal int hresult = unchecked ((int)0x80004005);
                string source;
+               private IDictionary _data;
+               #endregion
 
                public Exception ()
                {
@@ -209,8 +218,6 @@ namespace System
                }
 
 #if NET_2_0
-               private IDictionary _data;
-
                public virtual IDictionary Data {
                        get {
                                if (_data == null) {
@@ -301,20 +308,20 @@ namespace System
 
                internal string GetFullNameForStackTrace (MethodBase mi)
                {
-                       string parms = "";
+                       string parms = String.Empty;
                        ParameterInfo[] p = mi.GetParameters ();
                        for (int i = 0; i < p.Length; ++i) {
                                if (i > 0)
                                        parms = parms + ", ";
-                               string paramName = (p [i].Name == null) ? "" : (" " + p [i].Name);
+                               string paramName = (p [i].Name == null) ? String.Empty : (" " + p [i].Name);
                                Type pt = p[i].ParameterType;
-                               if (pt.IsClass && pt.Namespace != "")
+                               if (pt.IsClass && pt.Namespace != String.Empty)
                                        parms = parms + pt.Namespace + "." + pt.Name + paramName;
                                else
                                        parms = parms + pt.Name + paramName;
                        }
 
-                       string generic = "";
+                       string generic = String.Empty;
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                        if (mi.IsGenericMethod) {
                                Type[] gen_params = mi.GetGenericArguments ();
@@ -328,6 +335,19 @@ namespace System
                        }
 #endif
                        return mi.DeclaringType.ToString () + "." + mi.Name + generic + " (" + parms + ")";
-               }                               
+               }
+
+#if NET_2_0
+               //
+               // The documentation states that this is available in 1.x,
+               // but it was not available (MemberRefing this would fail)
+               // and it states the signature is `override sealed', but the
+               // correct value is `newslot' 
+               //
+               public new Type GetType ()
+               {
+                       return base.GetType ();
+               }
+#endif
        }
 }