/// <summary>
        /// Initializes the <see cref="VSUIVisualizerService"/> class.
        /// </summary>
        static VSUIVisualizerService()
        {
            List <DkmCustomUIVisualizerInfo> allVisualizers = new List <DkmCustomUIVisualizerInfo>();

            allVisualizers.Add(DkmCustomUIVisualizerInfo.Create((uint)VSUIVisualizerType.ModalWindow, "SharpDebug visualization", "Visualizes expression using SharpDebug UI Visualizer", GuidString));
            allVisualizers.Add(DkmCustomUIVisualizerInfo.Create((uint)VSUIVisualizerType.InteractiveWindow, $"Add to '{VSInteractiveWindow.CaptionText}' interactive window", $"Adds expression to '{VSInteractiveWindow.CaptionText}' interactive window", GuidString));
            AllCustomUiVisualizers = new ReadOnlyCollection <DkmCustomUIVisualizerInfo>(allVisualizers);
        }
Exemple #2
0
        internal static DkmCustomUIVisualizerInfo[] GetDebuggerCustomUIVisualizerInfo(
            this DkmClrType type
            )
        {
            var builder = ArrayBuilder <DkmCustomUIVisualizerInfo> .GetInstance();

            var appDomain      = type.AppDomain;
            var underlyingType = type.GetLmrType();

            while ((underlyingType != null) && !underlyingType.IsObject())
            {
                foreach (var attribute in type.GetEvalAttributes())
                {
                    var visualizerAttribute = attribute as DkmClrDebuggerVisualizerAttribute;
                    if (visualizerAttribute == null)
                    {
                        continue;
                    }

                    builder.Add(
                        DkmCustomUIVisualizerInfo.Create(
                            (uint)builder.Count,
                            visualizerAttribute.VisualizerDescription,
                            visualizerAttribute.VisualizerDescription,
                            // ClrCustomVisualizerVSHost is a registry entry that specifies the CLSID of the
                            // IDebugCustomViewer class that will be instantiated to display the custom visualizer.
                            "ClrCustomVisualizerVSHost",
                            visualizerAttribute.UISideVisualizerTypeName,
                            visualizerAttribute.UISideVisualizerAssemblyName,
                            visualizerAttribute.UISideVisualizerAssemblyLocation,
                            visualizerAttribute.DebuggeeSideVisualizerTypeName,
                            visualizerAttribute.DebuggeeSideVisualizerAssemblyName
                            )
                        );
                }

                underlyingType = underlyingType.GetBaseTypeOrNull(appDomain, out type);
            }

            var result = (builder.Count > 0) ? builder.ToArray() : null;

            builder.Free();
            return(result);
        }