Skip to content

serviceInfoFile doesn't seem to work for custom flutter embedders #3353

Closed

Description

@knopp

My flutter application writes a service info file, but when I specify it in the launcher configuration Dart-Code doesn't poll for it.

vmServiceUri with prompt works as expected, but it's not ideal to have to copy and paste the URI on every launch.

  • Dart extension version: dart 3.22.0
  • Dart/Flutter SDK version: current master

Activity

  1. changed the title [-]serviceInfoFile doesn't seem to work for flutter[/-] [+]serviceInfoFile doesn't seem to work for custom flutter embedders[/+] on May 18, 2021
  2. knopp commented on May 18, 2021

    @knopp
    Author

    The application is not built through the flutter tool so I can't run it using flutter run. flutter attach works, but I need to specify vmServiceUri on every launch.

    (down the line it would also be nice to have option for Dart-Code to launch a custom executable with --write-service-info), but for now at least serviceInfoFile working would be a big quality of life improvement.

  3. added this to the v3.23.0 milestone on May 19, 2021
  4. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    in flutterRelates to running Flutter apps
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on May 19, 2021
  5. DanTup commented on May 19, 2021

    @DanTup
    Member

    down the line it would also be nice to have option for Dart-Code to launch a custom executable with --write-service-info

    You might be able to do this with a preLaunchTask (eg. cause the debug config to run a background task that spawns the app before it tries to debug) or a compound config (one that runs a Dart script that sets up the file and spawns your process) - I don't know how messy that would be though.

    There is also some support for overriding the Flutter/Dart binaries, but it's aimed at some specific Bazel workspace setups so not something official supported for this, but may be another option to improve things until/unless something better is available:

    config.activateDevToolsEagerly = !!flutterConfig.devtoolsActivateScript;
    config.dartSdkHomeLinux = makeFullPath(flutterConfig.dartSdkHome?.linux);
    config.dartSdkHomeMac = makeFullPath(flutterConfig.dartSdkHome?.macos);
    // This one replaces the args "global activate devtools"
    config.devtoolsActivateScript = makeScript(flutterConfig.devtoolsActivateScript, 3);
    // This one replaces the args "global run devtools"
    config.devtoolsRunScript = makeScript(flutterConfig.devtoolsRunScript, 3);
    config.flutterDaemonScript = makeScript(flutterConfig.daemonScript);
    config.flutterDoctorScript = makeScript(flutterConfig.doctorScript);
    config.flutterRunScript = makeScript(flutterConfig.runScript);
    config.flutterSdkHome = makeFullPath(flutterConfig.sdkHome);
    config.flutterTestScript = makeScript(flutterConfig.testScript);
    config.flutterVersionFile = makeFullPath(flutterConfig.versionFile);

    As for the original request - looking at FlutterDebugSession, attachRequest calls launchRequest which calls into DartDebugSession.launchRequest so I don't think it should be complicated to fix this - I suspect there are just some bad assumptions somewhere.

  6. DanTup commented on May 19, 2021

    @DanTup
    Member

    Although this works in my testing with simple Flutter, it's not working for @knopp:

    [1:28:22 PM] [FlutterRun] [Info] [Flutter: Attach to Process] Spawning flutter with args ["attach","--machine","-d","macos","--debug-uri","ws://127.0.0.1:60238/40DHMrlkLa0=/ws","--devtools-server-address","http://127.0.0.1:9100/","-v"]
    
    [ +104 ms] Exception attempting to connect to the VM Service: WebSocketException: Connection to 'http://127.0.0.1:60238/40DHMrlkLa0=/ws/ws#' was not upgraded to websocket
    

    The /ws/ws looks suspicious - though it's interesting I'm not seeing that (I did see the URL mangled in a different way though, it ended up with .,/ws on the end - but it still worked). Perhaps something changed in Flutter (I'm on master).

  7. reopened this on May 19, 2021
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 sessionsin flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions