예제 #1
0
        public void TestException()
        {
            OpenDebuggerProject("SimpleException.py");
            var debug3            = (Debugger3)VsIdeTestHostContext.Dte.Debugger;
            var exceptionSettings = debug3.ExceptionGroups.Item("Python Exceptions");

            exceptionSettings.SetBreakWhenThrown(true, exceptionSettings.Item("exceptions.Exception"));


            VsIdeTestHostContext.Dte.ExecuteCommand("Debug.Start");
            WaitForMode(dbgDebugMode.dbgBreakMode);

            exceptionSettings.SetBreakWhenThrown(false, exceptionSettings.Item("exceptions.Exception"));
            exceptionSettings.SetBreakWhenThrown(true, exceptionSettings.Item("exceptions.Exception"));
            debug3.ExceptionGroups.ResetAll();

            Assert.AreEqual(((StackFrame2)debug3.CurrentThread.StackFrames.Item(1)).LineNumber, (uint)3);

            VisualStudioApp.HandleException(ExceptionButton.Break, "exceptions.Exception", "line 3");

            VsIdeTestHostContext.Dte.Debugger.Go(WaitForBreakOrEnd: true);

            WaitForMode(dbgDebugMode.dbgDesignMode);
        }