当前位置: 首页>>代码示例>>C#>>正文


C# Process.WaitForPause方法代码示例

本文整理汇总了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();
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:46,代码来源:DebuggerTestsBase.cs

示例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();
			}
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:54,代码来源:DebuggerTestsBase.cs


注:本文中的Process.WaitForPause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。