I created an application to open the AutoCAD Core Console to write some commands to it. The problem is the idle CPU usage is 100% for a single thread. I have discovered that the RedirectStandardInput property, when set to true does this. When I set it to false, the idle CPU usage is 0.1%. What I need is to be able to write a command to the console and when everything is finished, the idle speed returns to 0.1% CPU usage. Why does this happen, and how do I fix it?
// Set up process
coreprocess.StartInfo.Arguments = "/isolate";
coreprocess.StartInfo.UseShellExecute = false;
coreprocess.StartInfo.CreateNoWindow = true;
coreprocess.StartInfo.RedirectStandardOutput = false;
coreprocess.StartInfo.RedirectStandardError = false;
coreprocess.StartInfo.RedirectStandardInput = true;
coreprocess.StartInfo.FileName = installpath;
// Start Process
this.ConsoleStarted = coreprocess.Start();
I removed the following sections of code and everything works normally.
coreprocess.StandardInput.Close();
coreprocess.StandardInput.Dispose();