DebuggerDisplayAttribute and Telerik objects

Thread is closed for posting
1 posts, 1 answers
  1. Answer
    DE7E45D6-3460-4491-8D61-EC2A780821A8
    DE7E45D6-3460-4491-8D61-EC2A780821A8 avatar
    39 posts
    Member since:
    Feb 2007

    Posted 15 Oct 2008 Link to this post

    Requirements

    RadControls version

    Q2 2008 (should work with any version)

    .NET version

    3.5 (should work with 2.0)

    Visual Studio version

    2008 (should work with 2005)

    programming language

    C#

    browser support

    N/A 


     
  2. PROJECT DESCRIPTION
    Lately, I was thinking about writing to Telerik support and ask them to add DebuggerDisplayAttribute declaration to their objects.

    But today I ran into MSDN article explaining how to use DebuggerDisplay Attributes and the autoexp.cs.
    After running some tests, I discovered it was very easy to use and it produces great result.
    For example, the following declaration added to autoexp.cs enable to add a friendly debuggerdisplay to RadMenuItemData object:

    [assembly: DebuggerDisplay(@"RadMenuItemData: {Text}, Value: {Value}", Target = typeof(Telerik.Web.UI.RadMenuItemData))]

    In my watch window I get the following output:
    RadMenuItemData: "Item text", Value: "Item value"

    It saves me a lot of time especially when looking at a RadMenuItemData array since I don't have to expand items one by one.

    In the code files archive, you'll find a modified version of autoexp.cs and a .cmd file used to compile this file. Please bear in mind that you'll have to update the file paths before being able to compile it.
    The big issue with autoexp.cs is that you need to compile it to a library (autoexp.dll) before being able to use it.
    You don't have to restart VS2008 to be able to use a newly compiled autoexp.dll but you will need to restart any debugging session. The dll file has to be located in <My Documents>\Visual Studio 2008\Visualizers.
    At this location, you should already find an existing dll that you should backup and replace with the new version.


    Hope you like this trick.

    BR, Laurent
  • Back to Top

    This Code Library is part of the product documentation and subject to the respective product license agreement.