Exemple #1
0
 internal static string GetExceptionMessage(this DkmClrValue value, string fullNameWithoutFormatSpecifiers, Formatter formatter)
 {
     return string.Format(
         Resources.ExceptionThrown,
         fullNameWithoutFormatSpecifiers,
         formatter.GetTypeName(value.Type.GetLmrType()));
 }
Exemple #2
0
        private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, EvalResultDataItem parent, Formatter formatter)
        {
            Debug.Assert(parent != null);
            var proxyTypeAndInfo     = new TypeAndCustomInfo(_proxyValue.Type);
            var fullName             = parent.ChildFullNamePrefix;
            var sawInvalidIdentifier = false;
            var childFullNamePrefix  = (fullName == null) ?
                                       null :
                                       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.ResultsView,
                       Resources.ResultsView,
                       typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                       declaredTypeAndInfo: proxyTypeAndInfo,
                       parent: null,
                       value: _proxyValue,
                       displayValue: Resources.ResultsViewValueWarning,
                       expansion: _proxyMembers,
                       childShouldParenthesize: false,
                       fullName: fullName,
                       childFullNamePrefixOpt: childFullNamePrefix,
                       formatSpecifiers: Formatter.AddFormatSpecifier(parent.FormatSpecifiers, ResultsFormatSpecifier),
                       category: DkmEvaluationResultCategory.Method,
                       flags: DkmEvaluationResultFlags.ReadOnly,
                       editableValue: null,
                       inspectionContext: inspectionContext));
        }
Exemple #3
0
        private EvalResultDataItem CreateDynamicViewRow(DkmInspectionContext inspectionContext, string name, EvalResultDataItem parent, Formatter formatter)
        {
            var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
            var isRootExpression = parent == null;

            Debug.Assert(isRootExpression != (name == Resources.DynamicView));
            var fullName             = isRootExpression ? name : parent.ChildFullNamePrefix;
            var sawInvalidIdentifier = false;
            var childFullNamePrefix  = (fullName == null) ?
                                       null :
                                       formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out sawInvalidIdentifier), fullName);

            Debug.Assert(!sawInvalidIdentifier); // Expected type name is "Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView".
            var formatSpecifiers = isRootExpression ? Formatter.NoFormatSpecifiers : parent.FormatSpecifiers;

            return(new EvalResultDataItem(
                       ExpansionKind.DynamicView,
                       name,
                       typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                       declaredTypeAndInfo: proxyTypeAndInfo,
                       parent: null,
                       value: _proxyValue,
                       displayValue: Resources.DynamicViewValueWarning,
                       expansion: _proxyMembers,
                       childShouldParenthesize: false,
                       fullName: fullName,
                       childFullNamePrefixOpt: childFullNamePrefix,
                       formatSpecifiers: Formatter.AddFormatSpecifier(formatSpecifiers, DynamicFormatSpecifier),
                       category: DkmEvaluationResultCategory.Method,
                       flags: DkmEvaluationResultFlags.ReadOnly,
                       editableValue: null,
                       inspectionContext: inspectionContext));
        }
        private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, EvalResultDataItem parent, Formatter formatter)
        {
            Debug.Assert(parent != null);
            var proxyType           = _proxyValue.Type.GetLmrType();
            var fullName            = parent.ChildFullNamePrefix;
            var childFullNamePrefix = (fullName == null) ?
                                      null :
                                      formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), fullName);

            return(new EvalResultDataItem(
                       ExpansionKind.ResultsView,
                       Resources.ResultsView,
                       typeDeclaringMember: null,
                       declaredType: proxyType,
                       parent: null,
                       value: _proxyValue,
                       displayValue: Resources.ResultsViewValueWarning,
                       expansion: _proxyMembers,
                       childShouldParenthesize: false,
                       fullName: fullName,
                       childFullNamePrefixOpt: childFullNamePrefix,
                       formatSpecifiers: Formatter.AddFormatSpecifier(parent.FormatSpecifiers, ResultsFormatSpecifier),
                       category: DkmEvaluationResultCategory.Method,
                       flags: DkmEvaluationResultFlags.ReadOnly,
                       editableValue: null,
                       inspectionContext: inspectionContext));
        }
Exemple #5
0
 internal static string GetExceptionMessage(this DkmClrValue value, string fullNameWithoutFormatSpecifiers, Formatter formatter)
 {
     return(string.Format(
                Resources.ExceptionThrown,
                fullNameWithoutFormatSpecifiers,
                formatter.GetTypeName(new TypeAndCustomInfo(value.Type))));
 }
Exemple #6
0
        private static string GetFullName(EvalResultDataItem parent, string name, Formatter formatter)
        {
            var parentFullName = parent.ChildFullNamePrefix;

            if (parentFullName == null)
            {
                return(null);
            }

            if (parent.ChildShouldParenthesize)
            {
                parentFullName = $"({parentFullName})";
            }
            var parentRuntimeType = parent.Value.Type.GetLmrType();

            if (!parent.DeclaredTypeAndInfo.Type.Equals(parentRuntimeType))
            {
                bool sawInvalidIdentifier;
                var  parentTypeName = formatter.GetTypeName(new TypeAndCustomInfo(parentRuntimeType), escapeKeywordIdentifiers: true, sawInvalidIdentifier: out sawInvalidIdentifier);
                if (sawInvalidIdentifier)
                {
                    return(null); // Wouldn't be parseable.
                }

                parentFullName = formatter.GetCastExpression(parentFullName, parentTypeName, parenthesizeEntireExpression: true);
            }
            return(parentFullName + name);
        }
 internal static string GetExceptionMessage(this DkmClrValue value, string fullNameWithoutFormatSpecifiers, Formatter formatter)
 {
     bool unused;
     return string.Format(
         Resources.ExceptionThrown,
         fullNameWithoutFormatSpecifiers,
         formatter.GetTypeName(new TypeAndCustomInfo(value.Type), escapeKeywordIdentifiers: false, sawInvalidIdentifier: out unused));
 }
Exemple #8
0
        internal static string GetExceptionMessage(this DkmClrValue value, string fullNameWithoutFormatSpecifiers, Formatter formatter)
        {
            bool unused;

            return(string.Format(
                       Resources.ExceptionThrown,
                       fullNameWithoutFormatSpecifiers,
                       formatter.GetTypeName(new TypeAndCustomInfo(value.Type), escapeKeywordIdentifiers: false, sawInvalidIdentifier: out unused)));
        }
        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));
        }
Exemple #10
0
        private static string GetFullName(EvalResultDataItem parent, string name, Formatter formatter)
        {
            var parentFullName = parent.ChildFullNamePrefix;

            if (parent.ChildShouldParenthesize)
            {
                parentFullName = $"({parentFullName})";
            }
            var parentRuntimeType = parent.Value.Type.GetLmrType();

            if (!parent.DeclaredType.Equals(parentRuntimeType))
            {
                parentFullName = formatter.GetCastExpression(
                    parentFullName,
                    formatter.GetTypeName(parentRuntimeType, escapeKeywordIdentifiers: true),
                    parenthesizeEntireExpression: true);
            }
            return(parentFullName + name);
        }
Exemple #11
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, EvalResultDataItem parent, Formatter formatter)
 {
     Debug.Assert(parent != null);
     var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
     var fullName = parent.ChildFullNamePrefix;
     bool unused;
     var childFullNamePrefix = (fullName == null) ?
         null :
         formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out unused), fullName);
     return new EvalResultDataItem(
         ExpansionKind.ResultsView,
         Resources.ResultsView,
         typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
         declaredTypeAndInfo: proxyTypeAndInfo,
         parent: null,
         value: _proxyValue,
         displayValue: Resources.ResultsViewValueWarning,
         expansion: _proxyMembers,
         childShouldParenthesize: false,
         fullName: fullName,
         childFullNamePrefixOpt: childFullNamePrefix,
         formatSpecifiers: Formatter.AddFormatSpecifier(parent.FormatSpecifiers, ResultsFormatSpecifier),
         category: DkmEvaluationResultCategory.Method,
         flags: DkmEvaluationResultFlags.ReadOnly,
         editableValue: null,
         inspectionContext: inspectionContext);
 }
        private DebuggerTypeProxyExpansion(
            DkmInspectionContext inspectionContext,
            DkmClrValue proxyValue,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfoOpt,
            TypeAndCustomInfo declaredTypeAndInfo,
            DkmClrValue value,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefix,
            ReadOnlyCollection<string> formatSpecifiers,
            DkmEvaluationResultFlags flags,
            string editableValue,
            Formatter formatter)
        {
            Debug.Assert(proxyValue != null);
            var proxyType = proxyValue.Type.GetLmrType();
            var proxyTypeAndInfo = new TypeAndCustomInfo(proxyType);
            var proxyMembers = MemberExpansion.CreateExpansion(
                inspectionContext,
                proxyTypeAndInfo,
                proxyValue,
                ExpansionFlags.IncludeBaseMembers,
                TypeHelpers.IsPublic,
                formatter);
            if (proxyMembers != null)
            {
                var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ?
                    null :
                    formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true), childFullNamePrefix);
                _proxyItem = new EvalResultDataItem(
                    ExpansionKind.Default,
                    name: string.Empty,
                    typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                    declaredTypeAndInfo: proxyTypeAndInfo,
                    parent: null,
                    value: proxyValue,
                    displayValue: null,
                    expansion: proxyMembers,
                    childShouldParenthesize: false,
                    fullName: null,
                    childFullNamePrefixOpt: proxyMemberFullNamePrefix,
                    formatSpecifiers: Formatter.NoFormatSpecifiers,
                    category: default(DkmEvaluationResultCategory),
                    flags: default(DkmEvaluationResultFlags),
                    editableValue: null,
                    inspectionContext: inspectionContext);
            }

            _name = name;
            _typeDeclaringMemberAndInfoOpt = typeDeclaringMemberAndInfoOpt;
            _declaredTypeAndInfo = declaredTypeAndInfo;
            _value = value;
            _childShouldParenthesize = childShouldParenthesize;
            _fullName = fullName;
            _childFullNamePrefix = childFullNamePrefix;
            _formatSpecifiers = formatSpecifiers;
            _flags = flags;
            _editableValue = editableValue;
        }
Exemple #15
0
 private static string GetFullName(EvalResultDataItem parent, string name, Formatter formatter)
 {
     var parentFullName = parent.ChildFullNamePrefix;
     if (parent.ChildShouldParenthesize)
     {
         parentFullName = $"({parentFullName})";
     }
     var parentRuntimeType = parent.Value.Type.GetLmrType();
     if (!parent.DeclaredTypeAndInfo.Type.Equals(parentRuntimeType))
     {
         parentFullName = formatter.GetCastExpression(
             parentFullName,
             formatter.GetTypeName(new TypeAndCustomInfo(parentRuntimeType), escapeKeywordIdentifiers: true),
             parenthesizeEntireExpression: true);
     }
     return parentFullName + name;
 }
        private DebuggerTypeProxyExpansion(
            DkmClrValue proxyValue,
            string name,
            Type typeDeclaringMemberOpt,
            Type declaredType,
            DkmClrValue value,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefix,
            ReadOnlyCollection <string> formatSpecifiers,
            DkmEvaluationResultFlags flags,
            string editableValue,
            Formatter formatter)
        {
            Debug.Assert(proxyValue != null);
            var proxyType    = proxyValue.Type.GetLmrType();
            var proxyMembers = MemberExpansion.CreateExpansion(
                proxyType,
                proxyValue,
                ExpansionFlags.IncludeBaseMembers,
                TypeHelpers.IsPublic,
                formatter);

            if (proxyMembers != null)
            {
                var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ?
                                                null :
                                                formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), childFullNamePrefix);
                this.proxyItem = new EvalResultDataItem(
                    name: null,
                    typeDeclaringMember: null,
                    declaredType: proxyType,
                    value: proxyValue,
                    expansion: proxyMembers,
                    childShouldParenthesize: false,
                    fullName: null,
                    childFullNamePrefixOpt: proxyMemberFullNamePrefix,
                    formatSpecifiers: Formatter.NoFormatSpecifiers,
                    category: default(DkmEvaluationResultCategory),
                    flags: default(DkmEvaluationResultFlags),
                    editableValue: null);
            }

            this.name = name;
            this.typeDeclaringMemberOpt = typeDeclaringMemberOpt;
            _declaredType = declaredType;
            this.value    = value;
            this.childShouldParenthesize = childShouldParenthesize;
            this.fullName            = fullName;
            this.childFullNamePrefix = childFullNamePrefix;
            this.formatSpecifiers    = formatSpecifiers;
            this.flags         = flags;
            this.editableValue = editableValue;
        }
Exemple #17
0
        private static string MakeFullName(
            Formatter formatter,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfo,
            bool memberAccessRequiresExplicitCast,
            bool memberIsStatic,
            EvalResultDataItem parent)
        {
            // If the parent is an exception thrown during evaluation,
            // there is no valid fullname expression for the child.
            if (parent.Value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown))
            {
                return null;
            }

            var parentFullName = parent.ChildFullNamePrefix;
            if (parentFullName == null)
            {
                return null;
            }

            if (parent.ChildShouldParenthesize)
            {
                parentFullName = $"({parentFullName})";
            }

            if (!typeDeclaringMemberAndInfo.Type.IsInterface)
            {
                string qualifier;
                if (memberIsStatic)
                {
                    qualifier = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: false);
                }
                else if (memberAccessRequiresExplicitCast)
                {
                    var typeName = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: true);
                    qualifier = formatter.GetCastExpression(
                        parentFullName,
                        typeName,
                        parenthesizeEntireExpression: true);
                }
                else
                {
                    qualifier = parentFullName;
                }
                return $"{qualifier}.{name}";
            }
            else
            {
                // NOTE: This should never interact with debugger proxy types:
                //   1) Interfaces cannot have debugger proxy types.
                //   2) Debugger proxy types cannot be interfaces.
                if (typeDeclaringMemberAndInfo.Type.Equals(parent.DeclaredTypeAndInfo.Type))
                {
                    var memberAccessTemplate = parent.ChildShouldParenthesize
                        ? "({0}).{1}"
                        : "{0}.{1}";
                    return string.Format(memberAccessTemplate, parent.ChildFullNamePrefix, name);
                }
                else
                {
                    var interfaceName = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: true);
                    var memberAccessTemplate = parent.ChildShouldParenthesize
                        ? "(({0})({1})).{2}"
                        : "(({0}){1}).{2}";
                    return string.Format(memberAccessTemplate, interfaceName, parent.ChildFullNamePrefix, name);
                }
            }
        }
Exemple #18
0
        private static string MakeFullName(
            Formatter formatter,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfo,
            bool memberAccessRequiresExplicitCast,
            bool memberIsStatic,
            EvalResultDataItem parent)
        {
            // If the parent is an exception thrown during evaluation,
            // there is no valid fullname expression for the child.
            if (parent.Value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown))
            {
                return(null);
            }

            var parentFullName = parent.ChildFullNamePrefix;

            if (parentFullName == null)
            {
                return(null);
            }

            if (parent.ChildShouldParenthesize)
            {
                parentFullName = $"({parentFullName})";
            }

            if (!typeDeclaringMemberAndInfo.Type.IsInterface)
            {
                string qualifier;
                if (memberIsStatic)
                {
                    qualifier = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: false);
                }
                else if (memberAccessRequiresExplicitCast)
                {
                    var typeName = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: true);
                    qualifier = formatter.GetCastExpression(
                        parentFullName,
                        typeName,
                        parenthesizeEntireExpression: true);
                }
                else
                {
                    qualifier = parentFullName;
                }
                return($"{qualifier}.{name}");
            }
            else
            {
                // NOTE: This should never interact with debugger proxy types:
                //   1) Interfaces cannot have debugger proxy types.
                //   2) Debugger proxy types cannot be interfaces.
                if (typeDeclaringMemberAndInfo.Type.Equals(parent.DeclaredTypeAndInfo.Type))
                {
                    var memberAccessTemplate = parent.ChildShouldParenthesize
                        ? "({0}).{1}"
                        : "{0}.{1}";
                    return(string.Format(memberAccessTemplate, parent.ChildFullNamePrefix, name));
                }
                else
                {
                    var interfaceName        = formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: true);
                    var memberAccessTemplate = parent.ChildShouldParenthesize
                        ? "(({0})({1})).{2}"
                        : "(({0}){1}).{2}";
                    return(string.Format(memberAccessTemplate, interfaceName, parent.ChildFullNamePrefix, name));
                }
            }
        }
 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);
 }
        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);
        }
 private EvalResultDataItem CreateDynamicViewRow(DkmInspectionContext inspectionContext, string name, EvalResultDataItem parent, Formatter formatter)
 {
     var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
     var isRootExpression = parent == null;
     Debug.Assert(isRootExpression != (name == Resources.DynamicView));
     var fullName = (!isRootExpression) ? parent.ChildFullNamePrefix : name;
     var childFullNamePrefix = (fullName == null) ?
         null :
         formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true), fullName);
     var formatSpecifiers = (!isRootExpression) ? parent.FormatSpecifiers : Formatter.NoFormatSpecifiers;
     return new EvalResultDataItem(
         ExpansionKind.DynamicView,
         name,
         typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
         declaredTypeAndInfo: proxyTypeAndInfo,
         parent: null,
         value: _proxyValue,
         displayValue: Resources.DynamicViewValueWarning,
         expansion: _proxyMembers,
         childShouldParenthesize: false,
         fullName: fullName,
         childFullNamePrefixOpt: childFullNamePrefix,
         formatSpecifiers: Formatter.AddFormatSpecifier(formatSpecifiers, DynamicFormatSpecifier),
         category: DkmEvaluationResultCategory.Method,
         flags: DkmEvaluationResultFlags.ReadOnly,
         editableValue: null,
         inspectionContext: inspectionContext);
 }
        private DebuggerTypeProxyExpansion(
            DkmInspectionContext inspectionContext,
            DkmClrValue proxyValue,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfoOpt,
            TypeAndCustomInfo declaredTypeAndInfo,
            DkmClrValue value,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefix,
            ReadOnlyCollection <string> formatSpecifiers,
            DkmEvaluationResultFlags flags,
            string editableValue,
            Formatter formatter)
        {
            Debug.Assert(proxyValue != null);
            var proxyType        = proxyValue.Type.GetLmrType();
            var proxyTypeAndInfo = new TypeAndCustomInfo(proxyType);
            var proxyMembers     = MemberExpansion.CreateExpansion(
                inspectionContext,
                proxyTypeAndInfo,
                proxyValue,
                ExpansionFlags.IncludeBaseMembers,
                TypeHelpers.IsPublic,
                formatter);

            if (proxyMembers != null)
            {
                var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ?
                                                null :
                                                formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true), childFullNamePrefix);
                _proxyItem = new EvalResultDataItem(
                    ExpansionKind.Default,
                    name: string.Empty,
                    typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                    declaredTypeAndInfo: proxyTypeAndInfo,
                    parent: null,
                    value: proxyValue,
                    displayValue: null,
                    expansion: proxyMembers,
                    childShouldParenthesize: false,
                    fullName: null,
                    childFullNamePrefixOpt: proxyMemberFullNamePrefix,
                    formatSpecifiers: Formatter.NoFormatSpecifiers,
                    category: default(DkmEvaluationResultCategory),
                    flags: default(DkmEvaluationResultFlags),
                    editableValue: null,
                    inspectionContext: inspectionContext);
            }

            _name = name;
            _typeDeclaringMemberAndInfoOpt = typeDeclaringMemberAndInfoOpt;
            _declaredTypeAndInfo           = declaredTypeAndInfo;
            _value = value;
            _childShouldParenthesize = childShouldParenthesize;
            _fullName            = fullName;
            _childFullNamePrefix = childFullNamePrefix;
            _formatSpecifiers    = formatSpecifiers;
            _flags         = flags;
            _editableValue = editableValue;
        }
        private DebuggerTypeProxyExpansion(
            DkmClrValue proxyValue,
            string name,
            Type typeDeclaringMemberOpt,
            Type declaredType,
            DkmClrValue value,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefix,
            ReadOnlyCollection<string> formatSpecifiers,
            DkmEvaluationResultFlags flags,
            string editableValue,
            Formatter formatter)
        {
            Debug.Assert(proxyValue != null);
            var proxyType = proxyValue.Type.GetLmrType();
            var proxyMembers = MemberExpansion.CreateExpansion(
                proxyType,
                proxyValue,
                ExpansionFlags.IncludeBaseMembers,
                TypeHelpers.IsPublic,
                formatter);
            if (proxyMembers != null)
            {
                var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ?
                    null :
                    formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), childFullNamePrefix);
                this.proxyItem = new EvalResultDataItem(
                    name: null,
                    typeDeclaringMember: null,
                    declaredType: proxyType,
                    value: proxyValue,
                    expansion: proxyMembers,
                    childShouldParenthesize: false,
                    fullName: null,
                    childFullNamePrefixOpt: proxyMemberFullNamePrefix,
                    formatSpecifiers: Formatter.NoFormatSpecifiers,
                    category: default(DkmEvaluationResultCategory),
                    flags: default(DkmEvaluationResultFlags),
                    editableValue: null);
            }

            this.name = name;
            this.typeDeclaringMemberOpt = typeDeclaringMemberOpt;
            _declaredType = declaredType;
            this.value = value;
            this.childShouldParenthesize = childShouldParenthesize;
            this.fullName = fullName;
            this.childFullNamePrefix = childFullNamePrefix;
            this.formatSpecifiers = formatSpecifiers;
            this.flags = flags;
            this.editableValue = editableValue;
        }