title: Start process with Debugger
body: <p>I am developing an extension for Visual Studio.</p>
  <p>I would like a feature of this extension to be the ability to start a process with a debugger attached.</p>
  <p>So far I can get the debugger to attach using code:</p>
  <pre class="lang-cs prettyprint-override"><code>System.Diagnostics.Debugger.Launch();
  
  DTE dte = ServiceProvider.GetServiceAsync(typeof(DTE)).Result as DTE;
  
  var startInfo = new ProcessStartInfo()
  {
      FileName = &quot;PATH_TO_DOT_NET_EXECUTABLE&quot;
  };
  var process = System.Diagnostics.Process.Start(startInfo);
  
  foreach (EnvDTE.Process proc in dte.Debugger.LocalProcesses)
  {
      if (proc.ProcessID == process.Id)
      {
          proc.Attach();
          return;
      }
  
  }
  </code></pre>
  <p>Sometimes however, the process finishes before the debugger can attach.</p>
  <p>Is there a way to create the process from within the Visual Studio Extension in such a way that the debugger is attached upon creation?</p>