using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; using Microsoft.VisualStudio.DebuggerVisualizers; namespace $rootnamespace$ { // TODO: Add the following to SomeType's definition to see this visualizer when debugging instances of SomeType: // // [DebuggerVisualizer(typeof($safeitemrootname$))] // [Serializable] // public class SomeType // { // ... // } // /// /// A Visualizer for SomeType. /// public class $safeitemrootname$ : DialogDebuggerVisualizer { protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { // TODO: Get the object to display a visualizer for. // Cast the result of objectProvider.GetObject() // to the type of the object being visualized. object data = (object)objectProvider.GetObject(); // TODO: Display your view of the object. // Replace displayForm with your own custom Form or Control. using(Form displayForm = new Form()) { displayForm.Text = data.ToString(); windowService.ShowDialog(displayForm); } } // TODO: Add the following to your testing code to test the visualizer: // // $safeitemrootname$.TestShowVisualizer(new SomeType()); // /// /// Tests the visualizer by hosting it outside of the debugger. /// /// The object to display in the visualizer. public static void TestShowVisualizer(object objectToVisualize) { VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof($safeitemrootname$)); visualizerHost.ShowVisualizer(); } } }