Skip to content

Document & Review differences between Run and Debug modes #4876

Open

Description

@DanTup

VS Code has first-class actions for running in Debug and "noDebug" modes. Our current distinction is:

  • Run - does not connect the debug adapter to the VM Service
  • Debug - does connect the debug adapter to the VM Service

This means in noDebug, anything that uses the VM Service will be unavailable:

  • breakpoints
  • break on exception
  • (expression eval??)
  • dart:developer log()
  • navigating to files from ToolEvents

This distinction is not clear/obvious, and to confuse things further in the legacy debug adapters we did connect the VM Service in noDebug mode but only for Flutter.

The reason for doing more than just disabling breakpoints/break-on-exception in noDebug mode is that these are trivially toggleable in the UI anyway (users can easily do this, including changing it while the session is running, and VS Code could also just do this by not sending those settings to the debugger when you run if this was the intention).

However, we may have gone too far the other way. For example although we route ToolEvents through the VM Service, it's not obvious that this functionality would be unavailable in Run mode.

Functionality to decide on/verify:

Activity

  1. added
    in docs / websiteRelates to documentation, including the Dart Code website
    on Dec 4, 2023
  2. added this to the v3.80.0 milestone on Dec 4, 2023
  3. DanTup commented on Dec 4, 2023

    @DanTup
    MemberAuthor

    Also worth checking:

    • Order of buttons on editor title (is Run or Debug first?)
    • For opted-in users, what is the split between Run/Debug sessions
    • What do other languages (that don't have large penalties for debugging) do? Do they only disable breakpoints/exceptions?
    • Developer logs not showing up on the debug console anymore while running using the 'Run Without Debugging' option #4875 mentions the app running slower in Debug mode - we need to understand why that is, because we don't want to connect the VM Service in Run mode if it's introducing some performance penalty (although it's not clear to me what the slowdown is yet)

    And if we change this, should it change for both Dart and Flutter, or only Flutter?

  4. modified the milestones: v3.80.0, v3.82.0 on Dec 21, 2023
  5. DanTup commented on Jan 24, 2024

    @DanTup
    MemberAuthor

    #4956 describes an issue that might be caused by starting paused. It's likely that before the workaround here that this issue would only have occurred in Debug mode.

    Getting back to not needing to start paused in Run mode might address that issue (as well as perhaps improve startup time).. however, it could also introduce races if we decide we want to retain some of the functionality above in Run mode (for example capturing inspect() events that might be sent at startup).

  6. modified the milestones: v3.82.0, v3.84.0 on Jan 25, 2024
  7. modified the milestones: v3.84.0, v3.86.0 on Feb 20, 2024
  8. DanTup commented on Mar 14, 2024

    @DanTup
    MemberAuthor

    Another consideration.. If we can't attach the debugger for any reason (for ex. flutter/flutter#144999) using Run is no longer a way to possibly get further.

  9. modified the milestones: v3.86.0, v3.88.0 on Apr 2, 2024
  10. modified the milestones: v3.88.0, v3.90.0 on Apr 17, 2024
  11. modified the milestones: v3.90.0, On Deck on May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in docs / websiteRelates to documentation, including the Dart Code website

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions