本文整理汇总了C#中VisualStudioApp.WaitForException方法的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp.WaitForException方法的具体用法?C# VisualStudioApp.WaitForException怎么用?C# VisualStudioApp.WaitForException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualStudioApp
的用法示例。
在下文中一共展示了VisualStudioApp.WaitForException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExceptionTest
private static void ExceptionTest(string filename, string expectedTitle, string expectedDescription, string exceptionType, int expectedLine) {
using (var app = new VisualStudioApp()) {
var debug3 = (Debugger3)app.Dte.Debugger;
bool justMyCode = (bool)app.Dte.Properties["Debugging", "General"].Item("EnableJustMyCode").Value;
app.Dte.Properties["Debugging", "General"].Item("EnableJustMyCode").Value = true;
try {
OpenDebuggerProject(app, filename);
var exceptionSettings = debug3.ExceptionGroups.Item("Python Exceptions");
exceptionSettings.SetBreakWhenThrown(true, exceptionSettings.Item(exceptionType));
app.Dte.ExecuteCommand("Debug.Start");
WaitForMode(app, dbgDebugMode.dbgBreakMode);
exceptionSettings.SetBreakWhenThrown(false, exceptionSettings.Item(exceptionType));
exceptionSettings.SetBreakWhenThrown(true, exceptionSettings.Item(exceptionType));
debug3.ExceptionGroups.ResetAll();
var excepDialog = app.WaitForException();
AutomationWrapper.DumpElement(excepDialog.Element);
Assert.AreEqual(expectedDescription, excepDialog.Description);
Assert.AreEqual(expectedTitle, excepDialog.Title);
excepDialog.Cancel();
Assert.AreEqual((uint)expectedLine, ((StackFrame2)debug3.CurrentThread.StackFrames.Item(1)).LineNumber);
debug3.Go(WaitForBreakOrEnd: true);
WaitForMode(app, dbgDebugMode.dbgDesignMode);
} finally {
app.Dte.Properties["Debugging", "General"].Item("EnableJustMyCode").Value = true;
}
}
}