title: Getting a pid of a process created in C#
body: <p>Lets say that I'm trying to create a new process with the following code:</p>
  
  <pre><code>System.Diagnostics.Process p = new System.Diagnostics.Process();
  p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
  p.StartInfo.FileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\AwesomeFile.exe";
  p.StartInfo.Arguments = "parameter1 parameter2";
  p.StartInfo.CreateNoWindow = true;
  p.Start();
  </code></pre>
  
  <p>and right in the next line, I'll try to get a pid of that process with the following line:</p>
  
  <pre><code>MessageBox.Show(p.Id);
  </code></pre>
  
  <p>This line is giving me the "No process is associated with this object." error. Any idea as to why this error occurs?</p>