title: Application exits on process exited event
body: <p>I am making form application, that also runs a console process on different thread. Basically I need to unblock a button after application has exited. Before I made event handler the process after completion just stopped, but now, after event the applications itself is killed.</p>
  
  <p>Here is the code for making process run:</p>
  
  <pre><code>public void CallConsole()//This Calls the console application
  {
      Thread.CurrentThread.IsBackground = true;
      Process p = new Process();
      p.StartInfo.UseShellExecute = false;
      p.StartInfo.RedirectStandardOutput = true;
      p.StartInfo.RedirectStandardError = true;
      p.StartInfo.FileName = filename;
      if (checkBox1.Checked)
         p.StartInfo.CreateNoWindow = true;
      p.EnableRaisingEvents = true;
      p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
      p.ErrorDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
      p.Exited += new EventHandler(p_Exited);
      p.Disposed += new EventHandler(p_Exited);
      p.Start();
      p.BeginErrorReadLine();
      p.BeginOutputReadLine();
  }
  </code></pre>
  
  <p>I tried to work with Thread.IsBackground property, but that didn't change anything</p>
  
  <p>Here's the event handler itself:</p>
  
  <pre><code>void p_Exited(object sender, EventArgs e)//Process on exit or disposed will make button1 avalable
  {
      button1.Enabled = true;
  }
  </code></pre>
  
  <p>Any ideas why the application after adding </p>
  
  <pre><code>p.EnableRaisingEvents = true;
  </code></pre>
  
  <p>is now killed, not just the process?</p>