Repository navigation
Hot reload missing when using new SDK DAPs #4554
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 sessionsin flutterRelates to running Flutter appsRelates to running Flutter appsis bug
Milestone
Description
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.
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!
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 sessionsin flutterRelates to running Flutter appsRelates to running Flutter appsis bug

Activity
waleedf112 commentedon May 19, 2023
also, the debug console acts like I'm running the app from the terminal (no highlighted text, clickable links, etc)
[-]Hot reload disappeared[/-][+]Hot reload missing when using new SDK DAPs[/+]DanTup commentedon May 19, 2023
This appears to only be happening with the SDK DAPs. Setting
"dart.previewSdkDaps": falseto force legacy DAPs stops the issue from occurring.The log shows that we get the
app.startedevent, 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.DanTup commentedon Jun 1, 2023
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: truewhich 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.Add Dart-Code/Dart-Code#4554
Update tests to expect Hot Reload in Run mode for SDK DAPs
DanTup commentedon Jun 1, 2023
@waleedf112 this was in todays release (v3.66.0). Please try removing
"dart.previewSdkDaps": falseand updating and let me know if you still see issues. Thanks!waleedf112 commentedon Jun 1, 2023
it works now when I removed
dart.previewSdkDaps.thank you so much 😀
DanTup commentedon Jun 1, 2023
Great - thanks for confirming!
waleedf112 commentedon Jun 2, 2023
@DanTup
sorry for not noticing this before, but this issue is still present.
DanTup commentedon Jun 2, 2023
@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!
waleedf112 commentedon Jun 2, 2023
@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:

currently:

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
DanTup commentedon Jun 2, 2023
@waleedf112 thanks - could you file a new issue with those screenshots and log?
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.
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!
waleedf112 commentedon Jun 2, 2023
no problem.
i will look into it, should i try to reproduce them in legacy DAPs or not?
DanTup commentedon Jun 2, 2023
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!
Fix Hot Reload not showing up for noDebug mode with SDK DAPs