mscorlib(4.0.0.0) API with additions
Exception.cs
1 using System.Collections;
2 using System.Diagnostics;
4 using System.Reflection;
10 using System.Security;
12 using System.Text;
13 
14 namespace System
15 {
17  [Serializable]
18  [ClassInterface(ClassInterfaceType.None)]
19  [ComDefaultInterface(typeof(_Exception))]
20  [ComVisible(true)]
21  [__DynamicallyInvokable]
23  {
24  [Serializable]
25  internal class __RestrictedErrorObject
26  {
27  [NonSerialized]
28  private object _realErrorObject;
29 
30  public object RealErrorObject => _realErrorObject;
31 
32  internal __RestrictedErrorObject(object errorObject)
33  {
34  _realErrorObject = errorObject;
35  }
36  }
37 
38  internal enum ExceptionMessageKind
39  {
40  ThreadAbort = 1,
41  ThreadInterrupted,
42  OutOfMemory
43  }
44 
45  [OptionalField]
46  private static object s_EDILock = new object();
47 
48  private string _className;
49 
50  private MethodBase _exceptionMethod;
51 
52  private string _exceptionMethodString;
53 
54  internal string _message;
55 
56  private IDictionary _data;
57 
58  private Exception _innerException;
59 
60  private string _helpURL;
61 
62  private object _stackTrace;
63 
64  [OptionalField]
65  private object _watsonBuckets;
66 
67  private string _stackTraceString;
68 
69  private string _remoteStackTraceString;
70 
71  private int _remoteStackIndex;
72 
73  private object _dynamicMethods;
74 
75  internal int _HResult;
76 
77  private string _source;
78 
79  private IntPtr _xptrs;
80 
81  private int _xcode;
82 
83  [OptionalField]
84  private UIntPtr _ipForWatsonBuckets;
85 
86  [OptionalField(VersionAdded = 4)]
87  private SafeSerializationManager _safeSerializationManager;
88 
89  private const int _COMPlusExceptionCode = -532462766;
90 
93  [__DynamicallyInvokable]
94  public virtual string Message
95  {
96  [__DynamicallyInvokable]
97  get
98  {
99  if (_message == null)
100  {
101  if (_className == null)
102  {
103  _className = GetClassName();
104  }
105  return Environment.GetResourceString("Exception_WasThrown", _className);
106  }
107  return _message;
108  }
109  }
110 
113  [__DynamicallyInvokable]
114  public virtual IDictionary Data
115  {
116  [SecuritySafeCritical]
117  [__DynamicallyInvokable]
118  get
119  {
120  if (_data == null)
121  {
122  if (IsImmutableAgileException(this))
123  {
124  _data = new EmptyReadOnlyDictionaryInternal();
125  }
126  else
127  {
128  _data = new ListDictionaryInternal();
129  }
130  }
131  return _data;
132  }
133  }
134 
137  [__DynamicallyInvokable]
139  {
140  [__DynamicallyInvokable]
141  get
142  {
143  return _innerException;
144  }
145  }
146 
149  public MethodBase TargetSite
150  {
151  [SecuritySafeCritical]
152  get
153  {
154  return GetTargetSiteInternal();
155  }
156  }
157 
160  [__DynamicallyInvokable]
161  public virtual string StackTrace
162  {
163  [__DynamicallyInvokable]
164  get
165  {
166  return GetStackTrace(needFileInfo: true);
167  }
168  }
169 
172  [__DynamicallyInvokable]
173  public virtual string HelpLink
174  {
175  [__DynamicallyInvokable]
176  get
177  {
178  return _helpURL;
179  }
180  [__DynamicallyInvokable]
181  set
182  {
183  _helpURL = value;
184  }
185  }
186 
190  [__DynamicallyInvokable]
191  public virtual string Source
192  {
193  [__DynamicallyInvokable]
194  get
195  {
196  if (_source == null)
197  {
198  StackTrace stackTrace = new StackTrace(this, fNeedFileInfo: true);
199  if (stackTrace.FrameCount > 0)
200  {
201  StackFrame frame = stackTrace.GetFrame(0);
202  MethodBase method = frame.GetMethod();
203  Module module = method.Module;
204  RuntimeModule runtimeModule = module as RuntimeModule;
205  if (runtimeModule == null)
206  {
207  ModuleBuilder moduleBuilder = module as ModuleBuilder;
208  if (!(moduleBuilder != null))
209  {
210  throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject"));
211  }
212  runtimeModule = moduleBuilder.InternalModule;
213  }
214  _source = runtimeModule.GetRuntimeAssembly().GetSimpleName();
215  }
216  }
217  return _source;
218  }
219  [__DynamicallyInvokable]
220  set
221  {
222  _source = value;
223  }
224  }
225 
226  internal UIntPtr IPForWatsonBuckets => _ipForWatsonBuckets;
227 
228  internal object WatsonBuckets => _watsonBuckets;
229 
230  internal string RemoteStackTrace => _remoteStackTraceString;
231 
234  [__DynamicallyInvokable]
235  public int HResult
236  {
237  [__DynamicallyInvokable]
238  get
239  {
240  return _HResult;
241  }
242  [__DynamicallyInvokable]
243  protected set
244  {
245  _HResult = value;
246  }
247  }
248 
249  internal bool IsTransient
250  {
251  [SecuritySafeCritical]
252  get
253  {
254  return nIsTransient(_HResult);
255  }
256  }
257 
259  protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
260  {
261  add
262  {
263  _safeSerializationManager.SerializeObjectState += value;
264  }
265  remove
266  {
267  _safeSerializationManager.SerializeObjectState -= value;
268  }
269  }
270 
271  private void Init()
272  {
273  _message = null;
274  _stackTrace = null;
275  _dynamicMethods = null;
276  HResult = -2146233088;
277  _xcode = -532462766;
278  _xptrs = (IntPtr)0;
279  _watsonBuckets = null;
280  _ipForWatsonBuckets = UIntPtr.Zero;
281  _safeSerializationManager = new SafeSerializationManager();
282  }
283 
285  [__DynamicallyInvokable]
286  public Exception()
287  {
288  Init();
289  }
290 
293  [__DynamicallyInvokable]
294  public Exception(string message)
295  {
296  Init();
297  _message = message;
298  }
299 
303  [__DynamicallyInvokable]
304  public Exception(string message, Exception innerException)
305  {
306  Init();
307  _message = message;
308  _innerException = innerException;
309  }
310 
316  [SecuritySafeCritical]
318  {
319  if (info == null)
320  {
321  throw new ArgumentNullException("info");
322  }
323  _className = info.GetString("ClassName");
324  _message = info.GetString("Message");
325  _data = (IDictionary)info.GetValueNoThrow("Data", typeof(IDictionary));
326  _innerException = (Exception)info.GetValue("InnerException", typeof(Exception));
327  _helpURL = info.GetString("HelpURL");
328  _stackTraceString = info.GetString("StackTraceString");
329  _remoteStackTraceString = info.GetString("RemoteStackTraceString");
330  _remoteStackIndex = info.GetInt32("RemoteStackIndex");
331  _exceptionMethodString = (string)info.GetValue("ExceptionMethod", typeof(string));
332  HResult = info.GetInt32("HResult");
333  _source = info.GetString("Source");
334  _watsonBuckets = info.GetValueNoThrow("WatsonBuckets", typeof(byte[]));
335  _safeSerializationManager = (info.GetValueNoThrow("SafeSerializationManager", typeof(SafeSerializationManager)) as SafeSerializationManager);
336  if (_className == null || HResult == 0)
337  {
338  throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
339  }
340  if (context.State == StreamingContextStates.CrossAppDomain)
341  {
342  _remoteStackTraceString += _stackTraceString;
343  _stackTraceString = null;
344  }
345  }
346 
347  [MethodImpl(MethodImplOptions.InternalCall)]
348  [SecurityCritical]
349  private static extern bool IsImmutableAgileException(Exception e);
350 
351  [FriendAccessAllowed]
352  internal void AddExceptionDataForRestrictedErrorInfo(string restrictedError, string restrictedErrorReference, string restrictedCapabilitySid, object restrictedErrorObject, bool hasrestrictedLanguageErrorObject = false)
353  {
354  IDictionary data = Data;
355  if (data != null)
356  {
357  data.Add("RestrictedDescription", restrictedError);
358  data.Add("RestrictedErrorReference", restrictedErrorReference);
359  data.Add("RestrictedCapabilitySid", restrictedCapabilitySid);
360  data.Add("__RestrictedErrorObject", (restrictedErrorObject == null) ? null : new __RestrictedErrorObject(restrictedErrorObject));
361  data.Add("__HasRestrictedLanguageErrorObject", hasrestrictedLanguageErrorObject);
362  }
363  }
364 
365  internal bool TryGetRestrictedLanguageErrorObject(out object restrictedErrorObject)
366  {
367  restrictedErrorObject = null;
368  if (Data != null && Data.Contains("__HasRestrictedLanguageErrorObject"))
369  {
370  if (Data.Contains("__RestrictedErrorObject"))
371  {
372  __RestrictedErrorObject _RestrictedErrorObject = Data["__RestrictedErrorObject"] as __RestrictedErrorObject;
373  if (_RestrictedErrorObject != null)
374  {
375  restrictedErrorObject = _RestrictedErrorObject.RealErrorObject;
376  }
377  }
378  return (bool)Data["__HasRestrictedLanguageErrorObject"];
379  }
380  return false;
381  }
382 
383  private string GetClassName()
384  {
385  if (_className == null)
386  {
387  _className = GetType().ToString();
388  }
389  return _className;
390  }
391 
394  [__DynamicallyInvokable]
395  public virtual Exception GetBaseException()
396  {
397  Exception innerException = InnerException;
398  Exception result = this;
399  while (innerException != null)
400  {
401  result = innerException;
402  innerException = innerException.InnerException;
403  }
404  return result;
405  }
406 
407  [MethodImpl(MethodImplOptions.InternalCall)]
408  [SecurityCritical]
409  private static extern IRuntimeMethodInfo GetMethodFromStackTrace(object stackTrace);
410 
411  [SecuritySafeCritical]
412  private MethodBase GetExceptionMethodFromStackTrace()
413  {
414  IRuntimeMethodInfo methodFromStackTrace = GetMethodFromStackTrace(_stackTrace);
415  if (methodFromStackTrace == null)
416  {
417  return null;
418  }
419  return RuntimeType.GetMethodBase(methodFromStackTrace);
420  }
421 
422  [SecurityCritical]
423  private MethodBase GetTargetSiteInternal()
424  {
425  if (_exceptionMethod != null)
426  {
427  return _exceptionMethod;
428  }
429  if (_stackTrace == null)
430  {
431  return null;
432  }
433  if (_exceptionMethodString != null)
434  {
435  _exceptionMethod = GetExceptionMethodFromString();
436  }
437  else
438  {
439  _exceptionMethod = GetExceptionMethodFromStackTrace();
440  }
441  return _exceptionMethod;
442  }
443 
444  private string GetStackTrace(bool needFileInfo)
445  {
446  string text = _stackTraceString;
447  string text2 = _remoteStackTraceString;
448  if (!needFileInfo)
449  {
450  text = StripFileInfo(text, isRemoteStackTrace: false);
451  text2 = StripFileInfo(text2, isRemoteStackTrace: true);
452  }
453  if (text != null)
454  {
455  return text2 + text;
456  }
457  if (_stackTrace == null)
458  {
459  return text2;
460  }
461  string stackTrace = Environment.GetStackTrace(this, needFileInfo);
462  return text2 + stackTrace;
463  }
464 
465  [FriendAccessAllowed]
466  internal void SetErrorCode(int hr)
467  {
468  HResult = hr;
469  }
470 
473  [__DynamicallyInvokable]
474  public override string ToString()
475  {
476  return ToString(needFileLineInfo: true, needMessage: true);
477  }
478 
479  private string ToString(bool needFileLineInfo, bool needMessage)
480  {
481  string text = needMessage ? Message : null;
482  string text2 = (text != null && text.Length > 0) ? (GetClassName() + ": " + text) : GetClassName();
483  if (_innerException != null)
484  {
485  text2 = text2 + " ---> " + _innerException.ToString(needFileLineInfo, needMessage) + Environment.NewLine + " " + Environment.GetResourceString("Exception_EndOfInnerExceptionStack");
486  }
487  string stackTrace = GetStackTrace(needFileLineInfo);
488  if (stackTrace != null)
489  {
490  text2 = text2 + Environment.NewLine + stackTrace;
491  }
492  return text2;
493  }
494 
495  [SecurityCritical]
496  private string GetExceptionMethodString()
497  {
498  MethodBase targetSiteInternal = GetTargetSiteInternal();
499  if (targetSiteInternal == null)
500  {
501  return null;
502  }
503  if (targetSiteInternal is DynamicMethod.RTDynamicMethod)
504  {
505  return null;
506  }
507  char value = '\n';
508  StringBuilder stringBuilder = new StringBuilder();
509  if (targetSiteInternal is ConstructorInfo)
510  {
511  RuntimeConstructorInfo runtimeConstructorInfo = (RuntimeConstructorInfo)targetSiteInternal;
512  Type reflectedType = runtimeConstructorInfo.ReflectedType;
513  stringBuilder.Append(1);
514  stringBuilder.Append(value);
515  stringBuilder.Append(runtimeConstructorInfo.Name);
516  if (reflectedType != null)
517  {
518  stringBuilder.Append(value);
519  stringBuilder.Append(reflectedType.Assembly.FullName);
520  stringBuilder.Append(value);
521  stringBuilder.Append(reflectedType.FullName);
522  }
523  stringBuilder.Append(value);
524  stringBuilder.Append(runtimeConstructorInfo.ToString());
525  }
526  else
527  {
528  RuntimeMethodInfo runtimeMethodInfo = (RuntimeMethodInfo)targetSiteInternal;
529  Type declaringType = runtimeMethodInfo.DeclaringType;
530  stringBuilder.Append(8);
531  stringBuilder.Append(value);
532  stringBuilder.Append(runtimeMethodInfo.Name);
533  stringBuilder.Append(value);
534  stringBuilder.Append(runtimeMethodInfo.Module.Assembly.FullName);
535  stringBuilder.Append(value);
536  if (declaringType != null)
537  {
538  stringBuilder.Append(declaringType.FullName);
539  stringBuilder.Append(value);
540  }
541  stringBuilder.Append(runtimeMethodInfo.ToString());
542  }
543  return stringBuilder.ToString();
544  }
545 
546  [SecurityCritical]
547  private MethodBase GetExceptionMethodFromString()
548  {
549  string[] array = _exceptionMethodString.Split('\0', '\n');
550  if (array.Length != 5)
551  {
552  throw new SerializationException();
553  }
554  SerializationInfo serializationInfo = new SerializationInfo(typeof(MemberInfoSerializationHolder), new FormatterConverter());
555  serializationInfo.AddValue("MemberType", int.Parse(array[0], CultureInfo.InvariantCulture), typeof(int));
556  serializationInfo.AddValue("Name", array[1], typeof(string));
557  serializationInfo.AddValue("AssemblyName", array[2], typeof(string));
558  serializationInfo.AddValue("ClassName", array[3]);
559  serializationInfo.AddValue("Signature", array[4]);
561  try
562  {
563  return (MethodBase)new MemberInfoSerializationHolder(serializationInfo, context).GetRealObject(context);
564  }
565  catch (SerializationException)
566  {
567  return null;
568  }
569  }
570 
575  [SecurityCritical]
576  public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
577  {
578  if (info == null)
579  {
580  throw new ArgumentNullException("info");
581  }
582  string text = _stackTraceString;
583  if (_stackTrace != null)
584  {
585  if (text == null)
586  {
587  text = Environment.GetStackTrace(this, needFileInfo: true);
588  }
589  if (_exceptionMethod == null)
590  {
591  _exceptionMethod = GetExceptionMethodFromStackTrace();
592  }
593  }
594  if (_source == null)
595  {
596  _source = Source;
597  }
598  info.AddValue("ClassName", GetClassName(), typeof(string));
599  info.AddValue("Message", _message, typeof(string));
600  info.AddValue("Data", _data, typeof(IDictionary));
601  info.AddValue("InnerException", _innerException, typeof(Exception));
602  info.AddValue("HelpURL", _helpURL, typeof(string));
603  info.AddValue("StackTraceString", text, typeof(string));
604  info.AddValue("RemoteStackTraceString", _remoteStackTraceString, typeof(string));
605  info.AddValue("RemoteStackIndex", _remoteStackIndex, typeof(int));
606  info.AddValue("ExceptionMethod", GetExceptionMethodString(), typeof(string));
607  info.AddValue("HResult", HResult);
608  info.AddValue("Source", _source, typeof(string));
609  info.AddValue("WatsonBuckets", _watsonBuckets, typeof(byte[]));
610  if (_safeSerializationManager != null && _safeSerializationManager.IsActive)
611  {
612  info.AddValue("SafeSerializationManager", _safeSerializationManager, typeof(SafeSerializationManager));
613  _safeSerializationManager.CompleteSerialization(this, info, context);
614  }
615  }
616 
617  internal Exception PrepForRemoting()
618  {
619  string text = null;
620  text = (_remoteStackTraceString = ((_remoteStackIndex != 0) ? (StackTrace + Environment.NewLine + Environment.NewLine + "Exception rethrown at [" + _remoteStackIndex + "]: " + Environment.NewLine) : (Environment.NewLine + "Server stack trace: " + Environment.NewLine + StackTrace + Environment.NewLine + Environment.NewLine + "Exception rethrown at [" + _remoteStackIndex + "]: " + Environment.NewLine)));
621  _remoteStackIndex++;
622  return this;
623  }
624 
625  [OnDeserialized]
626  private void OnDeserialized(StreamingContext context)
627  {
628  _stackTrace = null;
629  _ipForWatsonBuckets = UIntPtr.Zero;
630  if (_safeSerializationManager == null)
631  {
632  _safeSerializationManager = new SafeSerializationManager();
633  }
634  else
635  {
636  _safeSerializationManager.CompleteDeserialization(this);
637  }
638  }
639 
640  internal void InternalPreserveStackTrace()
641  {
642  string stackTrace;
643  if (AppDomain.IsAppXModel())
644  {
645  stackTrace = GetStackTrace(needFileInfo: true);
646  string source = Source;
647  }
648  else
649  {
650  stackTrace = StackTrace;
651  }
652  if (stackTrace != null && stackTrace.Length > 0)
653  {
654  _remoteStackTraceString = stackTrace + Environment.NewLine;
655  }
656  _stackTrace = null;
657  _stackTraceString = null;
658  }
659 
660  [MethodImpl(MethodImplOptions.InternalCall)]
661  [SecurityCritical]
662  private static extern void PrepareForForeignExceptionRaise();
663 
664  [MethodImpl(MethodImplOptions.InternalCall)]
665  [SecurityCritical]
666  private static extern void GetStackTracesDeepCopy(Exception exception, out object currentStackTrace, out object dynamicMethodArray);
667 
668  [MethodImpl(MethodImplOptions.InternalCall)]
669  [SecurityCritical]
670  internal static extern void SaveStackTracesFromDeepCopy(Exception exception, object currentStackTrace, object dynamicMethodArray);
671 
672  [MethodImpl(MethodImplOptions.InternalCall)]
673  [SecurityCritical]
674  private static extern object CopyStackTrace(object currentStackTrace);
675 
676  [MethodImpl(MethodImplOptions.InternalCall)]
677  [SecurityCritical]
678  private static extern object CopyDynamicMethods(object currentDynamicMethods);
679 
680  [MethodImpl(MethodImplOptions.InternalCall)]
681  [SecuritySafeCritical]
682  private extern string StripFileInfo(string stackTrace, bool isRemoteStackTrace);
683 
684  [SecuritySafeCritical]
685  internal object DeepCopyStackTrace(object currentStackTrace)
686  {
687  if (currentStackTrace != null)
688  {
689  return CopyStackTrace(currentStackTrace);
690  }
691  return null;
692  }
693 
694  [SecuritySafeCritical]
695  internal object DeepCopyDynamicMethods(object currentDynamicMethods)
696  {
697  if (currentDynamicMethods != null)
698  {
699  return CopyDynamicMethods(currentDynamicMethods);
700  }
701  return null;
702  }
703 
704  [SecuritySafeCritical]
705  internal void GetStackTracesDeepCopy(out object currentStackTrace, out object dynamicMethodArray)
706  {
707  GetStackTracesDeepCopy(this, out currentStackTrace, out dynamicMethodArray);
708  }
709 
710  [SecuritySafeCritical]
711  internal void RestoreExceptionDispatchInfo(ExceptionDispatchInfo exceptionDispatchInfo)
712  {
713  if (!IsImmutableAgileException(this))
714  {
715  try
716  {
717  }
718  finally
719  {
720  object currentStackTrace = (exceptionDispatchInfo.BinaryStackTraceArray == null) ? null : DeepCopyStackTrace(exceptionDispatchInfo.BinaryStackTraceArray);
721  object dynamicMethodArray = (exceptionDispatchInfo.DynamicMethodArray == null) ? null : DeepCopyDynamicMethods(exceptionDispatchInfo.DynamicMethodArray);
722  lock (s_EDILock)
723  {
724  _watsonBuckets = exceptionDispatchInfo.WatsonBuckets;
725  _ipForWatsonBuckets = exceptionDispatchInfo.IPForWatsonBuckets;
726  _remoteStackTraceString = exceptionDispatchInfo.RemoteStackTrace;
727  SaveStackTracesFromDeepCopy(this, currentStackTrace, dynamicMethodArray);
728  }
729  _stackTraceString = null;
730  PrepareForForeignExceptionRaise();
731  }
732  }
733  }
734 
735  [SecurityCritical]
736  internal virtual string InternalToString()
737  {
738  try
739  {
740  SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy);
741  securityPermission.Assert();
742  }
743  catch
744  {
745  }
746  bool needFileLineInfo = true;
747  return ToString(needFileLineInfo, needMessage: true);
748  }
749 
752  [__DynamicallyInvokable]
753  public new Type GetType()
754  {
755  return base.GetType();
756  }
757 
758  [MethodImpl(MethodImplOptions.InternalCall)]
759  [SecurityCritical]
760  private static extern bool nIsTransient(int hr);
761 
762  [SecuritySafeCritical]
763  internal static string GetMessageFromNativeResources(ExceptionMessageKind kind)
764  {
765  string s = null;
766  GetMessageFromNativeResources(kind, JitHelpers.GetStringHandleOnStack(ref s));
767  return s;
768  }
769 
770  [DllImport("QCall", CharSet = CharSet.Unicode)]
771  [SecurityCritical]
772  [SuppressUnmanagedCodeSecurity]
773  private static extern void GetMessageFromNativeResources(ExceptionMessageKind kind, StringHandleOnStack retMesg);
774  }
775 }
override string ToString()
Creates and returns a string representation of the current exception.
Definition: Exception.cs:474
A platform-specific type that is used to represent a pointer or a handle.
Definition: UIntPtr.cs:14
Performs reflection on a module.
Definition: Module.cs:17
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
Exception(string message)
Initializes a new instance of the T:System.Exception class with a specified error message.
Definition: Exception.cs:294
static string NewLine
Gets the newline string defined for this environment.
Definition: Environment.cs:449
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
Defines and represents a dynamic method that can be compiled, executed, and discarded....
StreamingContextStates State
Gets the source or destination of the transmitted data.
bool Contains(object key)
Determines whether the T:System.Collections.IDictionary object contains an element with the specified...
virtual void GetObjectData(SerializationInfo info, StreamingContext context)
When overridden in a derived class, sets the T:System.Runtime.Serialization.SerializationInfo with in...
Definition: Exception.cs:576
MethodBase TargetSite
Gets the method that throws the current exception.
Definition: Exception.cs:150
Discovers the attributes of a class constructor and provides access to constructor metadata.
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition: StackTrace.cs:16
EventHandler< SafeSerializationEventArgs > SerializeObjectState
Occurs when an exception is serialized to create an exception state object that contains serialized d...
Definition: Exception.cs:260
virtual int FrameCount
Gets the number of frames in the stack trace.
Definition: StackTrace.cs:36
Definition: __Canon.cs:3
new Type GetType()
Gets the runtime type of the current instance.
Definition: Exception.cs:753
override string ToString()
Returns a String representing the name of the current Type.
Definition: Type.cs:2788
virtual string Source
Gets or sets the name of the application or the object that causes the error.
Definition: Exception.cs:192
virtual string HelpLink
Gets or sets a link to the help file associated with this exception.
Definition: Exception.cs:174
Describes the source and destination of a given serialized stream, and provides an additional caller-...
Represents an exception whose state is captured at a certain point in code.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
void AddValue(string name, object value, Type type)
Adds a value into the T:System.Runtime.Serialization.SerializationInfo store, where value is associa...
int HResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
Definition: Exception.cs:236
Exception(string message, Exception innerException)
Initializes a new instance of the T:System.Exception class with a specified error message and a refer...
Definition: Exception.cs:304
Defines and represents a module in a dynamic assembly.
virtual string StackTrace
Gets a string representation of the immediate frames on the call stack.
Definition: Exception.cs:162
Exception InnerException
Gets the T:System.Exception instance that caused the current exception.
Definition: Exception.cs:139
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
virtual MethodBase GetMethod()
Gets the method in which the frame is executing.
Definition: StackFrame.cs:151
Provides information about methods and constructors.
Definition: MethodBase.cs:19
The exception thrown when an error occurs during serialization or deserialization.
MethodImplOptions
Defines the details of how a method is implemented.
CharSet
Dictates which character set marshaled strings should use.
Definition: CharSet.cs:7
virtual string Message
Gets a message that describes the current exception.
Definition: Exception.cs:95
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
Exception()
Initializes a new instance of the T:System.Exception class.
Definition: Exception.cs:286
Represents a base implementation of the T:System.Runtime.Serialization.IFormatterConverter interface ...
Used for parsing DTDs.
The exception that is thrown when one of the arguments provided to a method is not valid.
Allows an object to control its own serialization and deserialization.
Definition: ISerializable.cs:8
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Definition: Exception.cs:22
virtual Exception GetBaseException()
When overridden in a derived class, returns the T:System.Exception that is the root cause of one or m...
Definition: Exception.cs:395
virtual Module Module
Gets the module in which the type that declares the member represented by the current T:System....
Definition: MemberInfo.cs:78
Exception(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.Exception class with serialized data.
Definition: Exception.cs:317
Specifies that the class can be serialized.
static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Gets the T:System.Type with the specified name, specifying whether to throw an exception if the type ...
Definition: Type.cs:853
ClassInterfaceType
Identifies the type of class interface that is generated for a class.
Provides information about a T:System.Diagnostics.StackFrame, which represents a function call on the...
Definition: StackFrame.cs:14
void Assert()
Declares that the calling code can access the resource protected by a permission demand through the c...
StreamingContextStates
Defines a set of flags that specifies the source or destination context for the stream during seriali...
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
static readonly UIntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
Definition: UIntPtr.cs:20
SecurityPermissionFlag
Specifies access flags for the security permission object.
Represents a nongeneric collection of key/value pairs.
Definition: IDictionary.cs:8
virtual IDictionary Data
Gets a collection of key/value pairs that provide additional user-defined information about the excep...
Definition: Exception.cs:115
virtual StackFrame GetFrame(int index)
Gets the specified stack frame.
Definition: StackTrace.cs:261
Exposes the public members of the T:System.Exception class to unmanaged code.
Definition: _Exception.cs:12