这是我的代码:
[STAThread]
public static void Main()
{
Process[] localByName = Process.GetProcessesByName("faceme");
Process currentProcess = Process.GetCurrentProcess();
int nProcessID = Process.GetCurrentProcess().Id;
var runningProcess = (from process in Process.GetProcesses()
where
process.Id != currentProcess.Id &&
process.ProcessName.Equals(
currentProcess.ProcessName,
StringComparison.Ordinal)
select process).FirstOrDefault();
if (runningProcess != null)
{
runningProcess.Kill();
}
MyApp.App app = new MyApp.App();
app.InitializeComponent();
app.Run();
}
当我调用runningProcess.Kill()方法
时出现此错误