public EvalResultDataItem( string name, Type typeDeclaringMember, Type declaredType, DkmClrValue value, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue) { Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); this.NameOpt = name; this.TypeDeclaringMember = typeDeclaringMember; this.DeclaredType = declaredType; this.Value = value; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; }
private DynamicViewExpansion(DkmClrValue proxyValue, Expansion proxyMembers) { Debug.Assert(proxyValue != null); Debug.Assert(proxyMembers != null); _proxyValue = proxyValue; _proxyMembers = proxyMembers; }
public EvalResultDataItem( string name, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, Expansion expansion, bool childShouldParenthesize, string fullNameWithoutFormatSpecifiers, string childFullNamePrefixOpt, ReadOnlyCollection<string> formatSpecifiers) { this.Name = name; this.DeclaredTypeAndInfo = declaredTypeAndInfo; this.Value = value; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullNameWithoutFormatSpecifiers; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Expansion = expansion; }
public EvalResultDataItem( string name, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, Expansion expansion, bool childShouldParenthesize, string fullNameWithoutFormatSpecifiers, string childFullNamePrefixOpt, ReadOnlyCollection <string> formatSpecifiers) { this.Name = name; this.DeclaredTypeAndInfo = declaredTypeAndInfo; this.Value = value; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullNameWithoutFormatSpecifiers; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Expansion = expansion; }
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) { 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.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 == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; this.InspectionContext = inspectionContext; this.DisplayName = displayName; this.DisplayType = displayType; }
public EvalResultDataItem( ExpansionKind kind, string name, Type typeDeclaringMember, Type declaredType, 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.TypeDeclaringMember = typeDeclaringMember; this.DeclaredType = declaredType; 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; }
private static EvalResult GetRow( DkmInspectionContext inspectionContext, DkmClrValue value, Expansion expansion, EvalResultDataItem parent) { return(new EvalResult( ExpansionKind.NonPublicMembers, name: Resources.NonPublicMembers, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: default(TypeAndCustomInfo), useDebuggerDisplay: false, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: parent.ChildShouldParenthesize, fullName: parent.FullNameWithoutFormatSpecifiers, childFullNamePrefixOpt: parent.ChildFullNamePrefix, formatSpecifiers: s_hiddenFormatSpecifiers, category: DkmEvaluationResultCategory.Data, flags: DkmEvaluationResultFlags.ReadOnly, editableValue: null, inspectionContext: inspectionContext)); }
internal IndirectExpansion(DkmClrValue proxyValue, Expansion expansion) { _proxyValue = proxyValue; _expansion = expansion; }
internal NonPublicMembersExpansion(Expansion members) { _members = members; }
internal StaticMembersExpansion(DkmClrType type, Expansion members) { _type = type; _members = members; }
private static EvalResult GetRow( ResultProvider resultProvider, DkmInspectionContext inspectionContext, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, Expansion expansion) { var fullName = resultProvider.FullNameProvider.GetClrTypeName(inspectionContext, declaredTypeAndInfo.ClrType, declaredTypeAndInfo.Info); return new EvalResult( ExpansionKind.StaticMembers, name: resultProvider.StaticMembersString, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: declaredTypeAndInfo, useDebuggerDisplay: false, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: false, fullName: fullName, childFullNamePrefixOpt: fullName, formatSpecifiers: Formatter.NoFormatSpecifiers, category: DkmEvaluationResultCategory.Class, flags: DkmEvaluationResultFlags.ReadOnly, editableValue: null, inspectionContext: inspectionContext); }
private static DkmEvaluationResultFlags GetFlags(DkmClrValue value, DkmInspectionContext inspectionContext, Expansion expansion, bool canFavorite, bool isFavorite) { if (value == null) { return(DkmEvaluationResultFlags.None); } var resultFlags = value.EvalFlags; var type = value.Type.GetLmrType(); if (type.IsBoolean()) { resultFlags |= DkmEvaluationResultFlags.Boolean; if (true.Equals(value.HostObjectValue)) { resultFlags |= DkmEvaluationResultFlags.BooleanTrue; } } if (!value.IsError() && value.HasUnderlyingString(inspectionContext)) { resultFlags |= DkmEvaluationResultFlags.RawString; } // As in the old EE, we won't allow editing members of a DynamicView expansion. if (type.IsDynamicProperty()) { resultFlags |= DkmEvaluationResultFlags.ReadOnly; } if (expansion != null) { resultFlags |= DkmEvaluationResultFlags.Expandable; if (expansion.ContainsFavorites) { resultFlags |= DkmEvaluationResultFlags.HasFavorites; } } if (canFavorite) { resultFlags |= DkmEvaluationResultFlags.CanFavorite; } if (isFavorite) { resultFlags |= DkmEvaluationResultFlags.IsFavorite; } return(resultFlags); }
private static EvalResult GetRow( DkmInspectionContext inspectionContext, DkmClrValue value, Expansion expansion, EvalResultDataItem parent) { return new EvalResult( ExpansionKind.NonPublicMembers, name: Resources.NonPublicMembers, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: default(TypeAndCustomInfo), useDebuggerDisplay: false, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: parent.ChildShouldParenthesize, fullName: parent.FullNameWithoutFormatSpecifiers, childFullNamePrefixOpt: parent.ChildFullNamePrefix, formatSpecifiers: s_hiddenFormatSpecifiers, category: DkmEvaluationResultCategory.Data, flags: DkmEvaluationResultFlags.ReadOnly, editableValue: null, inspectionContext: inspectionContext); }
internal AggregateExpansion(Expansion[] expansions) { _expansions = expansions; }
internal StaticMembersExpansion(Type runtimeType, Expansion members) { _runtimeType = runtimeType; _members = members; }
private static EvalResultDataItem GetRow( ResultProvider resultProvider, DkmInspectionContext inspectionContext, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, Expansion expansion) { var formatter = resultProvider.Formatter; var fullName = formatter.GetTypeName(declaredTypeAndInfo, escapeKeywordIdentifiers: true); return new EvalResultDataItem( ExpansionKind.StaticMembers, name: formatter.StaticMembersString, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: declaredTypeAndInfo, parent: null, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: false, fullName: fullName, childFullNamePrefixOpt: fullName, formatSpecifiers: Formatter.NoFormatSpecifiers, category: DkmEvaluationResultCategory.Class, flags: DkmEvaluationResultFlags.ReadOnly, editableValue: null, inspectionContext: inspectionContext); }
internal static Expansion CreateExpansion( DkmInspectionContext inspectionContext, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, ExpansionFlags flags, Predicate <MemberInfo> predicate, ResultProvider resultProvider, bool isProxyType, bool supportsFavorites ) { // For members of type DynamicProperty (part of Dynamic View expansion), we want // to expand the underlying value (not the members of the DynamicProperty type). var type = value.Type; var runtimeType = type.GetLmrType(); var isDynamicProperty = runtimeType.IsDynamicProperty(); if (isDynamicProperty) { Debug.Assert(!value.IsNull); value = value.GetFieldValue("value", inspectionContext); } // Primitives, enums, function pointers, IntPtr, UIntPtr and null values with a declared type that is an interface have no visible members. Debug.Assert(!runtimeType.IsInterface || value.IsNull); if ( resultProvider.IsPrimitiveType(runtimeType) || runtimeType.IsEnum || runtimeType.IsInterface || runtimeType.IsFunctionPointer() || runtimeType.IsIntPtr() || runtimeType.IsUIntPtr() ) { return(null); } // As in the old C# EE, DynamicProperty members are only expandable if they have a Dynamic View expansion. var dynamicViewExpansion = DynamicViewExpansion.CreateExpansion( inspectionContext, value, resultProvider ); if (isDynamicProperty && (dynamicViewExpansion == null)) { return(null); } var customTypeInfoMap = CustomTypeInfoTypeArgumentMap.Create(declaredTypeAndInfo); var expansions = ArrayBuilder <Expansion> .GetInstance(); // Expand members. TODO: Ideally, this would be done lazily (https://github.com/dotnet/roslyn/issues/32800) // From the members, collect the fields and properties, // separated into static and instance members. var staticMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); var instanceMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); var appDomain = value.Type.AppDomain; var allMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); var includeInherited = (flags & ExpansionFlags.IncludeBaseMembers) == ExpansionFlags.IncludeBaseMembers; var hideNonPublic = (inspectionContext.EvaluationFlags & DkmEvaluationFlags.HideNonPublicMembers) == DkmEvaluationFlags.HideNonPublicMembers; var includeCompilerGenerated = (inspectionContext.EvaluationFlags & DkmEvaluationFlags.ShowValueRaw) == DkmEvaluationFlags.ShowValueRaw; var favoritesInfo = supportsFavorites ? type.GetFavorites() : null; runtimeType.AppendTypeMembers( allMembers, predicate, declaredTypeAndInfo.Type, appDomain, includeInherited, hideNonPublic, isProxyType, includeCompilerGenerated, supportsFavorites, favoritesInfo ); var favoritesMembersByName = new Dictionary <string, MemberAndDeclarationInfo>(); foreach (var member in allMembers) { // Favorites are currently never static if (member.IsFavorite && !value.IsNull) { favoritesMembersByName.Add(member.Name, member); } else if (member.IsStatic) { staticMembers.Add(member); } else if (!value.IsNull) { instanceMembers.Add(member); } } allMembers.Free(); // Favorites members. Expansion favoritesExpansion = null; if (favoritesMembersByName.Count > 0) { var favoritesMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); foreach (string name in favoritesInfo.Favorites) { if (favoritesMembersByName.TryGetValue(name, out var memberAndDeclarationInfo)) { favoritesMembers.Add(memberAndDeclarationInfo); } } if (favoritesMembers.Count > 0) { favoritesExpansion = new MemberExpansion( favoritesMembers.ToArrayAndFree(), customTypeInfoMap, containsFavorites: true ); } } if (favoritesExpansion != null) { expansions.Add(favoritesExpansion); // Check if we are only expanding favorites. if ( (inspectionContext.EvaluationFlags & DkmEvaluationFlags.FilterToFavorites) == DkmEvaluationFlags.FilterToFavorites ) { instanceMembers.Free(); staticMembers.Free(); expansions.Free(); return(favoritesExpansion); } } // Public and non-public instance members. Expansion publicInstanceExpansion; Expansion nonPublicInstanceExpansion; GetPublicAndNonPublicMembers( instanceMembers, customTypeInfoMap, isProxyType, out publicInstanceExpansion, out nonPublicInstanceExpansion ); // Public and non-public static members. Expansion publicStaticExpansion; Expansion nonPublicStaticExpansion; GetPublicAndNonPublicMembers( staticMembers, customTypeInfoMap, isProxyType, out publicStaticExpansion, out nonPublicStaticExpansion ); if (publicInstanceExpansion != null) { expansions.Add(publicInstanceExpansion); } if ((publicStaticExpansion != null) || (nonPublicStaticExpansion != null)) { var staticExpansions = ArrayBuilder <Expansion> .GetInstance(); if (publicStaticExpansion != null) { staticExpansions.Add(publicStaticExpansion); } if (nonPublicStaticExpansion != null) { staticExpansions.Add(nonPublicStaticExpansion); } Debug.Assert(staticExpansions.Count > 0); var staticMembersExpansion = new StaticMembersExpansion( type, AggregateExpansion.CreateExpansion(staticExpansions) ); staticExpansions.Free(); expansions.Add(staticMembersExpansion); } instanceMembers.Free(); staticMembers.Free(); if (value.NativeComPointer != 0) { expansions.Add(NativeViewExpansion.Instance); } if (nonPublicInstanceExpansion != null) { expansions.Add(nonPublicInstanceExpansion); } // Include Results View if necessary. if ((flags & ExpansionFlags.IncludeResultsView) != 0) { var resultsViewExpansion = ResultsViewExpansion.CreateExpansion( inspectionContext, value, resultProvider ); if (resultsViewExpansion != null) { expansions.Add(resultsViewExpansion); } } if (dynamicViewExpansion != null) { expansions.Add(dynamicViewExpansion); } var result = AggregateExpansion.CreateExpansion(expansions); expansions.Free(); return(result); }
private static void GetPublicAndNonPublicMembers( ArrayBuilder <MemberAndDeclarationInfo> allMembers, CustomTypeInfoTypeArgumentMap customTypeInfoMap, bool isProxyType, out Expansion publicExpansion, out Expansion nonPublicExpansion ) { var publicExpansions = ArrayBuilder <Expansion> .GetInstance(); var publicMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); var nonPublicMembers = ArrayBuilder <MemberAndDeclarationInfo> .GetInstance(); foreach (var member in allMembers) { if (member.BrowsableState.HasValue) { switch (member.BrowsableState.Value) { case DkmClrDebuggerBrowsableAttributeState.RootHidden: if (publicMembers.Count > 0) { publicExpansions.Add( new MemberExpansion(publicMembers.ToArray(), customTypeInfoMap) ); publicMembers.Clear(); } publicExpansions.Add( new RootHiddenExpansion(member, customTypeInfoMap) ); continue; case DkmClrDebuggerBrowsableAttributeState.Never: continue; } } // The native EE shows proxy type members as public members if they have a // DebuggerBrowsable attribute of any value. Match that behaviour here. if ( member.HideNonPublic && !member.IsPublic && (!isProxyType || !member.BrowsableState.HasValue) ) { nonPublicMembers.Add(member); } else { publicMembers.Add(member); } } if (publicMembers.Count > 0) { publicExpansions.Add( new MemberExpansion(publicMembers.ToArray(), customTypeInfoMap) ); } publicMembers.Free(); publicExpansion = AggregateExpansion.CreateExpansion(publicExpansions); publicExpansions.Free(); nonPublicExpansion = (nonPublicMembers.Count > 0) ? new NonPublicMembersExpansion( members: new MemberExpansion( nonPublicMembers.ToArray(), customTypeInfoMap ) ) : null; nonPublicMembers.Free(); }
internal StaticMembersExpansion(Type declaredType, Expansion members) { this.declaredType = declaredType; this.members = members; }
private static void GetPublicAndNonPublicMembers( ArrayBuilder<MemberAndDeclarationInfo> allMembers, CustomTypeInfoTypeArgumentMap customTypeInfoMap, out Expansion publicExpansion, out Expansion nonPublicExpansion) { var publicExpansions = ArrayBuilder<Expansion>.GetInstance(); var publicMembers = ArrayBuilder<MemberAndDeclarationInfo>.GetInstance(); var nonPublicMembers = ArrayBuilder<MemberAndDeclarationInfo>.GetInstance(); foreach (var member in allMembers) { if (member.BrowsableState.HasValue) { switch (member.BrowsableState.Value) { case DkmClrDebuggerBrowsableAttributeState.RootHidden: if (publicMembers.Count > 0) { publicExpansions.Add(new MemberExpansion(publicMembers.ToArray(), customTypeInfoMap)); publicMembers.Clear(); } publicExpansions.Add(new RootHiddenExpansion(member, customTypeInfoMap)); continue; case DkmClrDebuggerBrowsableAttributeState.Never: continue; } } if (member.HideNonPublic && !member.IsPublic) { nonPublicMembers.Add(member); } else { publicMembers.Add(member); } } if (publicMembers.Count > 0) { publicExpansions.Add(new MemberExpansion(publicMembers.ToArray(), customTypeInfoMap)); } publicMembers.Free(); publicExpansion = AggregateExpansion.CreateExpansion(publicExpansions); publicExpansions.Free(); nonPublicExpansion = (nonPublicMembers.Count > 0) ? new NonPublicMembersExpansion( members: new MemberExpansion(nonPublicMembers.ToArray(), customTypeInfoMap)) : null; nonPublicMembers.Free(); }
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; }
internal StaticMembersExpansion(Type declaredType, Expansion members) { _declaredType = declaredType; _members = members; }