public void Continue(string caller_trace) { ContinueRequest continueRequest = new ContinueRequest(); continueRequest.arguments.threadId = threadId; Assert.True(VSCodeDebugger.Request(continueRequest).Success, @"__FILE__:__LINE__" + "\n" + caller_trace); }
public void DebuggerExit(string caller_trace) { DisconnectRequest disconnectRequest = new DisconnectRequest(); disconnectRequest.arguments = new DisconnectArguments(); disconnectRequest.arguments.restart = false; Assert.True(VSCodeDebugger.Request(disconnectRequest).Success, @"__FILE__:__LINE__" + "\n" + caller_trace); }
public static void DebuggerExit() { DisconnectRequest disconnectRequest = new DisconnectRequest(); disconnectRequest.arguments = new DisconnectArguments(); disconnectRequest.arguments.restart = false; Assert.True(VSCodeDebugger.Request(disconnectRequest).Success); }
public static VSCodeResult SetVariable(int variablesReference, string Name, string Value) { SetVariableRequest setVariableRequest = new SetVariableRequest(); setVariableRequest.arguments.variablesReference = variablesReference; setVariableRequest.arguments.name = Name; setVariableRequest.arguments.value = Value; return(VSCodeDebugger.Request(setVariableRequest)); }
public void CheckErrorAtRequest(string caller_trace, Int64 frameId, string Expression) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = Expression; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.False(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); }
public static void CalcExpressionWithNotDeclared(Int64?frameId, string Expression) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = Expression; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.False(ret.Success); }
public static void WasExit() { string resJSON = VSCodeDebugger.Receive(-1); Assert.True(VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated")); DisconnectRequest disconnectRequest = new DisconnectRequest(); disconnectRequest.arguments = new DisconnectArguments(); disconnectRequest.arguments.restart = false; Assert.True(VSCodeDebugger.Request(disconnectRequest).Success); }
public void SetBreakpoints(string caller_trace) { SetBreakpointsRequest setBreakpointsRequest = new SetBreakpointsRequest(); setBreakpointsRequest.arguments.source.name = BreakpointSourceName; // NOTE this code works only with one source file setBreakpointsRequest.arguments.source.path = ControlInfo.SourceFilesPath; setBreakpointsRequest.arguments.lines.AddRange(BreakpointLines); setBreakpointsRequest.arguments.breakpoints.AddRange(BreakpointList); setBreakpointsRequest.arguments.sourceModified = false; Assert.True(VSCodeDebugger.Request(setBreakpointsRequest).Success, @"__FILE__:__LINE__" + "\n" + caller_trace); }
public static void SetBreakpoints() { SetBreakpointsRequest setBreakpointsRequest = new SetBreakpointsRequest(); setBreakpointsRequest.arguments.source.name = BreakpointSourceName; // NOTE this code works only with one source file setBreakpointsRequest.arguments.source.path = DebuggeeInfo.SourceFilesPath; setBreakpointsRequest.arguments.lines.AddRange(BreakpointLines); setBreakpointsRequest.arguments.breakpoints.AddRange(BreakpointList); setBreakpointsRequest.arguments.sourceModified = false; Assert.True(VSCodeDebugger.Request(setBreakpointsRequest).Success); }
public static VariablesResponse GetLocalVariables(Int64 frameId) { int variablesReference = Context.GetVariablesReference(frameId, "Locals"); VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success); return(JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr)); }
public void GetResultAsString(string caller_trace, Int64 frameId, string expr, out string strRes) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = expr; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); EvaluateResponse evaluateResponse = JsonConvert.DeserializeObject <EvaluateResponse>(ret.ResponseStr); strRes = evaluateResponse.body.result; }
public VariablesResponse GetLocalVariables(string caller_trace, Int64 frameId) { int variablesReference = GetVariablesReference(@"__FILE__:__LINE__" + "\n" + caller_trace, frameId, "Locals"); VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); return(JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr)); }
public static void WasStopped(string Reason, Breakpoint breakpoint) { Func <string, bool> filter = (resJSON) => { if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") && VSCodeDebugger.isResponseContainProperty(resJSON, "reason", Reason)) { if (Reason == "breakpoint") { threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId")); } return(true); } return(false); }; if (!VSCodeDebugger.IsEventReceived(filter)) { throw new NetcoreDbgTestCore.ResultNotSuccessException(); } StackTraceRequest stackTraceRequest = new StackTraceRequest(); stackTraceRequest.arguments.threadId = threadId; stackTraceRequest.arguments.startFrame = 0; stackTraceRequest.arguments.levels = 20; var ret = VSCodeDebugger.Request(stackTraceRequest); Assert.True(ret.Success); Assert.Equal(BreakpointType.Line, breakpoint.Type); var lbp = (LineBreakpoint)breakpoint; StackTraceResponse stackTraceResponse = JsonConvert.DeserializeObject <StackTraceResponse>(ret.ResponseStr); foreach (var Frame in stackTraceResponse.body.stackFrames) { if (Frame.line == lbp.NumLine && Frame.source.name == lbp.FileName // NOTE this code works only with one source file && Frame.source.path == DebuggeeInfo.SourceFilesPath) { return; } } throw new NetcoreDbgTestCore.ResultNotSuccessException(); }
public static string CalcExpression(Int64?frameId, string Expression) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = Expression; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.True(ret.Success); EvaluateResponse evaluateResponse = JsonConvert.DeserializeObject <EvaluateResponse>(ret.ResponseStr); return(evaluateResponse.body.result); }
public void CheckErrorAtRequest(string caller_trace, Int64 frameId, string Expression, string errMsgStart) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = Expression; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.False(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); EvaluateResponse evaluateResponse = JsonConvert.DeserializeObject <EvaluateResponse>(ret.ResponseStr); Assert.True(evaluateResponse.message.StartsWith(errMsgStart), @"__FILE__:__LINE__" + "\n" + caller_trace); }
public void CalcAndCheckExpression(string caller_trace, Int64?frameId, string ExpectedResult, string Expression) { EvaluateRequest evaluateRequest = new EvaluateRequest(); evaluateRequest.arguments.expression = Expression; evaluateRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(evaluateRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); EvaluateResponse evaluateResponse = JsonConvert.DeserializeObject <EvaluateResponse>(ret.ResponseStr); Assert.Equal(ExpectedResult, evaluateResponse.body.result, @"__FILE__:__LINE__" + "\n" + caller_trace); }
public void WasBreakpointHitWithProperThreadID(string caller_trace, string bpName) { Func <string, bool> filter = (resJSON) => { if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") && VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "breakpoint")) { threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId")); return(true); } return(false); }; threadId = -1; Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace); Assert.True(isThredInThreadsList(@"__FILE__:__LINE__" + "\n" + caller_trace, threadId), @"__FILE__:__LINE__" + "\n" + caller_trace); StackTraceRequest stackTraceRequest = new StackTraceRequest(); stackTraceRequest.arguments.threadId = threadId; stackTraceRequest.arguments.startFrame = 0; stackTraceRequest.arguments.levels = 20; var ret = VSCodeDebugger.Request(stackTraceRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); Breakpoint breakpoint = ControlInfo.Breakpoints[bpName]; Assert.Equal(BreakpointType.Line, breakpoint.Type, @"__FILE__:__LINE__" + "\n" + caller_trace); var lbp = (LineBreakpoint)breakpoint; StackTraceResponse stackTraceResponse = JsonConvert.DeserializeObject <StackTraceResponse>(ret.ResponseStr); foreach (var Frame in stackTraceResponse.body.stackFrames) { if (Frame.line == lbp.NumLine && Frame.source.name == lbp.FileName // NOTE this code works only with one source file && Frame.source.path == ControlInfo.SourceFilesPath) { return; } } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public void TestExceptionInfo(string caller_trace, string excCategory, string excMode, string excName) { ExceptionInfoRequest exceptionInfoRequest = new ExceptionInfoRequest(); exceptionInfoRequest.arguments.threadId = threadId; var ret = VSCodeDebugger.Request(exceptionInfoRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); ExceptionInfoResponse exceptionInfoResponse = JsonConvert.DeserializeObject <ExceptionInfoResponse>(ret.ResponseStr); if (exceptionInfoResponse.body.breakMode == excMode && exceptionInfoResponse.body.exceptionId == excCategory + "/" + excName && exceptionInfoResponse.body.details.fullTypeName == excName) { return; } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public void PrepareStart(string caller_trace) { InitializeRequest initializeRequest = new InitializeRequest(); initializeRequest.arguments.clientID = "vscode"; initializeRequest.arguments.clientName = "Visual Studio Code"; initializeRequest.arguments.adapterID = "coreclr"; initializeRequest.arguments.pathFormat = "path"; initializeRequest.arguments.linesStartAt1 = true; initializeRequest.arguments.columnsStartAt1 = true; initializeRequest.arguments.supportsVariableType = true; initializeRequest.arguments.supportsVariablePaging = true; initializeRequest.arguments.supportsRunInTerminalRequest = true; initializeRequest.arguments.locale = "en-us"; Assert.True(VSCodeDebugger.Request(initializeRequest).Success, @"__FILE__:__LINE__" + "\n" + caller_trace); LaunchRequest launchRequest = new LaunchRequest(); launchRequest.arguments.name = ".NET Core Launch (web)"; launchRequest.arguments.type = "coreclr"; launchRequest.arguments.preLaunchTask = "build"; string AbsolutePathToAssembly = Path.GetFullPath(ControlInfo.TargetAssemblyPath); launchRequest.arguments.program = Path.GetFileName(AbsolutePathToAssembly); string targetAssemblyPath = Path.GetFileName(AbsolutePathToAssembly); int subLength = AbsolutePathToAssembly.Length - targetAssemblyPath.Length; string dllPath = AbsolutePathToAssembly.Substring(0, subLength); launchRequest.arguments.cwd = dllPath; launchRequest.arguments.env = new Dictionary <string, string>(); launchRequest.arguments.env.Add("ASPNETCORE_ENVIRONMENT", "Development"); launchRequest.arguments.env.Add("ASPNETCORE_URLS", "https://*****:*****@"__FILE__:__LINE__" + "\n" + caller_trace); }
public static int GetVariablesReference(Int64 frameId, string ScopeName) { ScopesRequest scopesRequest = new ScopesRequest(); scopesRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(scopesRequest); Assert.True(ret.Success); ScopesResponse scopesResponse = JsonConvert.DeserializeObject <ScopesResponse>(ret.ResponseStr); foreach (var Scope in scopesResponse.body.scopes) { if (Scope.name == ScopeName) { return(Scope.variablesReference == null ? 0 : (int)Scope.variablesReference); } } throw new NetcoreDbgTestCore.ResultNotSuccessException(); }
public void EvalVariableByIndex(string caller_trace, int variablesReference, string Type, int Index, string Value) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); if (Index < variablesResponse.body.variables.Count) { var Variable = variablesResponse.body.variables[Index]; Assert.Equal(Type, Variable.type, @"__FILE__:__LINE__" + "\n" + caller_trace); Assert.Equal(Value, Variable.value, @"__FILE__:__LINE__" + "\n" + caller_trace); return; } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public static int GetChildVariablesReference(int VariablesReference, string VariableName) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = VariablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); foreach (var Variable in variablesResponse.body.variables) { if (Variable.name == VariableName) { return(Variable.variablesReference); } } throw new NetcoreDbgTestCore.ResultNotSuccessException(); }
public static void EvalVariable(int variablesReference, string Type, string Name, string Value) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); foreach (var Variable in variablesResponse.body.variables) { if (Variable.name == Name) { Assert.True(Type == Variable.type && Value == Variable.value); return; } } }
public static void EvalVariableByIndex(int variablesReference, string Type, int Index, string Value) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); if (Index < variablesResponse.body.variables.Count) { var Variable = variablesResponse.body.variables[Index]; Assert.True(Type == Variable.type && Value == Variable.value); return; } throw new NetcoreDbgTestCore.ResultNotSuccessException(); }
public int GetChildVariablesReference(string caller_trace, int VariablesReference, string VariableName) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = VariablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); foreach (var Variable in variablesResponse.body.variables) { if (Variable.name == VariableName) { return(Variable.variablesReference); } } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public int GetVariablesReference(string caller_trace, Int64 frameId, string ScopeName) { ScopesRequest scopesRequest = new ScopesRequest(); scopesRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(scopesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); ScopesResponse scopesResponse = JsonConvert.DeserializeObject <ScopesResponse>(ret.ResponseStr); foreach (var Scope in scopesResponse.body.scopes) { if (Scope.name == ScopeName) { return(Scope.variablesReference == null ? 0 : (int)Scope.variablesReference); } } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public void EvalVariable(string caller_trace, int variablesReference, string Type, string Name, string Value) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); foreach (var Variable in variablesResponse.body.variables) { if (Variable.name == Name) { Assert.Equal(Type, Variable.type, @"__FILE__:__LINE__" + "\n" + caller_trace); Assert.Equal(Value, Variable.value, @"__FILE__:__LINE__" + "\n" + caller_trace); return; } } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
public bool EvalVariable(string caller_trace, int variablesReference, string ExpectedResult, string ExpectedType, string VariableName) { VariablesRequest variablesRequest = new VariablesRequest(); variablesRequest.arguments.variablesReference = variablesReference; var ret = VSCodeDebugger.Request(variablesRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); VariablesResponse variablesResponse = JsonConvert.DeserializeObject <VariablesResponse>(ret.ResponseStr); foreach (var Variable in variablesResponse.body.variables) { if (Variable.name == VariableName) { Assert.Equal(ExpectedType, Variable.type, @"__FILE__:__LINE__" + "\n" + caller_trace); Assert.Equal(ExpectedResult, Variable.value, @"__FILE__:__LINE__" + "\n" + caller_trace); return(true); } } return(false); }
public static void CheckVariablesCount(Int64 frameId, string ScopeName, int VarCount) { ScopesRequest scopesRequest = new ScopesRequest(); scopesRequest.arguments.frameId = frameId; var ret = VSCodeDebugger.Request(scopesRequest); Assert.True(ret.Success); ScopesResponse scopesResponse = JsonConvert.DeserializeObject <ScopesResponse>(ret.ResponseStr); foreach (var Scope in scopesResponse.body.scopes) { if (Scope.name == ScopeName) { Assert.True(VarCount == Scope.namedVariables || (VarCount == 0 && null == Scope.namedVariables)); return; } } throw new NetcoreDbgTestCore.ResultNotSuccessException(); }
public void PrepareEnd(string caller_trace) { ConfigurationDoneRequest configurationDoneRequest = new ConfigurationDoneRequest(); Assert.True(VSCodeDebugger.Request(configurationDoneRequest).Success, @"__FILE__:__LINE__" + "\n" + caller_trace); }