public virtual ObjectValue[] GetLocalVariables(int frameIndex, EvaluationOptions options)
        {
            var frame = GetFrameInfo(frameIndex, options, false);
            var list  = new List <ObjectValue> ();

            if (frame == null)
            {
                var val = Adaptor.CreateObjectValueAsync("Local Variables", ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    foreach (var local in frame.LocalVariables)
                    {
                        list.Add(local.CreateObjectValue(false, options));
                    }

                    return(ObjectValue.CreateArray(null, new ObjectPath("Local Variables"), "", list.Count, ObjectValueFlags.EvaluatingGroup, list.ToArray()));
                });

                return(new [] { val });
            }

            foreach (ValueReference local in frame.LocalVariables)
            {
                list.Add(local.CreateObjectValue(true, options));
            }

            return(list.ToArray());
        }
        public virtual ObjectValue[] GetParameters(int frameIndex, EvaluationOptions options)
        {
            List <ObjectValue> vars = new List <ObjectValue> ();

            FrameInfo frame = GetFrameInfo(frameIndex, options, false);

            if (frame == null)
            {
                ObjectValue val = Adaptor.CreateObjectValueAsync("Parameters", ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    foreach (ValueReference var in frame.Parameters)
                    {
                        vars.Add(var.CreateObjectValue(false, options));
                    }
                    return(ObjectValue.CreateArray(null, new ObjectPath("Parameters"), "", vars.Count, ObjectValueFlags.EvaluatingGroup, vars.ToArray()));
                });
                return(new ObjectValue [] { val });
            }

            foreach (ValueReference var in frame.Parameters)
            {
                vars.Add(var.CreateObjectValue(true, options));
            }
            return(vars.ToArray());
        }
        public virtual ObjectValue[] GetParameters(int frameIndex, EvaluationOptions options)
        {
            var frame  = GetFrameInfo(frameIndex, options, false);
            var values = new List <ObjectValue> ();

            if (frame == null)
            {
                var value = Adaptor.CreateObjectValueAsync("Parameters", ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    foreach (var param in frame.Parameters)
                    {
                        using (var timer = StartEvaluationTimer()) {
                            var paramValue = param.CreateObjectValue(false, options);
                            timer.Stop(paramValue);
                            values.Add(paramValue);
                        }
                    }

                    return(ObjectValue.CreateArray(null, new ObjectPath("Parameters"), "", values.Count, ObjectValueFlags.EvaluatingGroup, values.ToArray()));
                });

                return(new [] { value });
            }

            foreach (var param in frame.Parameters)
            {
                values.Add(param.CreateObjectValue(true, options));
            }

            return(values.ToArray());
        }
        public virtual ObjectValue GetExceptionInstance(int frameIndex, EvaluationOptions options)
        {
            var frame = GetFrameInfo(frameIndex, options, false);

            if (frame == null)
            {
                return(Adaptor.CreateObjectValueAsync(options.CurrentExceptionTag, ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    ObjectValue[] values;

                    if (frame.Exception != null)
                    {
                        using (var timer = StartEvaluationTimer()) {
                            var exceptionValue = frame.Exception.Exception.CreateObjectValue(false, options);
                            timer.Stop(exceptionValue);
                            values = new [] { exceptionValue };
                        }
                    }
                    else
                    {
                        values = new ObjectValue [0];
                    }

                    return ObjectValue.CreateArray(null, new ObjectPath(options.CurrentExceptionTag), "", values.Length, ObjectValueFlags.EvaluatingGroup, values);
                }));
            }

            return(frame.Exception != null?frame.Exception.Exception.CreateObjectValue(true, options) : null);
        }
        public virtual ObjectValue GetThisReference(int frameIndex, EvaluationOptions options)
        {
            var frame = GetFrameInfo(frameIndex, options, false);

            if (frame == null)
            {
                return(Adaptor.CreateObjectValueAsync("this", ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    ObjectValue[] values;

                    if (frame.This != null)
                    {
                        using (var timer = StartEvaluationTimer()) {
                            var thisValue = frame.This.CreateObjectValue(false, options);
                            timer.Stop(thisValue);
                            values = new [] { thisValue };
                        }
                    }
                    else
                    {
                        values = new ObjectValue [0];
                    }

                    return ObjectValue.CreateArray(null, new ObjectPath("this"), "", values.Length, ObjectValueFlags.EvaluatingGroup, values);
                }));
            }

            return(frame.This != null?frame.This.CreateObjectValue(true, options) : null);
        }
        public virtual ObjectValue[] GetExpressionValues(int frameIndex, string[] expressions, EvaluationOptions options)
        {
            if (Adaptor.IsEvaluating)
            {
                var values = new List <ObjectValue> ();

                foreach (var expression in expressions)
                {
                    string tmpExp = expression;

                    var value = Adaptor.CreateObjectValueAsync(tmpExp, ObjectValueFlags.Field, delegate {
                        var cctx = GetEvaluationContext(frameIndex, options);
                        return(Adaptor.GetExpressionValue(cctx, tmpExp));
                    });
                    value.Name = expression;

                    values.Add(value);
                }

                return(values.ToArray());
            }

            var ctx = GetEvaluationContext(frameIndex, options);

            return(ctx.Adapter.GetExpressionValuesAsync(ctx, expressions));
        }
        public virtual ObjectValue GetThisReference(int frameIndex, EvaluationOptions options)
        {
            FrameInfo frame = GetFrameInfo(frameIndex, options, false);

            if (frame == null)
            {
                return(Adaptor.CreateObjectValueAsync("this", ObjectValueFlags.EvaluatingGroup, delegate {
                    frame = GetFrameInfo(frameIndex, options, true);
                    ObjectValue[] vals;
                    if (frame.This != null)
                    {
                        vals = new ObjectValue[] { frame.This.CreateObjectValue(false, options) }
                    }
                    ;
                    else
                    {
                        vals = new ObjectValue [0];
                    }
                    return ObjectValue.CreateArray(null, new ObjectPath("this"), "", vals.Length, ObjectValueFlags.EvaluatingGroup, vals);
                }));