5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
10 using System.Runtime.Serialization;
11 using System.Reflection;
16 public class Exception : ISerializable {
17 Exception inner_exception;
21 string stack_trace = "TODO: implement stack traces";
23 private string source;
27 inner_exception = null;
31 public Exception (string msg)
33 inner_exception = null;
37 protected Exception (SerializationInfo info, StreamingContext sc)
40 throw new ArgumentNullException ("info");
42 class_name = info.GetString ("ClassName");
43 message = info.GetString ("Message");
44 inner_exception = (Exception) info.GetValue ("InnerException", typeof (Exception));
45 help_link = info.GetString ("HelpURL");
46 stack_trace = info.GetString ("StackTraceString");
47 hresult = info.GetInt32 ("HResult");
50 public Exception (string msg, Exception e)
56 public Exception InnerException {
58 return inner_exception;
62 public string HelpLink {
72 protected int HResult {
82 public string Message {
89 public string Source {
91 // TODO: if source is null, we must return
92 // the name of the assembly where the error
102 public string StackTrace {
109 public MethodBase TargetSite {
111 // TODO: Implement this.
116 public virtual Exception GetBaseException ()
118 Exception inner = inner_exception;
120 while (inner != null){
121 if (inner.InnerException != null)
122 inner = inner.InnerException;
131 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
133 // TODO: implement me.
136 public override string ToString ()
138 return this.GetType ().FullName + "\n" +
140 GetBaseException ().GetType ().FullName +