A quite dumb question but i simply can't find the answer.
I have a self-written class that implements the IList<T>
interface. Now i like to see the containing elements within Debugging like i would with any .Net List<T>
.
To get this to work i think i have to provide the correct visualizer within the DebuggerVisualizerAttribute
. After a little searching all i could find is the folder for additional Visualizer. But there is just one for the DataSet.
But what are the types of all the Visualizer already available within Visual Studio (e.g. for string, List, etc.), so that i could provide the correct one for my implementation of something already available?
The debugger visualizers used by the .NET framework classes are internal. Which makes them a bit hard to use, you cannot use typeof(). There's a backdoor though, the [DebuggerTypeProxy] attribute also has a constructor that accepts a string. The one you want to use is named Mscorlib_CollectionDebugView, it is capable of visualing any class that implements ICollection<>. Here's an example of usage:
This works for .NET 4.0 as well, even though the version number is wrong. This otherwise has a risk of breaking with the next version of .NET if they decide to rename the internal class.