void OnCreateProcess(object sender, CorProcessEventArgs e) { // Required to avoid the jit to get rid of variables too early e.Process.DesiredNGENCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION; e.Process.EnableLogMessages(true); e.Continue = true; }
void OnProcessExit(object sender, CorProcessEventArgs e) { TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetExited); // If the main thread stopped, terminate the debugger session if (e.Process.Id == process.Id) { lock (terminateLock) { process = null; ThreadPool.QueueUserWorkItem(delegate { // The Terminate call will fail if called in the event handler dbg.Terminate(); dbg = null; GC.Collect(); }); } } OnTargetEvent(args); }
/// <summary> /// Event handler for when the process exits /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> private void ExitProcessEventHandler(object sender, CorProcessEventArgs e) { Dispose(); }
/// <summary> /// Event Handler for the creation of the Debugee's process /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> private void CreateProcessEventHandler(object sender, CorProcessEventArgs e) { //Console.WriteLine("OnCreateProcess"); //e.Continue = true; e.Continue = true; }