I'm using external exe file in my C# code. please check below code. This code I just find some web site.
string str = @"C:\joseph_Test\external_vendor.exe";
Process myprocess = new Process();
myprocess.StartInfo.FileName = str;
myprocess.Start();
I checked this code is working, and no problem, but next test I need to use another different type of external exe file. and I aware that previous 'myprocess' is still alive. even I restart program, myprocess is still alive. So I search internet that how to kill or terminate existing process. weird thing is that myprocess never terminated.
First, I tried the code below but the process is still alive.
myprocess.WaitForExit();
myprocess.Close();
I used the link below, but it is still not killed.
Also not terminated with below way.
Kill some processes by .exe file name
I suspect this exe file made by vendor so this happen caused. But the theory is C# create process instance so I believe C# could terminate or kill this process.