You need to call ResetAbort in the aborted thread. From the docs:

<snip>
This method can only be called by code with the proper permissions. For
more information see Security Demands.

When a call is made to Abort to terminate a thread, the system throws a
ThreadAbortException. ThreadAbortException is a special exception that
can be caught by application code, but is rethrown at the end of the
catch block unless ResetAbort is called. ResetAbort cancels the request
to abort, and prevents the ThreadAbortException from terminating the
thread.
</snip>

-bc

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of John
Sent: Friday, May 30, 2003 7:54 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] ThreadAbortException Bug


Hi,

I keep on getting this inconsistent error os "Unhandled Exception", when
I try to abort a thread.

Is there a bug in the ThreadAbortException?  Are there any workarounds?
I use the Thread.Abort() and Thread.Join().

John

Reply via email to