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));
        }
Esempio n. 2
0
        private EvalResultDataItem CreateResultsViewRow(
            DkmInspectionContext inspectionContext,
            string name,
            TypeAndCustomInfo declaredTypeAndInfo,
            DkmClrValue value,
            bool includeResultsFormatSpecifier,
            Formatter formatter)
        {
            var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
            ReadOnlyCollection <string> formatSpecifiers;
            var fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);

            if (includeResultsFormatSpecifier)
            {
                formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, ResultsFormatSpecifier);
            }
            bool sawInvalidIdentifier;
            var  childFullNamePrefix = formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out sawInvalidIdentifier), fullName);

            Debug.Assert(!sawInvalidIdentifier); // Expected proxy type name is "System.Linq.SystemCore_EnumerableDebugView".
            return(new EvalResultDataItem(
                       ExpansionKind.Default,
                       name,
                       typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                       declaredTypeAndInfo: declaredTypeAndInfo,
                       parent: null,
                       value: value,
                       displayValue: null,
                       expansion: new IndirectExpansion(_proxyValue, _proxyMembers),
                       childShouldParenthesize: false,
                       fullName: fullName,
                       childFullNamePrefixOpt: childFullNamePrefix,
                       formatSpecifiers: formatSpecifiers,
                       category: DkmEvaluationResultCategory.Method,
                       flags: DkmEvaluationResultFlags.ReadOnly,
                       editableValue: null,
                       inspectionContext: inspectionContext));
        }
        private EvalResultDataItem CreateResultsViewRow(
            DkmInspectionContext inspectionContext,
            string name,
            Type declaredType,
            DkmClrValue value,
            bool includeResultsFormatSpecifier,
            Formatter formatter)
        {
            var proxyType = _proxyValue.Type.GetLmrType();
            ReadOnlyCollection <string> formatSpecifiers;
            var fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);

            if (includeResultsFormatSpecifier)
            {
                formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, ResultsFormatSpecifier);
            }
            var childFullNamePrefix = formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), fullName);

            return(new EvalResultDataItem(
                       ExpansionKind.Default,
                       name,
                       typeDeclaringMember: null,
                       declaredType: declaredType,
                       parent: null,
                       value: value,
                       displayValue: name,
                       expansion: new IndirectExpansion(_proxyValue, _proxyMembers),
                       childShouldParenthesize: false,
                       fullName: fullName,
                       childFullNamePrefixOpt: childFullNamePrefix,
                       formatSpecifiers: formatSpecifiers,
                       category: DkmEvaluationResultCategory.Method,
                       flags: DkmEvaluationResultFlags.ReadOnly,
                       editableValue: null,
                       inspectionContext: inspectionContext));
        }
 private EvalResultDataItem CreateResultsViewRow(
     DkmInspectionContext inspectionContext,
     string name,
     TypeAndCustomInfo declaredTypeAndInfo,
     DkmClrValue value,
     bool includeResultsFormatSpecifier,
     Formatter formatter)
 {
     var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
     ReadOnlyCollection<string> formatSpecifiers;
     var fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);
     if (includeResultsFormatSpecifier)
     {
         formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, ResultsFormatSpecifier);
     }
     bool unused;
     var childFullNamePrefix = formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out unused), fullName);
     return new EvalResultDataItem(
         ExpansionKind.Default,
         name,
         typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
         declaredTypeAndInfo: declaredTypeAndInfo,
         parent: null,
         value: value,
         displayValue: null,
         expansion: new IndirectExpansion(_proxyValue, _proxyMembers),
         childShouldParenthesize: false,
         fullName: fullName,
         childFullNamePrefixOpt: childFullNamePrefix,
         formatSpecifiers: formatSpecifiers,
         category: DkmEvaluationResultCategory.Method,
         flags: DkmEvaluationResultFlags.ReadOnly,
         editableValue: null,
         inspectionContext: inspectionContext);
 }
Esempio n. 5
0
        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);
        }