private DkmEvaluationResult CreateRawViewRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext)
        {
            var dataItem = new EvalResultDataItem(
                this.name,
                this.typeDeclaringMemberOpt,
                _declaredType,
                this.value,
                CreateRawView(resultProvider, inspectionContext, _declaredType, this.value),
                this.childShouldParenthesize,
                this.fullName,
                this.childFullNamePrefix,
                Formatter.AddFormatSpecifier(this.formatSpecifiers, "raw"),
                DkmEvaluationResultCategory.Data,
                this.flags | DkmEvaluationResultFlags.ReadOnly,
                this.editableValue);

            return(ResultProvider.CreateEvaluationResult(
                       value,
                       Resources.RawView,
                       typeName: "",
                       display: null,
                       dataItem: dataItem));
        }
Esempio n. 2
0
            private static DkmEvaluationResult GetRow(
                ResultProvider resultProvider,
                Type declaredType,
                DkmClrValue value,
                Expansion expansion,
                EvalResultDataItem parent)
            {
                var dataItem = new EvalResultDataItem(
                    name: null,
                    typeDeclaringMember: null,
                    declaredType: declaredType,
                    value: value,
                    expansion: expansion,
                    childShouldParenthesize: parent.ChildShouldParenthesize,
                    fullName: parent.FullNameWithoutFormatSpecifiers,
                    childFullNamePrefixOpt: parent.ChildFullNamePrefix,
                    formatSpecifiers: HiddenFormatSpecifiers,
                    category: DkmEvaluationResultCategory.Data,
                    flags: DkmEvaluationResultFlags.ReadOnly,
                    editableValue: null);

                return(ResultProvider.CreateEvaluationResult(
                           value,
                           Resources.NonPublicMembers,
                           typeName: "",
                           display: null,
                           dataItem: dataItem));
            }
Esempio n. 3
0
            private static DkmEvaluationResult GetRow(
                ResultProvider resultProvider,
                Type declaredType,
                DkmClrValue value,
                Expansion expansion)
            {
                var formatter = resultProvider.Formatter;
                var fullName  = formatter.GetTypeName(declaredType, escapeKeywordIdentifiers: true);
                var dataItem  = new EvalResultDataItem(
                    name: null,
                    typeDeclaringMember: null,
                    declaredType: declaredType,
                    value: value,
                    expansion: expansion,
                    childShouldParenthesize: false,
                    fullName: fullName,
                    childFullNamePrefixOpt: fullName,
                    formatSpecifiers: Formatter.NoFormatSpecifiers,
                    category: DkmEvaluationResultCategory.Class,
                    flags: DkmEvaluationResultFlags.ReadOnly,
                    editableValue: null);

                return(ResultProvider.CreateEvaluationResult(
                           value,
                           formatter.StaticMembersString,
                           typeName: "",
                           display: null,
                           dataItem: dataItem));
            }
Esempio n. 4
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));
        }
        private DkmEvaluationResult CreateEvaluationResult(string name, EvalResultDataItem parent, Formatter formatter)
        {
            var    proxyType = _proxyValue.Type.GetLmrType();
            string fullName;
            ReadOnlyCollection <string> formatSpecifiers;
            bool childShouldParenthesize;

            if (parent == null)
            {
                Debug.Assert(name != null);
                fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);
                childShouldParenthesize = formatter.NeedsParentheses(fullName);
            }
            else
            {
                fullName                = parent.ChildFullNamePrefix;
                formatSpecifiers        = parent.FormatSpecifiers;
                childShouldParenthesize = false;
            }

            var childFullNamePrefix = (fullName == null) ?
                                      null :
                                      formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), fullName);
            var dataItem = new EvalResultDataItem(
                name: name,
                typeDeclaringMember: null,
                declaredType: proxyType,
                value: _proxyValue,
                expansion: _proxyMembers,
                childShouldParenthesize: childShouldParenthesize,
                fullName: fullName,
                childFullNamePrefixOpt: childFullNamePrefix,
                formatSpecifiers: Formatter.AddFormatSpecifier(formatSpecifiers, "results"),
                category: DkmEvaluationResultCategory.Method,
                flags: DkmEvaluationResultFlags.ReadOnly,
                editableValue: null);

            return(ResultProvider.CreateEvaluationResult(
                       value: _proxyValue,
                       name: name,
                       typeName: string.Empty,
                       display: Resources.ResultsViewValueWarning,
                       dataItem: dataItem));
        }