本文整理汇总了C#中IFrameworkHandle.LaunchProcessWithDebuggerAttached方法的典型用法代码示例。如果您正苦于以下问题:C# IFrameworkHandle.LaunchProcessWithDebuggerAttached方法的具体用法?C# IFrameworkHandle.LaunchProcessWithDebuggerAttached怎么用?C# IFrameworkHandle.LaunchProcessWithDebuggerAttached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFrameworkHandle
的用法示例。
在下文中一共展示了IFrameworkHandle.LaunchProcessWithDebuggerAttached方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Debug
/// <summary>
/// Starts a Process in a debug session using the provided command line arguments string.
/// </summary>
/// <param name="framework">The IFrameworkHandle which provides debug session handling.</param>
/// <param name="info">The process start info which will be used to launch the external test program.</param>
/// <returns>The newly spawned debug process.</returns>
private static Process Debug(IFrameworkHandle framework, ProcessStartInfo info)
{
if (framework == null)
{
return Run(info);
}
Dictionary<string, string> environment =
info.EnvironmentVariables.Cast<DictionaryEntry>().ToDictionary(
item => item.Key.ToString(),
item => item.Value.ToString()
);
int pid = framework.LaunchProcessWithDebuggerAttached(
info.FileName,
info.WorkingDirectory,
info.Arguments,
environment
);
// Get a process on the local computer, using the process id.
return Process.GetProcessById(pid);
}
示例2: DebugCatchTest
/// <summary>
/// Runs a test in a source (Catch binary) with a debugger attached and returns the resulting XML string.
/// </summary>
internal static string DebugCatchTest(string testBinary, string testSpec, IFrameworkHandle framework)
{
string output;
var cwd = Directory.GetCurrentDirectory();
var exePath = Path.Combine(cwd, testBinary);
var outputPath = Path.GetTempFileName();
try
{
var arguments = Utility.escapeArguments(testSpec, "-r", "xml", "-b", "-d", "yes", "-o", outputPath);
var debuggee = Process.GetProcessById(framework.LaunchProcessWithDebuggerAttached(exePath, cwd, arguments, null));
debuggee.WaitForExit();
output = File.ReadAllText(outputPath);
debuggee.Close();
}
finally
{
File.Delete(outputPath);
}
return output;
}