Debugging Shell Navigation

Ronald Rex 1,666 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

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,900 questions
C#
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.
10,278 questions
0 comments No comments
{count} vote

Accepted answer
  1. Reza Aghaei 4,936 Reputation points MVP
    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