3063b06aed614150203337276bab3c04169751b2
[mono.git] / mcs / class / referencesource / mscorlib / system / threading / threadabortexception.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 //
7 // <OWNER>[....]</OWNER>
8 /*=============================================================================
9 **
10 ** Class: ThreadAbortException
11 **
12 **
13 ** Purpose: An exception class which is thrown into a thread to cause it to
14 **          abort. This is a special non-catchable exception and results in
15 **            the thread's death.  This is thrown by the VM only and can NOT be
16 **          thrown by any user thread, and subclassing this is useless.
17 **
18 **
19 =============================================================================*/
20
21 namespace System.Threading 
22 {
23     using System;
24     using System.Runtime.Serialization;
25     using System.Runtime.CompilerServices;
26
27     [System.Runtime.InteropServices.ComVisible(true)]
28     [Serializable]
29     public sealed class ThreadAbortException : SystemException 
30     {
31         private ThreadAbortException() 
32             : base(GetMessageFromNativeResources(ExceptionMessageKind.ThreadAbort))
33         {
34             SetErrorCode(__HResults.COR_E_THREADABORTED);
35         }
36
37         //required for serialization
38         internal ThreadAbortException(SerializationInfo info, StreamingContext context) 
39             : base(info, context) 
40         {
41         }
42
43         public Object ExceptionState 
44         {
45             [System.Security.SecuritySafeCritical]  // auto-generated
46             get {return Thread.CurrentThread.AbortReason;}
47         }
48     }
49 }