Repository navigation
Launching a new app in VSCode fails quickly with no error in VS Code insiders #5183
Description
Describe the bug
Attempting to launch either an old app or a freshly generated new app using VSCode's "Run" option briefly shows the debugger controls, then stops. I've checked extension outputs and vscode's developer console for errors, but nothing reveals any insight. When running from command line with "flutter run", the app launches successfully.
To Reproduce
- Start with a clean checkout of flutter stable (version and system info below)
- Generate a fresh app
- Use VSCode to try running it
- Observe it doesn't launch
Hints
I've found that adding the setting "dart.useLegacyDebugAdapters": true to my project allows it to be successfully launched by vscode. I assume it's related to something failing with using the non-legacy debug adapter. If I could find some logs for that, I'm sure the issue might be clearer.
Workspace Environment
Dart Code extension: 3.92.0
Flutter extension: 3.93.20240702 (activated)
App: Visual Studio Code - Insiders
App Host: desktop
Version: win 1.92.0-insider
Workspace type: Flutter (LSP)
Dart (3.4.3): C:\src\flutter\bin\cache\dart-sdk
Flutter (3.22.2): C:\src\flutter (Windows (windows-x64/windows))
Output from 'dart info'
C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe info
If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.
General info
- Dart 3.4.3 (stable) (Tue Jun 4 19:51:39 2024 +0000) on "windows_x64"
- on windows / "Windows 10 Pro" 10.0 (Build 22635)
- locale is en-US
Project info
- sdk constraint: '>=2.15.0 <3.0.0'
- dependencies: bloc, flutter, flutter_bloc, flutter_highlight, flutter_localizations, google_fonts, highlighter, intl, json_annotation, protobuf, rive
- dev_dependencies: build_runner, flutter_test, json_serializable, pedantic, protoc_builder
Process info
| Memory | CPU | Elapsed time | Command line |
|---|---|---|---|
| 111 MB | -- | dart.exe | |
| 626 MB | -- | dart.exe | |
| 103 MB | -- | dart.exe | |
| 103 MB | -- | dart.exe | |
| 95 MB | -- | dart.exe |
Output from 'flutter doctor'
C:\src\flutter\bin\flutter.bat doctor -v
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22635.3930], locale en-US)
• Flutter version 3.22.2 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (6 weeks ago), 2024-06-05 22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at C:\Users\tekkb\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0-rc3
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
[√] IntelliJ IDEA Community Edition (version 2023.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.92.0-insider)
• VS Code at C:\Users\tekkb\AppData\Local\Programs\Microsoft VS Code Insiders
• Flutter extension version 3.92.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22635.3930]
• Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127
• Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.49
[√] Network resources
• All expected network resources are available.
• No issues found!
Activity
DanTup commentedon Jul 16, 2024
Not showing an error might be fixed by flutter/flutter#149734 which is in the Flutter master channel but has not made a release yet. For some kinds of failures, the error message would not make it back to the client properly.
One thing you can try:
F1)nulkode commentedon Jul 29, 2024
I can confirm I'm having this issue as well. It was also resolved temporarily with
"dart.useLegacyDebugAdapters": true.Workspace Environment
Output from 'dart info'
General info
Project info
Process info
Output from 'flutter doctor'
Here is the output from the debugging log capture session started before starting debugging my app and stopping it right after it fails.
DanTup commentedon Jul 29, 2024
@nulkode are you able to test against the current Flutter
betachannel to see if the fix mentioned above resolved this?nulkode commentedon Jul 29, 2024
@DanTup still doesn't work. I think the issue may be caused by Visual Studio Code - Insiders, as debugging in regular Visual Studio Code with the same extension version doesn't produce this bug.
Debugging log capture session
[-]Launching a new app in VSCode fails quickly with no error[/-][+]Launching a new app in VSCode fails quickly with no error in VS Code insiders[/+]DanTup commentedon Jul 29, 2024
Oops, I missed this error in your log the first time:
Looks like this may be related to a NodeJS change:
I'll see if I can repro with Insiders and do some debugging.
DanTup commentedon Jul 29, 2024
I can repro this, but unfortunately the way we tell VS Code how to start the debug adapter does not currently support passing
shell: true, so I don't have a fix.I've opened microsoft/vscode#224184 in the hope this can be added before VS Code ships this update.
Set DA to use shell:true on Windows for flutter
natebot13 commentedon Jul 29, 2024
Thanks @nulkode for following up for me and thanks @DanTup for pinpointing the issue and following up with a VSCode PR!
DanTup commentedon Jul 30, 2024
It appears that my PR will not be merged to VS Code before the stable release, so we will need to find another reasonable workaround for this.
Spawn Flutter debug adapter directly with dart.exe
Spawn Flutter debug adapter directly with dart.exe
Spawn Flutter debug adapter directly with dart.exe
Spawn Flutter debug adapter directly with dart.exe
DanTup commentedon Jul 30, 2024
I have pushed a workaround to the pre-release extension - please try it out and let me know if you have any issues:
The VS Code devs are considering a better fix (in which case I will revert this), but I'd like to have this ready to ship in a stable release if that doesn't happen in time.
DanTup commentedon Jul 31, 2024
A better fix has been merged into VS Code (both
mainand the 1.92 release candidate) so I have reverted this workaround. Once the Insiders release updates late today (assuming they still update during release prep) I will push a new pre-release with the revert.DanTup commentedon Jul 31, 2024
There's a new insiders that has the fix for this, so I have also pushed an updated pre-release (v3.93.20240731) with the reverted change. You should be sure to update your Insiders version when you get the updated extension version so the issue does not come back.
nulkode commentedon Aug 2, 2024
It works! Thank you!
DanTup commentedon Aug 2, 2024
Great, thanks for testing and confirming :-)
Spawn Flutter debug adapter directly with dart.exe