Beispiel #1
0
        public override DbgDotNetValueNode[] GetChildren(LanguageValueNodeFactory valueNodeFactory, DbgEvaluationInfo evalInfo, ulong index, int count, DbgValueNodeEvaluationOptions options, ReadOnlyCollection <string> formatSpecifiers)
        {
            var res = count == 0 ? Array.Empty <DbgDotNetValueNode>() : new DbgDotNetValueNode[count];
            DbgDotNetValueResult newValue = default;

            try {
                var output      = ObjectCache.AllocDotNetTextOutput();
                var elementType = valueInfo.Value.Type.GetElementType();
                var castType    = NeedCast(slotType, valueInfo.Value.Type) ? valueInfo.Value.Type : null;
                for (int i = 0; i < res.Length; i++)
                {
                    evalInfo.CancellationToken.ThrowIfCancellationRequested();

                    string expression;
                    uint   arrayIndex = (uint)index + (uint)i;
                    newValue = valueInfo.Value.GetArrayElementAt(arrayIndex);

                    if (dimensionInfos.Length == 1)
                    {
                        int baseIndex = (int)arrayIndex + dimensionInfos[0].BaseIndex;
                        expression = valueNodeFactory.GetExpression(valueInfo.Expression, baseIndex, castType, addParens);
                        owner.FormatArrayName(output, baseIndex);
                    }
                    else
                    {
                        uint indexLeft = arrayIndex;
                        for (int j = dimensionInfos.Length - 1; j >= 0; j--)
                        {
                            indexes[j] = (int)(indexLeft % dimensionInfos[j].Length) + dimensionInfos[j].BaseIndex;
                            indexLeft  = indexLeft / dimensionInfos[j].Length;
                        }
                        expression = valueNodeFactory.GetExpression(valueInfo.Expression, indexes, castType, addParens);
                        owner.FormatArrayName(output, indexes);
                    }

                    var name = output.CreateAndReset();
                    DbgDotNetValueNode newNode;
                    if (newValue.HasError)
                    {
                        newNode = valueNodeFactory.CreateError(evalInfo, name, newValue.ErrorMessage, expression, false);
                    }
                    else
                    {
                        newNode = null;
                        if (CSharpDynamicPropertyHelper.IsCSharpDynamicProperty(newValue.Value.Type))
                        {
                            var info = CSharpDynamicPropertyHelper.GetRealValue(evalInfo, newValue.Value);
                            if (info.name != null)
                            {
                                newValue.Value.Dispose();
                                name       = new DbgDotNetText(new DbgDotNetTextPart(DbgTextColor.DebugViewPropertyName, info.name));
                                expression = valueNodeFactory.GetFieldExpression(expression, info.valueField.Name, null, false);
                                newNode    = valueNodeFactory.Create(evalInfo, name, info.value, formatSpecifiers, options, expression, PredefinedDbgValueNodeImageNames.DynamicViewElement, true, false, info.valueField.FieldType, false);
                            }
                        }
                        if (newNode == null)
                        {
                            newNode = valueNodeFactory.Create(evalInfo, name, newValue.Value, formatSpecifiers, options, expression, PredefinedDbgValueNodeImageNames.ArrayElement, false, false, elementType, false);
                        }
                    }
                    newValue = default;
                    res[i]   = newNode;
                }
                ObjectCache.Free(ref output);
            }
            catch {
                evalInfo.Context.Process.DbgManager.Close(res.Where(a => a != null));
                newValue.Value?.Dispose();
                throw;
            }
            return(res);
        }
 public ResultsViewMembersValueNodeProvider(DbgDotNetValueNodeProviderFactory valueNodeProviderFactory, LanguageValueNodeFactory valueNodeFactory, DmdType enumerableType, DbgDotNetValue instanceValue, DmdType expectedType, string valueExpression, DbgValueNodeEvaluationOptions evalOptions)
     : base(valueNodeFactory, resultsViewName, valueExpression + ", " + PredefinedFormatSpecifiers.ResultsView, default, evalOptions)
 {
     this.valueNodeProviderFactory = valueNodeProviderFactory;
     this.enumerableType           = enumerableType;
     this.instanceValue            = instanceValue;
     this.expectedType             = expectedType;
     this.valueExpression          = valueExpression;
     resultsViewProxyExpression    = string.Empty;
 }
 public DynamicViewMembersValueNodeProvider(DbgDotNetValueNodeProviderFactory valueNodeProviderFactory, LanguageValueNodeFactory valueNodeFactory, DbgDotNetValue instanceValue, DmdType expectedType, string valueExpression, DmdAppDomain appDomain, DbgValueNodeEvaluationOptions evalOptions)
     : base(valueNodeFactory, dynamicViewName, valueExpression + ", " + PredefinedFormatSpecifiers.DynamicView, default, evalOptions)
 {
     this.valueNodeProviderFactory = valueNodeProviderFactory;
     this.instanceValue            = instanceValue;
     this.expectedType             = expectedType;
     this.valueExpression          = valueExpression;
     this.appDomain             = appDomain;
     dynamicViewProxyExpression = string.Empty;
 }
Beispiel #4
0
 public abstract DbgDotNetValueNode[] GetChildren(LanguageValueNodeFactory valueNodeFactory, DbgEvaluationInfo evalInfo, ulong index, int count, DbgValueNodeEvaluationOptions options, ReadOnlyCollection <string> formatSpecifiers);
 public ReturnValueColumnFormatter(LanguageValueNodeFactory owner, DmdMethodBase method)
 {
     this.owner  = owner;
     this.method = method;
 }
Beispiel #6
0
 protected DbgDotNetValueNodeProviderFactory(LanguageValueNodeFactory valueNodeFactory, bool isCaseSensitive)
 {
     this.valueNodeFactory = valueNodeFactory ?? throw new ArgumentNullException(nameof(valueNodeFactory));
     stringComparer        = isCaseSensitive ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase;
 }
 public StaticMembersValueNodeProvider(DbgDotNetValueNodeProviderFactory valueNodeProviderFactory, LanguageValueNodeFactory valueNodeFactory, in DbgDotNetText name, string expression, in MemberValueNodeInfoCollection membersCollection, DbgValueNodeEvaluationOptions evalOptions)
 public InstanceMembersValueNodeProvider(LanguageValueNodeFactory valueNodeFactory, in DbgDotNetText name, string expression, bool addParens, DmdType slotType, DbgDotNetValue value, in MemberValueNodeInfoCollection membersCollection, DbgValueNodeEvaluationOptions evalOptions, string imageName)