Exemplo n.º 1
0
        public EvalResult(
            ExpansionKind kind,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfo,
            TypeAndCustomInfo declaredTypeAndInfo,
            bool useDebuggerDisplay,
            DkmClrValue value,
            string displayValue,
            Expansion expansion,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefixOpt,
            ReadOnlyCollection <string> formatSpecifiers,
            DkmEvaluationResultCategory category,
            DkmEvaluationResultFlags flags,
            string editableValue,
            DkmInspectionContext inspectionContext,
            string displayName = null,
            string displayType = null,
            bool canFavorite   = false,
            bool isFavorite    = false
            )
        {
            Debug.Assert(name != null);
            Debug.Assert(formatSpecifiers != null);
            Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);

            m_rawFlags = flags;

            this.Kind = kind;
            this.Name = name;
            this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo;
            this.DeclaredTypeAndInfo        = declaredTypeAndInfo;
            this.UseDebuggerDisplay         = useDebuggerDisplay;
            this.Value                           = value;
            this.DisplayValue                    = displayValue;
            this.ChildShouldParenthesize         = childShouldParenthesize;
            this.FullNameWithoutFormatSpecifiers = fullName;
            this.ChildFullNamePrefix             = childFullNamePrefixOpt;
            this.FormatSpecifiers                = formatSpecifiers;
            this.Category                        = category;
            this.EditableValue                   = editableValue;
            this.Flags                           =
                flags | GetFlags(value, inspectionContext, expansion, canFavorite, isFavorite);
            this.Expansion         = expansion;
            this.InspectionContext = inspectionContext;
            this.DisplayName       = displayName;
            this.DisplayType       = displayType;
            this.CanFavorite       = canFavorite;
            this.IsFavorite        = isFavorite;
        }
Exemplo n.º 2
0
        public EvalResultDataItem(
            ExpansionKind kind,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfo,
            TypeAndCustomInfo declaredTypeAndInfo,
            EvalResultDataItem parent,
            DkmClrValue value,
            string displayValue,
            Expansion expansion,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefixOpt,
            ReadOnlyCollection <string> formatSpecifiers,
            DkmEvaluationResultCategory category,
            DkmEvaluationResultFlags flags,
            string editableValue,
            DkmInspectionContext inspectionContext)
        {
            Debug.Assert(name != null);
            Debug.Assert(formatSpecifiers != null);
            Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);

            this.Kind = kind;
            this.Name = name;
            this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo;
            this.DeclaredTypeAndInfo        = declaredTypeAndInfo;
            this.Parent                          = parent;
            this.Value                           = value;
            this.DisplayValue                    = displayValue;
            this.ChildShouldParenthesize         = childShouldParenthesize;
            this.FullNameWithoutFormatSpecifiers = fullName;
            this.ChildFullNamePrefix             = childFullNamePrefixOpt;
            this.FormatSpecifiers                = formatSpecifiers;
            this.Category                        = category;
            this.EditableValue                   = editableValue;
            this.Flags                           = flags | GetFlags(value, inspectionContext) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable);
            this.Expansion                       = expansion;
        }
 /// <returns>
 /// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
 /// or array type followed by the qualified name of the actual runtime type, if provided.
 /// </returns>
 private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, ExpansionKind kind)
 {
     var declaredLmrType = declaredType.GetLmrType();
     var runtimeType = value.Type;
     var runtimeLmrType = runtimeType.GetLmrType();
     var declaredTypeName = inspectionContext.GetTypeName(declaredType, declaredTypeInfo, Formatter.NoFormatSpecifiers);
     var runtimeTypeName = inspectionContext.GetTypeName(runtimeType, CustomTypeInfo: null, FormatSpecifiers: Formatter.NoFormatSpecifiers);
     var includeRuntimeTypeName =
         !string.Equals(declaredTypeName, runtimeTypeName, StringComparison.OrdinalIgnoreCase) && // Names will reflect "dynamic", types will not.
         !declaredLmrType.IsPointer &&
         (kind != ExpansionKind.PointerDereference) &&
         (!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown));
     return includeRuntimeTypeName ?
         string.Format("{0} {{{1}}}", declaredTypeName, runtimeTypeName) :
         declaredTypeName;
 }
Exemplo n.º 4
0
        /// <returns>
        /// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
        /// or array type followed by the qualified name of the actual runtime type, if provided.
        /// </returns>
        private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, ExpansionKind kind)
        {
            var declaredLmrType        = declaredType.GetLmrType();
            var runtimeType            = value.Type;
            var runtimeLmrType         = runtimeType.GetLmrType();
            var includeRuntimeTypeName =
                !declaredLmrType.Equals(runtimeLmrType) &&
                !declaredLmrType.IsPointer &&
                (kind != ExpansionKind.PointerDereference) &&
                (!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown));
            var declaredTypeName = inspectionContext.GetTypeName(declaredType, Formatter.NoFormatSpecifiers);

            return(includeRuntimeTypeName ?
                   string.Format("{0} {{{1}}}", declaredTypeName, inspectionContext.GetTypeName(runtimeType, Formatter.NoFormatSpecifiers)) :
                   declaredTypeName);
        }
Exemplo n.º 5
0
        /// <returns>
        /// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
        /// or array type followed by the qualified name of the actual runtime type, if provided.
        /// </returns>
        private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, ExpansionKind kind)
        {
            var declaredLmrType  = declaredType.GetLmrType();
            var runtimeType      = value.Type;
            var declaredTypeName = inspectionContext.GetTypeName(declaredType, declaredTypeInfo, Formatter.NoFormatSpecifiers);

            // Include the runtime type if distinct.
            if (!declaredLmrType.IsPointer &&
                (kind != ExpansionKind.PointerDereference) &&
                (!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown)))
            {
                // Generate the declared type name without tuple element names.
                var declaredTypeInfoNoTupleElementNames = declaredTypeInfo.WithNoTupleElementNames();
                var declaredTypeNameNoTupleElementNames = (declaredTypeInfo == declaredTypeInfoNoTupleElementNames) ?
                                                          declaredTypeName :
                                                          inspectionContext.GetTypeName(declaredType, declaredTypeInfoNoTupleElementNames, Formatter.NoFormatSpecifiers);
                // Generate the runtime type name with no tuple element names and no dynamic.
                var runtimeTypeName = inspectionContext.GetTypeName(runtimeType, null, FormatSpecifiers: Formatter.NoFormatSpecifiers);
                // If the two names are distinct, include both.
                if (!string.Equals(declaredTypeNameNoTupleElementNames, runtimeTypeName, StringComparison.Ordinal)) // Names will reflect "dynamic", types will not.
                {
                    return(string.Format("{0} {{{1}}}", declaredTypeName, runtimeTypeName));
                }
            }
            return(declaredTypeName);
        }
Exemplo n.º 6
0
        /// <returns>
        /// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
        /// or array type followed by the qualified name of the actual runtime type, if provided.
        /// </returns>
        private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, ExpansionKind kind)
        {
            var declaredLmrType        = declaredType.GetLmrType();
            var runtimeType            = value.Type;
            var runtimeLmrType         = runtimeType.GetLmrType();
            var declaredTypeName       = inspectionContext.GetTypeName(declaredType, declaredTypeInfo, Formatter.NoFormatSpecifiers);
            var runtimeTypeName        = inspectionContext.GetTypeName(runtimeType, CustomTypeInfo: null, FormatSpecifiers: Formatter.NoFormatSpecifiers);
            var includeRuntimeTypeName =
                !string.Equals(declaredTypeName, runtimeTypeName, StringComparison.OrdinalIgnoreCase) && // Names will reflect "dynamic", types will not.
                !declaredLmrType.IsPointer &&
                (kind != ExpansionKind.PointerDereference) &&
                (!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown));

            return(includeRuntimeTypeName ?
                   string.Format("{0} {{{1}}}", declaredTypeName, runtimeTypeName) :
                   declaredTypeName);
        }
Exemplo n.º 7
0
        public EvalResultDataItem(
            ExpansionKind kind,
            string name,
            TypeAndCustomInfo typeDeclaringMemberAndInfo,
            TypeAndCustomInfo declaredTypeAndInfo,
            EvalResultDataItem parent,
            DkmClrValue value,
            string displayValue,
            Expansion expansion,
            bool childShouldParenthesize,
            string fullName,
            string childFullNamePrefixOpt,
            ReadOnlyCollection<string> formatSpecifiers,
            DkmEvaluationResultCategory category,
            DkmEvaluationResultFlags flags,
            string editableValue,
            DkmInspectionContext inspectionContext)
        {
            Debug.Assert(name != null);
            Debug.Assert(formatSpecifiers != null);
            Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);

            this.Kind = kind;
            this.Name = name;
            this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo;
            this.DeclaredTypeAndInfo = declaredTypeAndInfo;
            this.Parent = parent;
            this.Value = value;
            this.DisplayValue = displayValue;
            this.ChildShouldParenthesize = childShouldParenthesize;
            this.FullNameWithoutFormatSpecifiers = fullName;
            this.ChildFullNamePrefix = childFullNamePrefixOpt;
            this.FormatSpecifiers = formatSpecifiers;
            this.Category = category;
            this.EditableValue = editableValue;
            this.Flags = flags | GetFlags(value, inspectionContext) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable);
            this.Expansion = expansion;
        }
Exemplo n.º 8
0
 /// <returns>
 /// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
 /// or array type followed by the qualified name of the actual runtime type, if provided.
 /// </returns>
 private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, ExpansionKind kind)
 {
     var declaredLmrType = declaredType.GetLmrType();
     var runtimeType = value.Type;
     var declaredTypeName = inspectionContext.GetTypeName(declaredType, declaredTypeInfo, Formatter.NoFormatSpecifiers);
     // Include the runtime type if distinct.
     if (!declaredLmrType.IsPointer &&
         (kind != ExpansionKind.PointerDereference) &&
         (!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown)))
     {
         // Generate the declared type name without tuple element names.
         var declaredTypeInfoNoTupleElementNames = declaredTypeInfo.WithNoTupleElementNames();
         var declaredTypeNameNoTupleElementNames = (declaredTypeInfo == declaredTypeInfoNoTupleElementNames) ?
             declaredTypeName :
             inspectionContext.GetTypeName(declaredType, declaredTypeInfoNoTupleElementNames, Formatter.NoFormatSpecifiers);
         // Generate the runtime type name with no tuple element names and no dynamic.
         var runtimeTypeName = inspectionContext.GetTypeName(runtimeType, null, FormatSpecifiers: Formatter.NoFormatSpecifiers);
         // If the two names are distinct, include both.
         if (!string.Equals(declaredTypeNameNoTupleElementNames, runtimeTypeName, StringComparison.Ordinal)) // Names will reflect "dynamic", types will not.
         {
             return string.Format("{0} {{{1}}}", declaredTypeName, runtimeTypeName);
         }
     }
     return declaredTypeName;
 }