Ejemplo n.º 1
0
        public ObjectValue[] GetChildren(ObjectPath path, int index, int count, EvaluationOptions options)
        {
            if (objValChildren == null)
            {
                if (VariablesReference > 0)
                {
                    using (var timer = Session.EvaluationStats.StartTimer()) {
                        var response = Session.protocolClient.SendRequestSync(new VariablesRequest(VariablesReference));
                        var children = new List <ObjectValue> ();

                        foreach (var variable in response.Variables)
                        {
                            var source = new VSCodeVariableSource(Session, variable, VariablesReference, FrameId);
                            children.Add(source.GetValue(default(ObjectPath), null));
                        }

                        objValChildren = children.ToArray();
                        timer.Success  = true;
                    }
                }
                else
                {
                    objValChildren = new ObjectValue[0];
                }
            }

            return(objValChildren);
        }
Ejemplo n.º 2
0
        public ObjectValue [] GetAllLocals(int frameIndex, EvaluationOptions options)
        {
            var results = new List <ObjectValue> ();
            var frame   = frames[frameIndex];

            foreach (var scope in GetScopes(frameIndex))
            {
                using (var timer = session.EvaluationStats.StartTimer()) {
                    VariablesResponse response;

                    try {
                        response = session.protocolClient.SendRequestSync(new VariablesRequest(scope.VariablesReference));
                    } catch (Exception ex) {
                        LoggingService.LogError($"[VsCodeDebugger] Failed to get local variables for the scope: {scope.Name}", ex);
                        timer.Success = false;
                        continue;
                    }

                    foreach (var variable in response.Variables)
                    {
                        var source = new VSCodeVariableSource(session, variable, scope.VariablesReference, frame.Id);
                        results.Add(source.GetValue(default(ObjectPath), null));
                    }

                    timer.Success = true;
                }
            }

            return(results.ToArray());
        }