Repository navigation
"Unable to find the library" regression? #5079
Copy link
Copy link
Closed
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis bug
Milestone
Description
Quite similar to #4932, yet with a slightly less verbose of an output this time around.
Describe the bug
Any attempt to execute an expression in VS Code's debug console for a Flutter app running in debug mode prints back:
2 + 2
Unable to find the library for file:///e%3A/Development/_code/Flutter/app_6/lib/main.dart
To Reproduce
Steps to reproduce the behavior:
- Create a new app via "Flutter: New Project".
- Build it for any platform - Windows or Web.
- Evaluate a
2 + 2in the VSC debug console.
Expected behavior
Having the debug console matching the output of the Flutter DevTools one.
Screenshots
Workspace Environment
Dart Code extension: 3.86.0
Flutter extension: 3.86.0 (activated)
App: Visual Studio Code
App Host: desktop
Version: win 1.88.1
Workspace type: Flutter (LSP)
Dart (3.3.3): <flutter install dir>\bin\cache\dart-sdk
Flutter (3.19.5): <flutter install dir>
Output from 'dart info'
<flutter install dir>\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.3.3 (stable) (Tue Mar 26 14:21:33 2024 +0000) on "windows_x64"
- on windows / "Windows 10 Pro" 10.0 (Build 19045)
- locale is en-US
Project info
- sdk constraint: '>=3.3.3 <4.0.0'
- dependencies: cupertino_icons, flutter
- dev_dependencies: flutter_lints, flutter_test
- elided dependencies: 1
Process info
| Memory | CPU | Elapsed time | Command line |
|---|---|---|---|
| 47 MB | -- | dart.exe | |
| 147 MB | -- | dart.exe | |
| 77 MB | -- | dart.exe | |
| 86 MB | -- | dart.exe | |
| 151 MB | -- | dart.exe | |
| 95 MB | -- | dart.exe |
Output from 'flutter doctor'
<flutter install dir>\bin\flutter.bat doctor -v
[✓] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
• Flutter version 3.19.5 on channel stable at <flutter install dir>
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 300451adae (4 weeks ago), 2024-03-27 21:54:07 -0500
• Engine revision e76c956498
• Dart version 3.3.3
• DevTools version 2.31.1
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at E:\Programs\AndroidSDK
• Platform android-33, build-tools 30.0.3
• Java binary at: E:\Programs\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.11.21)
• Visual Studio at E:\Development\VS\Community
• Visual Studio Community 2019 version 16.11.33027.164
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio (version 4.2)
• Android Studio at E:\Programs\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
• android-studio-dir = E:\Programs\Android Studio
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4291]
• Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.123
• Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.51
[✓] Network resources
• All expected network resources are available.
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis bug


Activity
DanTup commentedon Apr 23, 2024
The fix for #4932 was in the SDK so requires a new Dart/Flutter SDK to get it. The fix was made after the branch for the previous (Feb) release so will show up only in the next one.
If you're able to test on the
betabranch, you should find it fixed - but if you still see the error there, please let me know!techvx commentedon Apr 23, 2024
Just switched to the
beta, as confirmed byflutter doctor:No luck, nevertheless:
DanTup commentedon Apr 23, 2024
Thanks for checking! Indeed, I can repro too - taking a look.
DanTup commentedon Apr 23, 2024
Ok, I think I know what happened here. We used to mostly use file paths in the debug adapter, which meant the URI sent for context here was converted to a file path. VS Code escapes the colon in the file URI, but converting to a file path with decode that.
As part of work to support macros, much of the debug adapter was upgraded to use URIs (to support virtual documents that aren't on the disk), and that meant we no longer convert the URI back to a file path, but use it as-is. This meant the encoded colon in the drive letter was sent to the VM and didn't match, so some mapping didn't work correctly.
We can handle this in the VS Code extension by disabling VS Code's over-escaping.
DanTup commentedon Apr 23, 2024
@techvx I've published a pre-release version of the extension that includes this fix (v3.87.20240423). If you get chance, would you be able to switch to it in VS Code and verify that with this version that it's working for you on Flutter
betaormaster?You will have to click the "Reload" button after installing the new extension for it to become active.
Thanks!
techvx commentedon Apr 23, 2024
It does work as intended now:
Thanks for the speed on this one.
DanTup commentedon Apr 23, 2024
Great, thanks for confirming (and bringing it to my attention!)