Using "args" in launch.json for an attach request reports an error
See original GitHub issueDescribe the bug
When trying to attach the debugger to a flutter app I get the error message:
There are multiple observatory ports available.
Rerun this command with one of the following passed in as the appId:
flutter attach --app-id com.example.myApp
flutter attach --app-id com.example.myApp (2)
However, there is no configuration option available for type dart
in the launch.json
for me to be able to specify app-id
My launch.json
looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "debug app",
"request": "attach",
"type": "dart",
"deviceId": "51ABDF9C-C54D-4811-BBDA-E733639AEC51",
},
]
}
To Reproduce Steps to reproduce the behavior:
- Run an app in the terminal with
flutter run
- Run the
debug app
launch config specified above.
I’ve also tried not launching with flutter run
by just tapping on the app in the emulator and then trying to attach but the same problem occurs.
Expected behavior
I expected to be able to attach to the running process.
Versions (please complete the following information):
- VS Code version: 1.57.1
- Dart extension version: 3.23.1
- Dart/Flutter SDK version: Flutter 2.2.1, Dart 2.13.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Configure launch.json for C/C++ debugging in Visual Studio ...
Specifies the full path to the executable the debugger will launch or attach to. The debugger requires this location in order to load...
Read more >In Visual Studio Code, how to pass arguments in launch.json
As described in the documentation, you need to use the args attribute. E.g. { // Use IntelliSense to learn about possible attributes.
Read more >Starting a Debug Session — Gaudi Documentation
You can either start the TPC test program manually and request Visual Studio Code to attach to it, or you can request Visual...
Read more >Launch Configuration - Dart Code - Dart & Flutter support for ...
A launch configuration ( .vscode/launch.json ) file is not required for the most common use cases for Dart/Flutter as long as you stick...
Read more >Debugging - Business Central | Microsoft Learn
Debugging is the process of finding and correcting errors. ... You can set a breakpoint by using the Debug Menu in Visual Studio...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same thing happening when debugging a Flutter app on iOS in IntelliJ. Adding
--app-id com.yourhomeingoodhands.mobile.yhigh
in the “Additional attach args” field of the “Run/Debug Configuration” of my Flutter app fixed it. That was suggested by somebody in the forum.Thanks - I suspected that might be the case as I was updating the title - if I remember correctly they have their own definitions. There’s probably not been much reason to use
args
in attach before this, so may have been left off intentionally, but this seems like good reason to change it - we shouldn’t report errors on settings that actually change behaviour.Thanks!