Skip to content

"Unable to find the library" regression? #5079

Closed

Description

@techvx

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:

  1. Create a new app via "Flutter: New Project".
  2. Build it for any platform - Windows or Web.
  3. Evaluate a 2 + 2 in the VSC debug console.

Expected behavior
Having the debug console matching the output of the Flutter DevTools one.

Screenshots

image

image

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!

@DanTup

Activity

  1. DanTup commented on Apr 23, 2024

    @DanTup
    Member

    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 beta branch, you should find it fixed - but if you still see the error there, please let me know!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Apr 23, 2024
  3. techvx commented on Apr 23, 2024

    @techvx
    Author

    Just switched to the beta, as confirmed by flutter doctor:

    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel beta, 3.22.0-0.2.pre, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
    [✓] Windows Version (Installed version of Windows is version 10 or higher)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    [✓] Chrome - develop for the web
    [✓] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.21)
    [✓] Android Studio (version 4.2)
    [✓] Connected device (3 available)
    [✓] Network resources
    
    • No issues found!
    

    No luck, nevertheless:

    Launching lib\main.dart on Windows in debug mode...
    ✓ Built build\windows\x64\runner\Debug\app_6.exe
    Connecting to VM Service at ws://127.0.0.1:61484/Hh4qesxiJFs=/ws
    2 + 2
    Unable to find the library for file:///e%3A/Development/_code/Flutter/app_6/lib/main.dart
    
  4. DanTup commented on Apr 23, 2024

    @DanTup
    Member

    Thanks for checking! Indeed, I can repro too - taking a look.

  5. removed
    awaiting infoRequires more information from the customer to progress
    on Apr 23, 2024
  6. added this to the v3.88.0 milestone on Apr 23, 2024
  7. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Apr 23, 2024
  8. DanTup commented on Apr 23, 2024

    @DanTup
    Member

    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.

  9. DanTup commented on Apr 23, 2024

    @DanTup
    Member

    @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 beta or master?

    Dart pre-release versions

    You will have to click the "Reload" button after installing the new extension for it to become active.

    Thanks!

  10. techvx commented on Apr 23, 2024

    @techvx
    Author

    It does work as intended now:

    image

    Thanks for the speed on this one.

  11. DanTup commented on Apr 23, 2024

    @DanTup
    Member

    Great, thanks for confirming (and bringing it to my attention!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions