title: Threading in Visual Studio requires Join to work properly
body: <p>This is more of an <em>"I'd like to know"</em> kind of question, than a real problem.</p>
  
  <p>While working on improving my threading skills, and I'm running into the following conundrum.</p>
  
  <p><strong>The source code</strong></p>
  
  <pre><code>internal class Program
  {
      private static void Main(string[] args)
      {
          var thread = new Thread(() =&gt; Print("Hello from t"));
          thread.Start();
          //thread.Join();
      }
  
      private static void Print(string message)
      {
          Console.WriteLine(message);
      }
  }
  </code></pre>
  
  <p><strong>The problem</strong></p>
  
  <p>If I run the application from Visual Studio (regardless of whether it's Debug or Release configuration), the <code>message</code> is never displayed in the Output window <strong>unless</strong> I wait for the thread to exit (using <code>Join</code>).</p>
  
  <p><strong>The solution</strong></p>
  
  <p>Run the compiled executable from a command prompt, and you see the expected output.</p>
  
  <p><strong>My question</strong></p>
  
  <p>I'm gonna throw a wild guess and say that the Visual Studio environment makes all the difference. </p>
  
  <p>What I'm wondering is, if I were working on a real-world application, how would I use Visual Studio to debug said application, without being forced to modify the source code (to use <code>Join</code>)?</p>