question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugger: Step to the next line in an async function.

See original GitHub issue

Debugging async functions in Dart is super annoying.

I am at line 10. I want to go to line 11:

10   var x = await getSomething(); ➜ I am here
11   print(x); ➜ Just want to go here

But the await means some other code will have the chance to run, and we go to a completely different part of the code.

If I want to go to line 11, I am forced to add a breakpoint there or “force run” to line 11. That’s painful. Sometimes I don’t even notice there is an await in the middle of the line, and when I try to go the the next line it goes somewhere else and don’t even know where I was anymore. I have to restart and pay double attention, which wastes my brain CPU and makes it harder for me to reason about the code.

I was told by Simon Binder that the Dart VM protocol has a “step to the next line in an async function” command (and that is accessible from the observatory), but somehow all IDEs don’t use that.

Please add this to the debugger.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
stevemessickcommented, Apr 29, 2021

The problem in the plugin is that suspendContext.getAtAsyncSuspension() is returning false. We’ll have to look into it further.

@marcglasberg In both VS Code and IntelliJ the “Step Over” function is supposed to do what you want. It’s broken in IntelliJ, but working in VS Code.

1reaction
stevemessickcommented, May 17, 2021

Thanks for checking. It was a bug in the Flutter and Dart plugins. Fixed in both now.

On Mon, May 17, 2021 at 7:47 AM Danny Tuppeny @.***> wrote:

@stevemessick https://github.com/stevemessick sorry for the delay. I tested this but it did seem to work as I expected. I see you pushed a fix here -does that mean it was IntelliJ-specific, or do you think VS Code may need a change too? (I’m curious why the whitespace seemed to affect this if that’s the case though).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter-intellij/issues/5449#issuecomment-842386108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACA7VDIOHUGMIOAMJXBC3ZTTOET77ANCNFSM43XK4MHQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

While debugging, stepping over async functions results in ...
I want to set a breakpoint in an asynchronous function and want to step over its lines. I am setting the breakpoint like...
Read more >
Debugger cannot step over "await" when using custom task ...
NET core (Standard 2.1) and am trying to implement async/await in C#, currently running ... when I expect it to just step to...
Read more >
How Do I Debug Async Code in Visual Studio?
Debugging async code is challenging. Let's explore some Visual Studio tools that can help you debug your async programs easier!
Read more >
How JavaScript works: debugging overview + 4 tips for async ...
The first step to debugging asynchronous code is to use the console. log() function in different code sections. Use the try and catch ......
Read more >
Async Debug Step Into/Over Just Runs to Next Breakpoint
set a breakpoint at await Task.Yield() in DoWork() · debug, breakpoint is hit · step over · program runs to end (expected: program...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found