Which class is used for “Text Visualizer”?

廉价感情. 提交于 2019-12-21 10:47:23

问题


When I use DebuggerVisualizer attribute as follows

c#

[assembly: DebuggerVisualizer(typeof(DataSetVisualizer), typeof(DataSetVisualizerSource), Target = typeof(DataTable), Description = "My DataTable Visualizer")]

vb.net

<Assembly: DebuggerVisualizer(GetType(DataSetVisualizer), GetType(DataSetVisualizerSource), Target := GetType(DataTable), Description := "My DataTable Visualizer")>

I can reuse Dataset Visualiser in my visualisers dll. This allows to have built in VS visualizer as first (default) even when a custom DataTable visualizer is defined(How to specify order of debugger visualizers in Visual Studio).

I would like to achieve the same behavior for "Text Visualiser".


回答1:


Unfortunately, I do not believe there is a managed class for the Text Visualizer, at least with respect to the documented VS API for using debugger visualizers. If there is a specific class for Text Visualizer, I couldn't find it by reflecting the managed assemblies related to debugging.

The documentation for creating a custom visualizer states that the custom visualizer will inherit from DialogDebuggerVisualizer. But if you reflect the Microsoft.VisualStudio.DebuggerVisualizers.dll, you will see that the only visualizer that ships with VS implemented using this process is the DataSetVisualizer class (I am using VS2012 but their documentation from VS2008 on indicates the same process using DialogDebuggerVisualizer). Hence, there won't be a proper class name you can use with the DebuggerVisualizerAttribute. Here is a snapshot of the reflection with DotPeek:

More than likely, the other visualizers are not managed code or may be dynamic constructs that can be used across managed and unmanaged code, (worst case they are legacy carry-overs from much earlier versions of Visual Studio).



来源:https://stackoverflow.com/questions/18912035/which-class-is-used-for-text-visualizer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!