dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

Support async expression evaluation in debuggers #40198

Open DanTup opened 4 years ago

DanTup commented 4 years ago

Originally raised by @Rodsevich at https://github.com/Dart-Code/Dart-Code/issues/2212. Evalating any async code just returns the Future. The code doesn't actually run because while the isolate is paused, the event/microtask queue is not being processed.

Wrapping waitFor() around the expression doesn't work either, as it returns "waitForEventSync is not supported by this embedder".

Based on @bkonyi's comments this might be non-trivial to support, but it seems like a nice feature (given how common async code is). I think it's worth having an issue for people to collect 👍's.


When running Future returning code in the debug console, only a

_Future (Instance of 'Future')

instance is returned. And no way of interacting with it.

It doesn't even works the .then((s){print('funcó: $s');}) call

DanTup commented 4 years ago

It seems like the .then() will work, but only once you resume (since the isolate is paused so the async code doesn't actually run until it's resumed).

Screenshot 2020-01-16 at 17 03 30