本文整理汇总了C#中Debugger.Process.WaitForPause方法的典型用法代码示例。如果您正苦于以下问题:C# Process.WaitForPause方法的具体用法?C# Process.WaitForPause怎么用?C# Process.WaitForPause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger.Process
的用法示例。
在下文中一共展示了Process.WaitForPause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartTest
protected void StartTest(string testName, bool wait)
{
this.testName = testName;
string exeFilename = CompileTest(testName);
testNode.SetAttribute("name", testName);
shapshotID = 0;
log = "";
lastLogMessage = null;
process = debugger.Start(exeFilename, Path.GetDirectoryName(exeFilename), testName);
process.LogMessage += delegate(object sender, MessageEventArgs e) {
log += e.Message;
lastLogMessage = e.Message;
LogEvent("LogMessage", e.Message.Replace("\r",@"\r").Replace("\n",@"\n"));
};
process.ModuleLoaded += delegate(object sender, ModuleEventArgs e) {
LogEvent("ModuleLoaded", e.Module.Filename + (e.Module.HasSymbols ? " (Has symbols)" : " (No symbols)"));
};
process.Paused += delegate(object sender, ProcessEventArgs e) {
LogEvent("DebuggingPaused", e.Process.PauseSession.PausedReason.ToString() + " " + e.Process.SelectedStackFrame.NextStatement.ToString());
};
// process.DebuggingResumed += delegate(object sender, ProcessEventArgs e) {
// LogEvent("DebuggingResumed", e.Process.PausedReason.ToString());
// };
process.ExceptionThrown += delegate(object sender, ExceptionEventArgs e) {
StringBuilder msg = new StringBuilder();
if (process.SelectedThread.InterceptCurrentException()) {
msg.Append(e.Exception.ToString());
} else {
// For example, happens on stack overflow
msg.Append("Could not intercept: ");
msg.Append(e.Exception.ToString());
}
LogEvent("ExceptionThrown", msg.ToString());
};
process.Exited += delegate(object sender, EventArgs e) {
LogEvent("ProcessExited", null);
};
LogEvent("ProcessStarted", null);
if (wait) {
process.WaitForPause();
}
}