Share via


ThreadAbortException Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The exception that is thrown when a call is made to the Abort method. This class cannot be inherited.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .Exception
    System. . :: . .SystemException
      System.Threading..::..ThreadAbortException

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public NotInheritable Class ThreadAbortException _
    Inherits SystemException
[SerializableAttribute]
public sealed class ThreadAbortException : SystemException
[SerializableAttribute]
public ref class ThreadAbortException sealed : public SystemException
[<Sealed>]
[<SerializableAttribute>]
type ThreadAbortException =  
    class
        inherit SystemException
    end
public final class ThreadAbortException extends SystemException

The ThreadAbortException type exposes the following members.

Properties

  Name Description
Public property InnerException Gets the Exception instance that caused the current exception. (Inherited from Exception.)
Public property Message Gets a message that describes the current exception. (Inherited from Exception.)
Public property StackTrace Gets a string representation of the immediate frames on the call stack. (Inherited from Exception.)

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Creates and returns a string representation of the current exception. (Inherited from Exception.)

Top

Remarks

When a call is made to the Abort method to destroy a thread, the common language runtime throws a ThreadAbortException. ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block. When this exception is raised, the runtime executes all the finally blocks before ending the thread. Because the thread can do an unbounded computation in the finally blocks or call Thread.ResetAbort to cancel the abort, there is no guarantee that the thread will ever end. If you want to wait until the aborted thread has ended, you can call the Thread..::..Join method. Join is a blocking call that does not return until the thread actually stops executing.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Threading Namespace