Skip to content

Debugging Dart web app (via webdev) downloads source code from instead of mapping back to local paths #5024

@andynewman10

Description

@andynewman10

Describe the bug

  • VS code does not stop on my breakpoint the first time a web page is run through a debug session.
  • when refreshing the web page, the breakpoint is indeed hit, and the locations of the breakpoints are not correctly displayed with a red dot.
  • a Which DevTools page? message keeps being displayed in the command palette everything time a debug session is initiated. Is this expected? How to get rid of this?

To Reproduce

Steps to reproduce the behavior:

  1. Create a new dart project with dart create -t web dartwebapp
  2. Open the main.dart file, place a breakpoint on the first line, and start a debug session by clicking the Debug text above main.

Expected behavior

The web page should be open, and the debugger should stop on the first line of code. All breakpoint locations should be displayed with a red dot.

Actual behavior

VS code asks to activate webdev when running a debug session for the first time. OK with me. To be on the safe side, I then close VS code then reload it, and start the debug session (not closing and restarting VS triggers weird stuff in the console, with Write failed errors and weird GET /packages/...dill messages).

  • a web page opens and the main function is run
  • my breakpoint is not hit
  • in the VS window, I see a Which DevTools page? in the command palette, with choices ranging from Open Widget Inspector Page to Open DevTools in Web Browser. I choose this latter option. A new browser window opens with 'Connected app'.

Now I hit refresh on my web page.

  • the debugger does stop, but it stops on another main.dart file, which path is 'org-dartlang-app:..\web\main.dart'. The breakpoints are not correctly shown in this file.

I close the debug session, and start a new one: Which DevTools page? is, again, proposed.

What is exactly this option for, how to define it once for all and is it possible for VS code to debug my actual main.dart file, not the other main.dart file (see above)?

  • Operating System and version: Windows 11
  • VS Code version: 1.87.0
  • Dart extension version: 3.84.0
  • Dart/Flutter SDK version: 3.19.2
  • Target device (if the issue relates to Flutter debugging):

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin webRelates to running Dart or Flutter web appsis bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions