Today I was asked how to customize the quickwatch that the Visual Studio debugger displays for custom types. For an integer, a string, a DateTime or most other System types their values are correctly displayed. However for all custom types it just displays {MyNamespace.MyClass}.
My first guess was that the debugger just displays the output of the ToString() method however that is not true. After some searching on the web I found a newsgroup post that points out to edit the file mcee_cs.dat in the C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\Debugger directory.
Their entries are structured like that: <Typename with Namespace>=<member to display> (but that is described in the file as well). So I made a test with my PictureGalleryImage class "<DBauer.Web.UI.WebControls.PictureGallery.PictureGalleryImage>=<Index>" and it worked really find. Not very intuitive but good to know.
After I found it out I googled again and then I found the blog post by Dan Vallejo that describes the same just with other keywords :)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2008, Denis Bauer