Offspring DataTable with DebuggerDisplay attribute loses DebuggerVisualizer

I have a DataTable descendant that has a DebuggerDisplay attribute. The default renderer for the DataTable is removed when the DebuggerDisplay attribute is added. If I remove the DebuggerDisplay attribute, the DataTable renderer appears. I need a default DataTable renderer and my override for DebuggerDisplay.

Do you guys know how to make it work?

    //does not work
//[DebuggerVisualizer("Microsoft.VisualStudio.Debugger.DataSetVisualizer", typeof(DataTable))]

//DebuggerDisplay attribute removes DataTable visualizer. Odd behavior to me.
[DebuggerDisplay("{TableName}, Count = {Rows.Count}, {GetColumnNames()}")] 
public class MyTable<T> : DataTable where T : class{}

      

+2


source to share


1 answer


Just to clarify, I have no idea why rendering and specifying a different attribute turns off the renderer.

I tried something like this, and there is nothing stopping you from using both DebuggerDisplay

as well as DebuggerVisualizer

the type. The image below shows the left circle is the debugger renderer, the right circle is the debugger:

Debugger Display and Visualizer both visible

However, you might have problems trying to use a type DataSetVisualizer

for your class. It took a lot for jiggery-pokery , but I got the following definition for my class:

[Serializable]
[DebuggerVisualizer(typeof(EnhancedDataSetVisualizer.DataSetVisualizer), 
                    typeof(EnhancedDataSetVisualizer.DataSetVisualizerSource))]
[DebuggerDisplay("{Name}")]
public sealed class SpecFlowTableWrapper : DataSet
{
    // Body omitted, not important.
}

      

I constantly had to change the arguments that I indicated in DebuggerVisualizer

. Turns out the missing part for me pointed out VisualizerObjectSource

.

Then I get a debugger display showing my dataset name and when I click the magnifying glass it loads DataSetVisualizer

.

The important part of all of this is the two links:

  • Microsoft.VisualStudio.Debugger.DataSetVisualizer

It contains types DataSetVisualizer

and DataSetVisualizerSource

.



  • Microsoft.VisualStudio.DebuggerVisualizers

This is a dependency on another link.

The second item is usually available in the Add Links ... dialog in Visual Studio, however the first item is in the VS installation directory.

For me (VS version may be different):

C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ Packages \ Debugger \ Visualizers \

Called by:

Microsoft.VisualStudio.Debugger.DataSetVisualizer.dll

Make sure the Copy Locale value is also correct for the first link (this should be true by default). Note that for debugging this link is now a dependency, so you need to make sure it is in the working directory of whatever project you are debugging, otherwise you will get VS debugger errors.

Rebuild, run debugger, enjoy. It is a pity that 2 years have passed.

+2


source







All Articles