Forum Discussion
Marsha_R
Champion Level 3
7 years agoAre you sure that it's actually released after the first time through? It may take more time to clear than the code is allowing.
anna_gl
7 years agoOccasional Contributor
Actually I'm wondering about is my TE process really killed when I released the com object.
Even in my code, after releasing code I double check that is TE process still live by the code.
public void ForceQuit()
{
Process[] currentProcess = Process.GetProcessesByName("TestExecute");
if (currentProcess.Any(x => x.ProcessName == "TestExecute"))
{
try
{
Process.Start("taskkill", "/F /IM TestExecute.exe");
currentProcess = Process.GetProcessesByName("TestExecute");
while (currentProcess.Any(x => x.ProcessName == "TestExecute"))
{
currentProcess = Process.GetProcessesByName("TestExecute");
//Application.DoEvents();
}
}
catch (Exception ex)
{
Console.WriteLine("Exception : {0}", ex.Message);
}
}
}
As you mentioned above, it may take more time to clear than the code is allowing, but by this code, it still has the problem.
Are there more processes do I have to wait to be killed except that TestExecute process?