Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V3082. The 'Thread' object is...
menu mobile close menu
Additional information
toggle menu Contents

V3082. The 'Thread' object is created but is not started. It is possible that a call to 'Start' method is missing.

Mar 11 2016

The analyzer detected a suspicious code fragment where an object of type 'Thread' is created but the new thread is not started.

Consider the following example:

void Foo(ThreadStart action)
{
  Thread thread = new Thread(action); 
  thread.Name = "My Thread";
}

In this code, an object of type 'Thread' is created, and the reference to it is written into the 'thread' variable. However, the thread itself is not started or passed anywhere. Therefore, the created object, which will not have been used in any way, will simply be erased the next time garbage collection occurs.

To fix this error, we need to call the object's 'Start' method, which will start the thread. The fixed code should look something like this:

void Foo(ThreadStart action)
{
  Thread thread = new Thread(action); 
  thread.Name = "My Thread";
  thread.Start();
}

This diagnostic is classified as:

close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
close form
Free PVS‑Studio license for Microsoft MVP specialists
close form
To get the licence for your open-source project, please fill out this form
close form
I want to join the test
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam