本文整理汇总了C#中Process.WaitForPause方法的典型用法代码示例。如果您正苦于以下问题:C# Process.WaitForPause方法的具体用法?C# Process.WaitForPause怎么用?C# Process.WaitForPause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process.WaitForPause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartTest
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.Modules.Added += delegate(object sender, CollectionItemEventArgs<Module> e) {
LogEvent("ModuleLoaded", e.Item.Name + (e.Item.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();
}
}
示例2: StartTest
void StartTest(string testName, bool wait)
{
this.testName = testName;
string exeFilename = CompileTest(testName);
testNode.SetAttribute("name", testName);
shapshotID = 0;
debugger.Options = new Options();
debugger.Options.EnableJustMyCode = true;
debugger.Options.SuppressJITOptimization = true;
debugger.Options.StepOverDebuggerAttributes = true;
debugger.Options.StepOverAllProperties = false;
debugger.Options.StepOverFieldAccessProperties = true;
debugger.Options.SymbolsSearchPaths = new string[0];
debugger.Options.PauseOnHandledExceptions = false;
log = "";
lastLogMessage = null;
process = debugger.Start(exeFilename, Path.GetDirectoryName(exeFilename), testName, false);
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.Name + (e.Module.HasSymbols ? " (Has symbols)" : " (No symbols)"));
};
process.Paused += delegate(object sender, DebuggerPausedEventArgs e) {
this.CurrentThread = e.Thread;
if (e.Thread != null && e.Thread.IsInValidState) {
this.CurrentStackFrame = e.Thread.MostRecentStackFrame;
} else {
this.CurrentStackFrame = null;
}
foreach(Thread exceptionThread in e.ExceptionsThrown) {
Value exception = exceptionThread.CurrentException;
LogEvent("ExceptionThrown", exception.Type.FullName);
if (!exceptionThread.InterceptException()) {
LogEvent("CanNotInterceptException", exception.Type.FullName);
}
}
LogEvent("Paused", CurrentStackFrame != null && CurrentStackFrame.NextStatement != null ? CurrentStackFrame.NextStatement.ToString() : string.Empty);
};
process.Exited += delegate(object sender, DebuggerEventArgs e) {
LogEvent("Exited", null);
};
LogEvent("Started", null);
if (wait) {
process.WaitForPause();
}
}