title: How does Visual Studio's Thread Window Identify the "Main Thread'
body: <p>I am likely missing something obvious, but humor me...</p>
  
  <p>I always like to name the important threads in my apps as it is useful with debugging/logging etc. If you query the main thread's name via <code>Thread.CurrentThread.Name</code> at program startup you will get back <code>null</code>. As such, I always ensure that the first thing that happens is that the main thread (and any other relevent threads) get assigned a nice meaningful name for future reference. </p>
  
  <p>I never really gave it much thought until today, but when looking at the Threads window in Visual Studio (before any thread names are assigned etc), a special category 'Main Thread' is assigned as well as a psuedo name that also reads "Main Thread" (but that isn't the actual thread name).</p>
  
  <p>From a managed perspective, .NET doesn't expose anything meaningful on either <code>System.Threading.Thread</code> or <code>System.Diagnostics.ProcessThread</code> that identifies an application's main thread (at least that I could see). I looked at the list of <a href="http://msdn.microsoft.com/en-us/library/ms684847%28v=VS.85%29.aspx" rel="noreferrer">Windows Process and Thread Functions</a>, and again, I didn't see anything obvious (perhaps OpenThread?).</p>
  
  <p>Curious if anyone knows how the Threads window assigns the special category "Main Thread"? </p>