Tuesday, July 17, 2012

In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

Most .NET programmers have probably seen this message when debugging their code. This most often occurs on the Item property of the various Collection types. It basically means that the debugger visualizer doesn't know how to display the value for this property and is requesting that the user provide an index to the property.

Short of writing a custom visualizer for Collection types, the easiest solution I can find is to go to Tools -> Options -> Debugger -> General and check Show all members for non-user objects in variables windows (Visual Basic). This tells the visualizer to display the private members of classes. I found that this allows me to drill down and find the information I need.

For example, I normally see this when trying to visualize a ListItemCollection.




There is no way for me to drill down further and see the contents of the Item property.

Once show all members are turned on, I am now able to see the listItems member and drill down to see the contents of the collection.





Until Microsoft upgrades Visual Studio to be smart enough to recognize these collection types and display the information we need, this is the best option that I've found so far.


No comments:

Post a Comment