Skip to content

Hot reload missing when using new SDK DAPs #4554

Closed

Description

@waleedf112

hot reload doesn't work in vs code, the keyboard shortcut is there in the settings but it doesn't work, the icon isn't there anymore, and only hot restart works.

image

I've tried to run a new app from the terminal and Android Studio and do a hot reload from there with no problems.

Dart: Capture debugging logs
https://pastebin.pl/view/dec2abec

Flutter doctor -v:

[√] Flutter (Channel stable, 3.10.1, on Microsoft Windows [Version 10.0.19045.2846], locale en-US)        
    • Flutter version 3.10.1 on channel stable at C:\Developing\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (2 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.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 C:\Users\WPC\AppData\Local\Android\Sdk\
    • Platform android-33, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\WPC\AppData\Local\Android\Sdk\
    • Java binary at: C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot\bin\java.exe
    • Java version OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.2)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31624.102
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.1)
    • 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 11.0.15+0-b2043.56-9505619)

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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-9586694)

[√] VS Code, 64-bit edition (version 1.78.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.64.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 31) (emulator)      
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version
      10.0.19045.2846]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 112.0.5615.138        
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 113.0.1774.42        

[√] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. waleedf112 commented on May 19, 2023

    @waleedf112
    Author

    also, the debug console acts like I'm running the app from the terminal (no highlighted text, clickable links, etc)

    image

  2. changed the title [-]Hot reload disappeared[/-] [+]Hot reload missing when using new SDK DAPs[/+] on May 19, 2023
  3. added
    in flutterRelates to running Flutter apps
    in debuggingRelates to the debug adapter or process of running debug sessions
    importantSomething important!
    on May 19, 2023
  4. added this to the v3.66.0 milestone on May 19, 2023
  5. DanTup commented on May 19, 2023

    @DanTup
    Member

    This appears to only be happening with the SDK DAPs. Setting "dart.previewSdkDaps": false to force legacy DAPs stops the issue from occurring.

    The log shows that we get the app.started event, but nothing more after (which includes no service extension registrations - hence no hot reload). It's possible the DAP is failing to connect to the VM Service entirely.

    I can't reproduce this, but I can try to make a branch of Flutter stable that just adds some extra debugging to the DAP that might help us track this down. I'll provide instructions on how to switch to it temporarily to capture more information and then switch back once I've done it.

    In the meantime, I would suggest using "dart.previewSdkDaps": false, but that's only a short-term workaround because the legacy debug adapters are not being maintained and we need to migrate everyone to the new ones for support for future features.

  6. modified the milestones: v3.66.0, v3.68.0 on Jun 1, 2023
  7. DanTup commented on Jun 1, 2023

    @DanTup
    Member

    Sorry for the delay, I didn't get back to this as quickly as I expected.

    However, it turns out I can reproduce this - I noticed in your log noDebug: true which means you're using Run and not Debug. In that case we don't connect the VM Service, and presumably aren't registering that Hot Reload is available. This is a bug - it's not intended that you can't Hot Reload in this mode.

  8. modified the milestones: v3.68.0, v3.66.0 on Jun 1, 2023
  9. DanTup commented on Jun 1, 2023

    @DanTup
    Member

    @waleedf112 this was in todays release (v3.66.0). Please try removing "dart.previewSdkDaps": false and updating and let me know if you still see issues. Thanks!

  10. waleedf112 commented on Jun 1, 2023

    @waleedf112
    Author

    @waleedf112 this was in todays release (v3.66.0). Please try removing "dart.previewSdkDaps": false and updating and let me know if you still see issues. Thanks!

    it works now when I removed dart.previewSdkDaps.

    thank you so much 😀

  11. DanTup commented on Jun 1, 2023

    @DanTup
    Member

    Great - thanks for confirming!

  12. waleedf112 commented on Jun 2, 2023

    @waleedf112
    Author

    also, the debug console acts like I'm running the app from the terminal (no highlighted text, clickable links, etc)

    image

    @DanTup
    sorry for not noticing this before, but this issue is still present.

  13. DanTup commented on Jun 2, 2023

    @DanTup
    Member

    @waleedf112 Ah, I missed that. It's possible this is expected when using "Run" (instead of "Debug"), as a lot of the formatting of these errors is done via debugger events that we won't have when there's no debugger.

    But if you file a new issue with a log (as you did previously) when using the latest version, I'll take a look to confirm.

    In the legacy DAPs, we would always connect the debugger, whether you used Run or Debug mode... but this wasn't consistent with Dart, and could slow things down a little. Generally I'd recommend using Debug (not Run) to get all of the debugging functionality (and if there are reasons why you don't want to, I'd be interested in understanding those reasons).

    Thanks!

  14. waleedf112 commented on Jun 2, 2023

    @waleedf112
    Author

    @DanTup I've tried to run the app with the debugger attached, it (mostly) fixed the color highlighting but not the clickable links, also the links aren't in their usual white color:

    with legacy DAPs:
    Code_thxSV3MGrP

    currently:
    Code_BXju27yGVW

    I'd recommend using Debug (not Run) to get all of the debugging functionality (and if there are reasons why you don't want to, I'd be interested in understanding those reasons).

    I've set it to run without the debugger for many years, I don't know if this is still the case but running without the debugger is faster (i think).
    also, i use a lot of debug breakpoints, these many pauses by the debugger sometimes cause a crash on a physical device.
    and when I run the app on multiple devices at the same time, sometimes when breaking it crashes vscode or causes the Flutter daemon to stop.

    I haven't checked if those issues got solved since then.

    Dart-Code-Log-2023-05-05 19-17-57.txt

  15. DanTup commented on Jun 2, 2023

    @DanTup
    Member

    @waleedf112 thanks - could you file a new issue with those screenshots and log?

    I've set it to run without the debugger for many years, I don't know if this is still the case but running without the debugger is faster (i think).

    Yes, it's definitely faster. But it wasn't as fast as it should be using the legacy DAPs (because they were still connecting the debugger). The change in the new one was to not connect the debugger at all (making it even faster :) ) but it means some functionality won't be available. There's a bit of a tradeoff here and I feel that not connecting the debugger for Run makes most sense (it's what we've always done for Dart), but I'm definitely interested in feedback.

    also, i use a lot of debug breakpoints, these many pauses by the debugger sometimes cause a crash on a physical device.
    and when I run the app on multiple devices at the same time, sometimes when breaking it crashes vscode or causes the Flutter daemon to stop.

    If you can reproduce any of this today, please do open additional issues. It's possible they are easy fixes, but I'll need some additional info to look into them (a separate issue for each problem is best, that way some of them can't be overlooked when others are fixed).

    Thanks!

  16. waleedf112 commented on Jun 2, 2023

    @waleedf112
    Author

    @waleedf112 thanks - could you file a new issue with those screenshots and log?

    no problem.

    If you can reproduce any of this today, please do open additional issues. It's possible they are easy fixes, but I'll need some additional info to look into them (a separate issue for each problem is best, that way some of them can't be overlooked when others are fixed).

    i will look into it, should i try to reproduce them in legacy DAPs or not?

  17. DanTup commented on Jun 2, 2023

    @DanTup
    Member

    i will look into it, should i try to reproduce them in legacy DAPs or not?

    Probably not worth it for these - we need to get everyone on the new DAPs as soon as possible, so if they're broken there we should fix them. If they're broken in the legacy DAP, it's less likely they'll be fixed.

    Thanks!

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 bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions