I'm working with a 3rd-party library that builds a NameObjectCollectionBase-derived map of name-object pairs. The collection is sometimes big (thousands of items) and I'd like to use the VS 2008 debugger to inspect items in it. (I'm not looking for a specific item in the map, I'm trying to see if the list of items looks like what I expect.) The map contains NameObjectEntry instances. When I inspect this map in the debugger, this is what I see:
[0] {System.Collections.Specialized.NameObjectCollectionBase.NameObjectEntry}
[1] {System.Collections.Specialized.NameObjectCollectionBase.NameObjectEntry}
...
[191] {System.Collections.Specialized.NameObjectCollectionBase.NameObjectEntry}
[192] {System.Collections.Specialized.NameObjectCollectionBase.NameObjectEntry}
I'm wondering if there's a way to tell the debugger how to format NameObjectEntry to show me the data inside an instance, not the type name. Something like:
[0] {"key1","value1"}
[1] {"key2","value2"}
...
[191] {"key191","value191"}
[192] {"key192","value192"}
With my own classes I could either override ToString() or use the DebuggerDisplay attribute but NameObjectEntry is part of the .NET framework, I can't change it. Unfortunately, search results mostly recommend one of these two.
Is there anything I can do to force the debugger to show this object in a specific way?
Edit: for future readers, the solution was to use the autoexp.cs file that comes with VS, as described here:
http://msdn.microsoft.com/en-us/library/x810d419%28VS.90%29.aspx