Viewing instance fields in the debugger

This is using RTL on Island on macOS.

I am trying to view the contents of a List called AST in the debugger. The List is of type IStmt (which is an interface). In my testing, the List contains one object (a class called PrintStmt which implements IStmt).

When I open the debugger to inspect the contents I see this:

Notice how I’ve expanded AST to show the single element it contains. When I tried to expand element [0] I am not shown any of the fields of that element. You can see in the debugger that the object at index 0 is of type Possum.PrintStmt which is correct. I should be able to see it’s instance fields but I can’t.

It’s difficult to give a full code example as the app is complex but distilling it, it’s like this:

    public interface IStmt
    {
        public Token Location { get; }
        public void Accept(IStmtVisitor visitor);
    }

    public class PrintStmt : IStmt
    {
        public IExpr Expression;
        private Token location;

        public PrintStmt(Token where, IExpr expression)
        {
            location = where;
            Expression = expression;
        }

        public void Accept(IStmtVisitor visitor)
        {
            visitor.VisitPrint(this);
        }

        public Token Location
        {
            get { return location; }
        }
    }

I would expect in the debugger to be able to see the values of PrintStmt.Expression and PrintStmt.location but the debugger in Fire doesn’t show any fields at all.

If I cast the element in the List (knowing that element 0 is a PrintStmt) it will then show the fields but if I drill down into that object you’ll notice that Expression (which implements the interface IExpr) is shown as empty (whereas in reality it has several instance fields).

/// Assume AST is a List<IStmt>
PrintStmt ps = (PrintStmt)AST[0];
// Break into the debugger here...

You’ll see this in the debugger:

In summary, I think there’s an issue displaying the fields of an instance in the debugger if it implements an interface.

In the Visual Studio debugger, I can see the fields as expected. Not being able to do so in Fire is really hurting my debugging.

Is anyone else seeing this behaviour? Is it a bug or by design @mh?

Is it safe to summarize this bug as “objects can’t be expanded to see their members, when shown as part of a list”?

if so, I assume thats a b big specific to the special handling the debugger does to give you pretty vote for lists and dictionaries; I’ll log an issue for my colleague to have a look at next week.

Thanks, logged as bugs://84596

Sort of. It seems more complicated than that though in that even if I cast a specific element in the List to the actual class it is I can then drill down into that casted object’s fields in the debugger except for any fields which are also defined as type some interface.

I can provide my project if needed (didn’t want to share it publicly).

Curious.

Please, yes. we’ll keep its confidential, of course.

bugs://84596 got closed with status fixed.