public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugProcess pProcess) { Process process; // We have to wait until the created process is added into the collection lock (debugger.ProcessIsBeingCreatedLock) { process = debugger.GetProcess(pProcess); } // Make *really* sure the process is not dead if (process == null) { debugger.TraceMessage("Ignoring callback \"" + name + "\": Process not found"); return(null); } if (process.HasExited) { debugger.TraceMessage("Ignoring callback \"" + name + "\": Process has exited"); return(null); } if (process.TerminateCommandIssued && !(name == "ExitProcess")) { debugger.TraceMessage("Ignoring callback \"" + name + "\": Terminate command was issued for the process"); return(null); } // Check that the process is not exited try { int isRunning = process.CorProcess.IsRunning; } catch (COMException e) { process.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message); return(null); } return(process.CallbackInterface); }
public ManagedCallback GetProcessCallbackInterface(ICorDebugProcess pProcess) { Process process = debugger.GetProcess(pProcess); if (process == null) { return(null); } try { int isRunning = process.CorProcess.IsRunning; } catch (COMException e) { // 0x80131301: Process was terminated if ((uint)e.ErrorCode == 0x80131301) { process.TraceMessage("Ingoring callback of exited process"); return(null); } } return(process.CallbackInterface); }