Debugging Shell Navigation

Ronald Rex 1,671 Reputation points
2023-01-27T19:08:08.5433333+00:00

Hello Friends,

I was wondering if anyone knows where to put my DebuggerDisplay Attribute annotations so that I can debug my navigation requests. Thanks !!!

Debugging navigation

Some of the Shell classes are decorated with the DebuggerDisplayAttribute, which specifies how a class or field is displayed by the debugger. This can help to debug navigation requests by displaying data related to the navigation request. For example, the following screenshot shows the CurrentItem and CurrentState properties of the Shell.Current object:

Screenshot of debugger

Developer technologies | .NET | .NET MAUI
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} vote

Answer accepted by question author
  1. Reza Aghaei 4,996 Reputation points Volunteer Moderator
    2023-01-27T19:40:13.49+00:00

    You can decorate classes, fields or properties with DebuggerDisplay attribute.

    For example, assuming you have a class like this:

    [DebuggerDisplay("[{X},{Y},{Width},{Height}], Area ={Width*Height} ")]
    public class Rectangle
    {
        public int X { get; set; }
        public int Y { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }
    }
    

    At debug time, you can see the debugger display like this:

    User's image

    You can use { } as part of the formatted text, and the text could be name of a field, property, or method. As you can see in the above example, you can use expressions between {} as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.