Unable to set breakpoints in dependencies from non-Pub sources that contain slashes in their URLs
- Dominant language
- Dart
- Stars
- 224
- Forks
- 94
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 2
Description
This was raised by @SteveHawes at https://github.com/Dart-Code/Dart-Code/issues/5898. I've tried to debug, but I'm not too familiar with the dwds code and I believe the issue is here somewhere.
To reproduce:
- Be on macOS (I don't know why, but I can't repro on Windows)
- Create an empty Flutter project
- Add a dependency to `pkg:args` hosted here at a URL with slashes in it:
```
args:
hosted: https://dart.cloudsmith.io/ews/dart-bug/
version: ^2.7.0
```
- Add call to the code like `var a = ArgParser().parse([]);` in your main `build` method
- Ctrl+Click into `parse()` and add a breakpoint somewhere in code that will be hit
- Run the app using the Chrome device
The breakpoint is never hit and does not resolve:
The path on disk has url-encoded slashes in it, so the folder is named like `dart.cloudsmith.io%47ews%47dart-bug` on disk. In `package_config.json`, the path is recorded as a `file:///` URI, so it gets encoded again. This means it shows as `dart.cloudsmith.io%2547ews%2547dart-bug` there (and in any places using `file:///` URIs).
The VM Service traffic all looks reasonable, but my guess is that somewhere the url-encoding is being interpreted incorrectly, but it's tricky to debug (I don't know how I can attach a debugger to dwds when running against a real Flutter app, nor how to reproduce this in a test - as outside of Pub deps, I can't get characters like this to work in local files in the project, because both the analyzer and the compiler seem to handle them badly).
One thing I did notice in the VM Service traffic is that in some places there are incorrect paths that look like `/Users/danny/Dev/Test Projects/dartcode_5898/packages/args/src/usage.dart`, but this is not where the package is (I know the packages are at `/packages/` for the web, but it seems like they should get mapped back to the pub cache and never to this path?).
Contributor guide
Research direction
Reproduce the macOS Flutter project on the Chrome device using the hosted args dependency with slashes in its URL. Start by tracing dwds handling of package_config.json file URIs and the related VM Service paths; done means breakpoints in the dependency resolve and are hit without incorrect path mapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100