title: execute command crashing on start pending status c#
body: <p>I'm writing a button_click function in c#, in which i use the executeCommand to talk to a service.</p>
  
  <pre><code>ServiceController sc = new ServiceController("MyService");
  int command = 145;
  sc.Stop();
  //writing xml file
  sc.Start();
  sc.ExecuteCommand(command);
  </code></pre>
  
  <p>At some point the program is crashing, is not able to call the executecommand because the service is in a start/stop pending status. What do i do?
  I need to stop/start the service because the function has to write the same xml file.</p>