title: System.Windows.Forms.SendKeys.SendWait("{ENTER}") Causing error while running
body: <p>I am trying run Run a WPF app as both UI and from command line. In command line mode, i am printing some text on console and later i am coming out of console control using the sendKeys as given below</p>
  
  <pre><code>Console.WriteLine("Printing Something here");
  
  System.Windows.Forms.SendKeys.SendWait("{ENTER}");
  
  FreeConsole();
  </code></pre>
  
  <p>but the line with SendKeys throws error while running.
  In command line mode the application crashes.
  however while debugging on visual studio i have seen the below message on a message box</p>
  
  <blockquote>
    <p>Changes are not allowed while code is running</p>
  </blockquote>
  
  <p>Please provide any hint on this, why is this throwing error. so that i can make necessary changes.</p>
  
  <p>Thanks in Advance
  Sagar </p>