Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1082843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:21:24+00:00 2026-05-16T22:21:24+00:00

I am initializing a thread as static thread as shown below Thread GenerateKeywords; private

  • 0

I am initializing a thread as static thread as shown below

Thread GenerateKeywords;
private void btnStart_Click(object sender, EventArgs e)
{

    //Initializes the Test Thread           
    Test = new Thread(TestMethod);

    //Sets the apartment state to Static
    Test.SetApartmentState(ApartmentState.STA);

    //Starts the GenerateKeywords Thread           
    Test.Start();
}

but when I am aborting this thread via this method

private void btnStop_Click(object sender, EventArgs e)
{

 if (Test != null)
         Test .Abort();
}

It is giving following exception :
”
A first chance exception of type ‘System.Threading.ThreadAbortException’ occurred in mscorlib.dll
The thread 0x13dc has exited with code 0 (0x0).
“

How to get rid of this exception??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:21:24+00:00Added an answer on May 16, 2026 at 10:21 pm

    The ThreadAbort Exception should not be a problem. An unhandled ThreadAbortException is one of only two types of exception that does not cause application shutdown (the other is AppDomainUnloadException).

    wrap it in a try catch and handle exception of type ThreadAbort and set Thread.ResetAbort = true;

    Check this link for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When initializing a new Date object in JavaScript using the below call, I found
I'm trying to do something along these lines: private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
Possible Duplicate: Initializing private static members Why I can't initialize non-const static member or
I can't figure this out. After initializing a Canvas with new Canvas(), referencing it
I want to halt one thread till another thread has finished initializing without using
Is SecureRandom thread safe? That is, after initializing it, can access to the next
Let's say I have some Java code: public class SomeClass { static { private
A static variables can be initialized with the private static methods or with a
I have a thread called mainloop i.e. int run_mainloop; void* mainloop(void* param) { //
I want to test if a ThreadLocal has been initialized without actually initializing it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.