Exemple #1
0
        public async Task BreakpointHit_FunctionEvaluationFailure()
        {
            string condition = "NonExistentFunc() == \"Hello, World!\"";

            using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.LoopMiddle, condition);

                // Checks that the breakpoint has a condition.
                Assert.Equal(breakpoint.Condition, condition);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetLoopUrl(app, 10));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Checks that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);
                // However, it should have error status set to true.
                Assert.True(newBp.Status.IsError);
                Assert.Empty(newBp.StackFrames);
            }
        }
Exemple #2
0
        public async Task BreakpointHit_FunctionEvaluationNotPerformedForExpression()
        {
            string[] expression = { "Hello()" };
            using (var app = StartTestApp(debugEnabled: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.LoopMiddle, null, expression);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetLoopUrl(app, 10));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Checks that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);
                // However, it should have error status set to true.
                Assert.True(newBp.Status.IsError);
                Assert.Contains("Method call for condition or expression evaluation is disabled.", newBp.Status.Description.Format);
                Assert.Empty(newBp.StackFrames);
            }
        }
Exemple #3
0
        public async Task BreakpointHit_FunctionEvaluation()
        {
            string condition = "Hello() == \"Hello, World!\"";

            using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.LoopMiddle, condition);

                // Checks that the breakpoint has a condition.
                Assert.Equal(breakpoint.Condition, condition);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetLoopUrl(app, 10));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Checks that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);
                // Checks that "i" is 0 when the breakpoint is hit.
                Debugger.V2.StackFrame firstFrame = newBp.StackFrames[0];
                DebuggerVariable       iVariable  = firstFrame.Locals.First(local => local.Name == "i");
                Assert.Equal("0", iVariable.Value);
            }
        }
Exemple #4
0
        public async Task BreakpointHit_Comment()
        {
            using (var app = StartTestApp(debugEnabled: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass, TestApplication.LoopMiddleComment);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetLoopUrl(app, 10));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Check that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);

                // Check that the breakpoint line is at the next line.
                Assert.Equal(TestApplication.LoopMiddle, newBp.Location.Line);
            }
        }