Description
Take this file for instance:
$ cat t.dart
import "dart:developer";
class Foo {
}
void main() async {
Foo x = new Foo();
await foo();
print(x);
}
Future<void> foo() async {
await null;
await foo2();
}
Future<void> foo2() async {
debugger();
print("hello");
}
If I run as dart --enable-vm-service t.dart
and go to observatory (or devtools for that matter) and try to evaluate x
(or p x
, or view the locals) in the main
frame I'm being told org-dartlang-debug:synthetic_debug_expression:1:1: Error: Undefined name 'x'.
(observatory), evaluateInFrame: (113) Expression compilation error; org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter 'x' isn't defined for the class '_FutureListener<S, T>'.;
(DevTools), and presented with an empty list (locals listing).
That's not great.
If I go to the allocation profile I can find the Foo
instance (having a retaining path like retained by [ 0 ] of Context (1) -> retained by [ 6 ] of Context (9) -> retained by a GC root (stack)
), so it's definitely still there.
Why won't the debugger allow me to see it and evaluate it?
/cc @mkustermann
(to be fair this doesn't seem to have ever worked --- but it feels like a thing that should be possible)