Debugging dart - preferences for debugging pub packages/SDK code?

89 views
Skip to first unread message

Danny Tuppeny

unread,
Sep 16, 2016, 7:39:05 AM9/16/16
to Dart Misc
In C#, by default, the debugger only steps through code I've written; it excludes:
  • .NET Framework code
  • Third party packages (eg. NuGet)
  • Code marked as generated
There are some options for debugging through framework/external packages but to me the defaults seem pretty sane. Currently Dart Code will step through everything and it bugs me, so I'm planning on adding options to allow you to individually enable debugging SDK and external libraries.

To me, it seems like the best default would be to have both of these options off (so the debugger will only step through your own code), but possibly this is because it's what I'm used to. I don't know if other Dart editors have options for these but I suspect most Dart devs are probably used to stepping through the SDK/etc. by default.

So, I'm after opinions - if you use the Dart debugger, what do you think is the best default? Is stepping through the SDK ever useful or would you rather it was treated like external native code? What about pub packages you've added?

Lex Berezhny

unread,
Sep 16, 2016, 8:30:02 AM9/16/16
to misc
That's an interesting perspective (I assume from Visual Studio?). To be honest, until your email, I had never considered my own code and any libraries that I depend on as somehow separate and I've been debugging code for at least 10 years :-)

Most of the time I am debugging something to find a bug and bugs can appear anywhere; sometimes even in 3rd party code. So, I think it makes sense to step through all code that's in the path to fix a particular problem regardless if the code is mine or someone else's.

I would suggest instead of automatically isolating yourself from other people's code try:

1. Using step-over instead of step-into and then you can skip going into other people's code.

2. If you are using a decent IDE: instead of stepping over every line just click the line you want to go to and then do "run to cursor".

3. Use conditional breakpoints.

I think mastering your IDE would be much more beneficial for long term productivity than trying to isolate yourself from other people's code which may actually have the bug you're looking for...

 - lex

Filipe Morgado

unread,
Sep 16, 2016, 9:07:34 AM9/16/16
to Dart Misc
+1

I use step-over on everything I don't want to step-into, be it other libs or my own code.

Danny Tuppeny

unread,
Sep 16, 2016, 9:17:44 AM9/16/16
to mi...@dartlang.org
On Fri, 16 Sep 2016 at 13:30 Lex Berezhny <l...@damoti.com> wrote:
That's an interesting perspective (I assume from Visual Studio?). To be honest, until your email, I had never considered my own code and any libraries that I depend on as somehow separate and I've been debugging code for at least 10 years :-)

Not it matters at all but I've been debugging much longer than that :-)
 

Most of the time I am debugging something to find a bug and bugs can appear anywhere; sometimes even in 3rd party code. So, I think it makes sense to step through all code that's in the path to fix a particular problem regardless if the code is mine or someone else's.

Sure; I'm not under some illusion that external code is perfect; but "code I'm currently writing/thinking about" is going to be much more buggy than "a release quality SDK from Google"! And stepping through the same .forEach SDK method many times a day is pointless; I'm writing/testing/debugging my code, and I'm pretty confident in the external code (mostly).

To me, there's not much difference between the Dart SDK and the native code it calls - it's of high quality and being tested by a lot of people. You wouldn't expect to step down into the native code, yet there may be bugs in there!

 
I would suggest instead of automatically isolating yourself from other people's code try:

1. Using step-over instead of step-into and then you can skip going into other people's code.
2. If you are using a decent IDE: instead of stepping over every line just click the line you want to go to and then do "run to cursor".
3. Use conditional breakpoints.

I think mastering your IDE would be much more beneficial for long term productivity than trying to isolate yourself from other people's code which may actually have the bug you're looking for...

I know how to use these features; I spend a lot of time every day using them. However they don't all work well in all cases. There's a reason Visual Studio has the default it does and that Chrome added a feature to do the same thing in Javascript :-)

To be clear, I'm not asking for a feature here, I am implementing the IDE/debugger integration for Dart Code. I'm adding an option to support this feature; I'm just after opinions on what the default should be. If this concept is alien to all Dart devs, I'll leave the default as stepping through everything; it will definitely be an option in Dart Code though! :-)

Danny


Lex Berezhny

unread,
Sep 16, 2016, 9:32:19 AM9/16/16
to misc
On Fri, Sep 16, 2016 at 9:17 AM, Danny Tuppeny <da...@tuppeny.com> wrote:
To be clear, I'm not asking for a feature here, I am implementing the IDE/debugger integration for Dart Code. I'm adding an option to support this feature; I'm just after opinions on what the default should be. If this concept is alien to all Dart devs, I'll leave the default as stepping through everything; it will definitely be an option in Dart Code though! :-)

Since Dart hasn't been around that long I think many of us are bringing our habits from other languages. In my case that would be Python. I've only been working with Dart full time for last two years (using an IntelliJ based IDE). There is probably not going to be a single "dart developer" profile/default that would make sense here.

On the other hand... since you are implementing plugin for Visual Studio then I think it's relatively safe to assume that other developers using your plugin maybe more familiar with Visual Studio defaults in C# than what I or another non-VS user may be familiar with.

It would probably make more sense to poll the VS community instead of the broad Dart community, I suspect the consensus with VS folks would be to stick to existing VS conventions for all language implementations.

 - lex

Danny Tuppeny

unread,
Sep 16, 2016, 9:38:17 AM9/16/16
to mi...@dartlang.org
On Fri, 16 Sep 2016 at 14:32 Lex Berezhny <l...@damoti.com> wrote:
On Fri, Sep 16, 2016 at 9:17 AM, Danny Tuppeny <da...@tuppeny.com> wrote:
To be clear, I'm not asking for a feature here, I am implementing the IDE/debugger integration for Dart Code. I'm adding an option to support this feature; I'm just after opinions on what the default should be. If this concept is alien to all Dart devs, I'll leave the default as stepping through everything; it will definitely be an option in Dart Code though! :-)

Since Dart hasn't been around that long I think many of us are bringing our habits from other languages. In my case that would be Python. I've only been working with Dart full time for last two years (using an IntelliJ based IDE). There is probably not going to be a single "dart developer" profile/default that would make sense here.

Sure, I'm just trying to get an opinion on whether there's an obvious choice. If most Dart devs are used to debugging everything, I'm happy for the default to not be what I would use. However, there was a chance that Dart devs would say "that would be amazing; I'm sick of stepping into framework code", hence the request for opinions.

 
On the other hand... since you are implementing plugin for Visual Studio then I think it's relatively safe to assume that other developers using your plugin maybe more familiar with Visual Studio defaults in C# than what I or another non-VS user may be familiar with.

It would probably make more sense to poll the VS community instead of the broad Dart community, I suspect the consensus with VS folks would be to stick to existing VS conventions for all language implementations.

My extension is aimed at Dart Developers, not Visual Studio users (it's actually an extension for Visual Studio Code, not Fat VS), so here seems most appropriate to me - it doesn't matter what a C# dev prefers. The people I want to use my extension are the very people in this group that may currently be using IntelliJ, Atom, etc.. :-)

Mike

unread,
Sep 16, 2016, 1:18:14 PM9/16/16
to Dart Misc
For what its worth, I think an option to skip SDK code would be very helpful and I'd use it as my default.

Günter Zöchbauer

unread,
Sep 17, 2016, 7:17:58 AM9/17/16
to Dart Misc
I was sure I created a feature request for this already years ago, but can't find it.
An option to skip SDK code and sometimes even code of package dependencies would be very helpful.

Danny Tuppeny

unread,
Sep 17, 2016, 7:25:09 AM9/17/16
to mi...@dartlang.org
On Sat, 17 Sep 2016 at 12:18 Günter Zöchbauer <gzo...@gmail.com> wrote:
I was sure I created a feature request for this already years ago, but can't find it.
An option to skip SDK code and sometimes even code of package dependencies would be very helpful.

My plan is to have options for both :-)

This thread was to gather opinions on whether this should be the default or not - how much do you think you would have this enabled/disabled? Unfortunately switching it on/off during debugging may not be easy, so you'd likely need to have it set before your debugging session.

It turns out the support for this (setLibraryDebuggable) isn't working correctly in the current Dart SDK, so I'm currently blocked on adding this (I'm not sure whether this means no other IDEs have this?), but as soon as there's a dev version with a fix I can get back to it.

I suspect I'll leave it as stepping through all code by default, though I'm still interesting in opinions in case most devs would rather skip-by-default and opt-in if they feel they need to debug SDK/library code. 

Günter Zöchbauer

unread,
Sep 17, 2016, 8:01:59 AM9/17/16
to Dart Misc
I wouldn't care if I need to restart. 
By default I don't want to step into SDK code.
Usually the bug is in my own code (no matter how sure I am about having done everything correctly) ;-)

Danny Tuppeny

unread,
Sep 17, 2016, 8:54:47 AM9/17/16
to mi...@dartlang.org
On Sat, 17 Sep 2016 at 13:02 Günter Zöchbauer <gzo...@gmail.com> wrote:
I wouldn't care if I need to restart. 
By default I don't want to step into SDK code.
Usually the bug is in my own code (no matter how sure I am about having done everything correctly) ;-)

This matches my thoughts exactly! But I'm still no closer to picking a default... I think I know of three people that would prefer not to step into SDK and the same that would... I expected most to want the current behaviour!

I don't mind not doing my preference, but if opinions are divided I'm now also thinking not stepping into external code is the most beginner-friendly. Picking defaults is hard :D

Danny Tuppeny

unread,
Sep 17, 2016, 8:55:26 AM9/17/16
to Dart Misc
I posted a poll on Twitter if anyone wants to anonymously give their preference.. If you have Dart devs following; please RT =)

Reply all
Reply to author
Forward
0 new messages