Пример #1
0
        private static EvalResult GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue pointer,
            TypeAndCustomInfo elementTypeAndInfo,
            EvalResultDataItem parent
            )
        {
            var value = pointer.Dereference(inspectionContext);
            var wasExceptionThrown = value.EvalFlags.Includes(
                DkmEvaluationResultFlags.ExceptionThrown
                );

            var expansion = wasExceptionThrown
                ? null
                : resultProvider.GetTypeExpansion(
                inspectionContext,
                elementTypeAndInfo,
                value,
                ExpansionFlags.None,
                supportsFavorites: false
                );
            var parentFullName = parent.ChildFullNamePrefix;
            var fullName       = parentFullName == null ? null : $"*{parentFullName}";
            var editableValue  = resultProvider.Formatter2.GetEditableValueString(
                value,
                inspectionContext,
                elementTypeAndInfo.Info
                );

            // NB: Full name is based on the real (i.e. not DebuggerDisplay) name.  This is a change from dev12,
            // which used the DebuggerDisplay name, causing surprising results in "Add Watch" scenarios.
            return(new EvalResult(
                       ExpansionKind.PointerDereference,
                       name: fullName ?? $"*{parent.Name}",
                       typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                       declaredTypeAndInfo: elementTypeAndInfo,
                       useDebuggerDisplay: false,
                       value: value,
                       displayValue: wasExceptionThrown
                  ? string.Format(Resources.InvalidPointerDereference, fullName ?? parent.Name)
                  : null,
                       expansion: expansion,
                       childShouldParenthesize: true,
                       fullName: fullName,
                       childFullNamePrefixOpt: fullName,
                       formatSpecifiers: Formatter.NoFormatSpecifiers,
                       category: DkmEvaluationResultCategory.Other,
                       flags: DkmEvaluationResultFlags.None,
                       editableValue: editableValue,
                       inspectionContext: inspectionContext
                       ));
        }
Пример #2
0
        private static DkmEvaluationResult GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue pointer,
            Type elementType,
            EvalResultDataItem parent)
        {
            var value              = pointer.Dereference();
            var valueType          = value.Type.GetLmrType();
            var wasExceptionThrown = value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown);

            string debuggerDisplayName;
            string debuggerDisplayValue;
            string debuggerDisplayType;

            value.GetDebuggerDisplayStrings(out debuggerDisplayName, out debuggerDisplayValue, out debuggerDisplayType);

            var declaredType = elementType;
            var typeName     = debuggerDisplayType ?? pointer.InspectionContext.GetTypeName(DkmClrType.Create(pointer.Type.AppDomain, declaredType));
            var expansion    = wasExceptionThrown
                ? null
                : resultProvider.GetTypeExpansion(inspectionContext, declaredType, value, ExpansionFlags.None);
            var fullName      = string.Format("*{0}", parent.ChildFullNamePrefix);
            var editableValue = resultProvider.Formatter.GetEditableValue(value);

            // NB: Full name is based on the real (i.e. not DebuggerDisplay) name.  This is a change from dev12,
            // which used the DebuggerDisplay name, causing surprising results in "Add Watch" scenarios.
            var dataItem = new EvalResultDataItem(
                name: null, // Okay for pointer dereferences.
                typeDeclaringMember: null,
                declaredType: declaredType,
                value: value,
                expansion: expansion,
                childShouldParenthesize: true,
                fullName: fullName,
                childFullNamePrefixOpt: fullName,
                formatSpecifiers: Formatter.NoFormatSpecifiers,
                category: DkmEvaluationResultCategory.Other,
                flags: DkmEvaluationResultFlags.None,
                editableValue: editableValue);

            var name    = debuggerDisplayName ?? fullName;
            var display = debuggerDisplayValue ??
                          (wasExceptionThrown ? string.Format(Resources.InvalidPointerDereference, fullName) : value.GetValueString());

            return(ResultProvider.CreateEvaluationResult(
                       value,
                       name,
                       typeName,
                       display,
                       dataItem));
        }
Пример #3
0
        private static EvalResultDataItem GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue pointer,
            Type elementType,
            EvalResultDataItem parent)
        {
            var value = pointer.Dereference(inspectionContext);
            var wasExceptionThrown = value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown);

            var declaredType = elementType;
            var expansion    = wasExceptionThrown ?
                               null :
                               resultProvider.GetTypeExpansion(inspectionContext, declaredType, value, ExpansionFlags.None);
            var fullName      = string.Format("*{0}", parent.ChildFullNamePrefix);
            var editableValue = resultProvider.Formatter.GetEditableValue(value, inspectionContext);

            // NB: Full name is based on the real (i.e. not DebuggerDisplay) name.  This is a change from dev12,
            // which used the DebuggerDisplay name, causing surprising results in "Add Watch" scenarios.
            return(new EvalResultDataItem(
                       ExpansionKind.PointerDereference,
                       name: fullName,
                       typeDeclaringMember: null,
                       declaredType: declaredType,
                       parent: null,
                       value: value,
                       displayValue: wasExceptionThrown ? string.Format(Resources.InvalidPointerDereference, fullName) : null,
                       expansion: expansion,
                       childShouldParenthesize: true,
                       fullName: fullName,
                       childFullNamePrefixOpt: fullName,
                       formatSpecifiers: Formatter.NoFormatSpecifiers,
                       category: DkmEvaluationResultCategory.Other,
                       flags: DkmEvaluationResultFlags.None,
                       editableValue: editableValue,
                       inspectionContext: inspectionContext));
        }