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.