Ejemplo n.º 1
0
        public ObjectValueNode[] EvaluateExpressions(IList <string> expressions)
        {
            var values  = new ObjectValue[expressions.Count];
            var unknown = new List <string> ();

            for (int i = 0; i < expressions.Count; i++)
            {
                if (!cachedValues.TryGetValue(expressions[i], out var value))
                {
                    unknown.Add(expressions[i]);
                }
                else
                {
                    values[i] = value;
                }
            }

            ObjectValue[] qvalues;

            if (StackFrame != null)
            {
                using (var timer = StackFrame.DebuggerSession.WatchExpressionStats.StartTimer()) {
                    qvalues       = StackFrame.GetExpressionValues(unknown.ToArray(), true);
                    timer.Success = true;
                }
            }
            else
            {
                qvalues = new ObjectValue[unknown.Count];
                for (int i = 0; i < qvalues.Length; i++)
                {
                    qvalues[i] = ObjectValue.CreateUnknown(unknown[i]);
                }
            }

            for (int i = 0, v = 0; i < values.Length; i++)
            {
                if (values[i] == null)
                {
                    var value = qvalues[v++];

                    cachedValues[expressions[i]] = value;
                    values[i] = value;
                }
            }

            return(values.Select(v => new DebuggerObjectValueNode(v)).ToArray());
        }