/// <summary> /// Extracts information from the first <see cref="DebuggerDisplayAttribute"/> on the runtime type of <paramref name="value"/>, if there is one. /// </summary> internal static bool TryGetDebuggerDisplayInfo(this DkmClrValue value, out DebuggerDisplayInfo displayInfo) { displayInfo = null; // The native EE does not consider DebuggerDisplayAttribute // on null or error instances. if (value.IsError() || value.IsNull) { return(false); } var clrType = value.Type; displayInfo = new DebuggerDisplayInfo(clrType); DkmClrObjectFavoritesInfo favoritesInfo = clrType.GetFavorites(); if (favoritesInfo != null) { displayInfo = displayInfo.WithFavoritesInfo(favoritesInfo); } DkmClrType attributeTarget; DkmClrDebuggerDisplayAttribute attribute; if (clrType.TryGetEvalAttribute(out attributeTarget, out attribute)) // First, as in dev12. { displayInfo = displayInfo.WithDebuggerDisplayAttribute(attribute, attributeTarget); } return(displayInfo.HasValues); }
/// <summary> /// Extracts information from the first <see cref="DebuggerDisplayAttribute"/> on the runtime type of <paramref name="value"/>, if there is one. /// </summary> internal static bool TryGetDebuggerDisplayInfo(this DkmClrValue value, out DebuggerDisplayInfo displayInfo) { displayInfo = default(DebuggerDisplayInfo); // The native EE does not consider DebuggerDisplayAttribute // on null or error instances. if (value.IsError() || value.IsNull) { return(false); } var clrType = value.Type; DkmClrType attributeTarget; DkmClrDebuggerDisplayAttribute attribute; if (clrType.TryGetEvalAttribute(out attributeTarget, out attribute)) // First, as in dev12. { displayInfo = new DebuggerDisplayInfo(attributeTarget, attribute); return(true); } return(false); }