void Fetch(int maxIndex) { if (elements == null) { elements = new List <ObjectValue> (); values = new List <object> (); try { enumerator = ctx.Adapter.RuntimeInvoke(ctx, objType, obj, "GetEnumerator", new object[0], new object[0]); enumeratorType = ctx.Adapter.GetImplementedInterfaces(ctx, ctx.Adapter.GetValueType(ctx, enumerator)) .First(f => ctx.Adapter.GetTypeName(ctx, f) == "System.Collections.IEnumerator"); } catch (EvaluatorExceptionThrownException e) { elements.Add(ObjectValue.CreateEvaluationException(ctx, this, new ObjectPath("Exception"), e)); return; } } while (maxIndex > elements.Count && MoveNext()) { var valCurrent = ctx.Adapter.GetMember(ctx, null, enumeratorType, enumerator, "Current"); var val = valCurrent.Value; values.Add(val); if (val != null) { elements.Add(ctx.Adapter.CreateObjectValue(ctx, valCurrent, new ObjectPath("[" + currentIndex + "]"), val, ObjectValueFlags.ReadOnly)); } else { elements.Add(ObjectValue.CreateNullObject(this, "[" + currentIndex + "]", ctx.Adapter.GetDisplayTypeName(ctx.Adapter.GetTypeName(ctx, valCurrent.Type)), ObjectValueFlags.ReadOnly)); } currentIndex++; } }
public ObjectValue GetValue(ObjectPath path, EvaluationOptions options) { if (val == "null") { return(ObjectValue.CreateNullObject(this, name, type, parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly)); } if (variablesReference == 0) //This is some kind of primitive... { return(ObjectValue.CreatePrimitive(this, new ObjectPath(name), type, new EvaluationResult(val), parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly)); } return(ObjectValue.CreateObject(this, new ObjectPath(name), type, new EvaluationResult(val), parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly, null)); }
public ObjectValue GetValue(ObjectPath path, EvaluationOptions options) { if (val == "null") { return(ObjectValue.CreateNullObject(this, name, type, flags)); } if (variablesReference == 0) //This is some kind of primitive... { return(ObjectValue.CreatePrimitive(this, new ObjectPath(name), type, new EvaluationResult(val, display), flags)); } return(ObjectValue.CreateObject(this, new ObjectPath(name), type, new EvaluationResult(val, display), flags, null)); }
protected virtual ObjectValue CreateObjectValueImpl(EvaluationContext ctx, Mono.Debugging.Backend.IObjectValueSource source, ObjectPath path, object obj, ObjectValueFlags flags) { string typeName = obj != null?GetValueTypeName(ctx, obj) : ""; if (obj == null || IsNull(ctx, obj)) { return(ObjectValue.CreateNullObject(source, path, GetDisplayTypeName(typeName), flags)); } else if (IsPrimitive(ctx, obj) || IsEnum(ctx, obj)) { return(ObjectValue.CreatePrimitive(source, path, GetDisplayTypeName(typeName), ctx.Evaluator.TargetObjectToExpression(ctx, obj), flags)); } else if (IsArray(ctx, obj)) { return(ObjectValue.CreateObject(source, path, GetDisplayTypeName(typeName), ctx.Evaluator.TargetObjectToExpression(ctx, obj), flags, null)); } else { TypeDisplayData tdata = GetTypeDisplayData(ctx, GetValueType(ctx, obj)); EvaluationResult tvalue; if (!string.IsNullOrEmpty(tdata.ValueDisplayString) && ctx.Options.AllowDisplayStringEvaluation) { tvalue = new EvaluationResult(EvaluateDisplayString(ctx, obj, tdata.ValueDisplayString)); } else { tvalue = ctx.Evaluator.TargetObjectToExpression(ctx, obj); } string tname; if (!string.IsNullOrEmpty(tdata.TypeDisplayString) && ctx.Options.AllowDisplayStringEvaluation) { tname = EvaluateDisplayString(ctx, obj, tdata.TypeDisplayString); } else { tname = GetDisplayTypeName(typeName); } ObjectValue oval = ObjectValue.CreateObject(source, path, tname, tvalue, flags, null); if (!string.IsNullOrEmpty(tdata.NameDisplayString) && ctx.Options.AllowDisplayStringEvaluation) { oval.Name = EvaluateDisplayString(ctx, obj, tdata.NameDisplayString); } return(oval); } }
public ObjectValue GetValue(ObjectPath path, EvaluationOptions options) { string shortName = name; var indexOfSpace = name.IndexOf(' '); if (indexOfSpace != -1) //Remove " [TypeName]" from variable name { shortName = name.Remove(indexOfSpace); } if (type == null) { return(ObjectValue.CreateError(null, new ObjectPath(shortName), "", val, ObjectValueFlags.None)); } if (val == "null") { return(ObjectValue.CreateNullObject(this, shortName, type, parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly)); } if (variablesReference == 0) //This is some kind of primitive... { return(ObjectValue.CreatePrimitive(this, new ObjectPath(shortName), type, new EvaluationResult(val), parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly)); } return(ObjectValue.CreateObject(this, new ObjectPath(shortName), type, new EvaluationResult(val), parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly, null)); }