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 1020785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:12:37+00:00 2026-05-16T11:12:37+00:00

I have veeeeryyy basic singleton in asp.net web application: [ThreadStatic] private static BackgroundProcessManager2 _Instance;

  • 0

I have veeeeryyy basic singleton in asp.net web application:

[ThreadStatic]
private static BackgroundProcessManager2 _Instance;

public static BackgroundProcessManager2 Instance
{
     get 
     {
          if (_Instance == null) // **
          {
               _Instance = new BackgroundProcessManager2();
          }
          return _Instance; 
     }
}

And ussually everything is fine, but this time on every page load _Instance is null.

Additionally, i have very strange error when trying to watch _Instance in line marked **:

Cannot fetch the value of field ‘_Instance’ because information about the containing class is unavailable.

What can couse this class to upload?

  • 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-16T11:12:38+00:00Added an answer on May 16, 2026 at 11:12 am

    ThreadStatic means that the variable is tied to a given managed thread. ASP.NET uses a pool of threads to service user requests. This means that each page might be served from a different thread, so your instance variable is null as each request is serviced from a different thread from the pool but this is random and will depend on many factors.

    Also note that a user request is not necessary tied to a worker thread. For example if you are using asynchronous pages the page could start processing on a given thread and finish on another. That’s one of the reasons why ThreadStatic should be avoided in ASP.NET applications where HttpContext should be preferred as it is always tied to a user request and is thread agnostic.

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

Sidebar

Related Questions

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a n-tire web application and search often times out after 30 secs. How
have the following text file: <div> <asp:HyperLinkField HeaderText=Hello World of Regular Expression /> </div>
I am writing an web application where I need to send an image from
Have a question about calling one prototype function in another prototype function. for instance
Have a look at this JSFiddle: http://jsfiddle.net/kZ3Af/25/ I have the base navigation pinned down
have an issue with a fairly basic query I'm attempting to write. select count
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have done quite a bit of searching for a guide (of any substance) for

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.