Thursday, June 3, 2010

AutoExpansion in Visual Studio

Lets take a CStringArray. In the debugger (Watch Window) we will be able to see only the first element inserted into the array.

What if we wanted to see all the elements  present in the array?

1. Open the file "c:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat" in notepad.
2.Search for the line "[AutoExpand]"
3.add the following line below it.
      CStringArray=size = //Add this line
4. Search for the line "[Visualizer]"
5. add the following line below it.
CStringArray{ children ( #array ( expr : ($e.m_pData[$i]), size : ($e.m_nSize) ) )}
6. Save this file and close All Visual studio application and open again and try.

You can also expand other structures or classes designed by you. Refer autoexp.dat for samples.

No comments:

Post a Comment