Background:
In other words: When using Cyq.data, the Mdatatable object is often breakpoint, in order to see the data content of the table, in the monitoring will often todatatable (), and then borrow a DataTable to view the table visually.
Recently: The heart inexplicable came a word, do not change career? Want to look directly at the object of mdatatable, like this:
So after a little research, there is the following content.
1: What is: Visual debugging tool (Microsoft.VisualStudio.DebuggerVisualizers)
With the text description is too weak, I direct, very intuitive:
A: Visual debugging of the string display:
B: Visualization of the DataSet and DataTable series:
For example, a simple sentence to summarize is: to specify a type of visual plug-in display .
2: How to Achieve: Visual Debugging Tools (Microsoft.VisualStudio.DebuggerVisualizers) do not say you think it is very complex, a very simple to say, here is an example of picture System.Draw.Image, the final effect such as:
Follow me Next: Step one: Create a new project = "Class Library =" Add a class.
Step two: Citation: Microsoft.VisualStudio.DebuggerVisualizers
Step Three: Enter the following code:Using Microsoft.VisualStudio.DebuggerVisualizers;
Using System;
Using System.Drawing;
Using System.Windows.Forms;
[Assembly:System.Diagnostics.DebuggerVisualizer (
typeof (Cyq. Visualizer.imagevisualizer),
typeof (VisualizerObjectSource),
Target = typeof (System.Drawing.Image),
Description = "Image Visualizer")]
Namespace Cyq. Visualizer
{
public class Imagevisualizer:dialogdebuggervisualizer
{
Override protected void Show (IDialogVisualizerService windowservice, IVisualizerObjectProvider objectprovider)
{
Image image = (image) Objectprovider.getobject ();
Form form = new form ();
Form. Text = string. Format ("Width: {0}, Height: {1}", image. Width, image. Height);
Form. ClientSize = new Size (image. Width, image. Height);
Form. FormBorderStyle = Formborderstyle.fixedtoolwindow;
PictureBox PictureBox = new PictureBox ();
Picturebox.image = Image;
picturebox.parent = form;
Picturebox.dock = DockStyle.Fill;
Windowservice.showdialog (form);
}
}
}then Yi success into a Xxx.dll, OK.
A simple description of the code flow: 1: Create a new class, called XXXX, need to inherit from: DialogDebuggerVisualizer
2: Override method Show (with two parameters)
3: In the code, the first line: Objectprovider.getobject () returns the copy of the entity of the class you want to process, and you can do the type conversion.
It is explained here that the processing must be serialized.
4: The last line: Windowservice.showdialog (Control); The display renders a control, usually we use a form to display it.
5: In the middle of the piece, is that we have to make the presentation of the things they want to write is these, learn some WinForm knowledge you will.
6: The last step, specify the assembly information to be reflected by the plug-in: There are three typeof
The first typeof (that is, the XXXX Class) the second typeof (by example, unless you need to customize your own serialization) a third typeof (the class you want to visualize) 3: How to Deploy: Visual Debugging Tools (Microsoft.VisualStudio.DebuggerVisualizers)
In a word, put that Xxx.dll in the following directory: vs installation directory \microsoft Visual Studio Xxx\common7\packages\debugger\visualizers
Then it automatically takes effect, and when you debug it, it will be loaded to show you the effect.
4: Source code Download and description
For different vs (2005, 2008, 2012, 2015), you need to yi different versions, mostly quoted: Microsoft.VisualStudio.DebuggerVisualizers This version is not the same.
: CYQ.Visualizer.rar Download
Custom visual Debugging Tools (Microsoft.VisualStudio.DebuggerVisualizers) vs.net development tools