Debugged Flutter 2 application dies when inspecting locals (hovering or 'Run and debug -> Variables' view)
See original GitHub issueDescribe the bug Whenever a Flutter 2 (2.0.1 to be exact) application is being debugged and a breakpoint is hit, hovering over a variable or expanding it in the ‘Run and debug -> Variables’ view causes the application to die. As a result, there is no way to efficiently debug a Flutter 2 app.
I noticed this with a custom app during the first session trying to debug an issue after Flutter upgrade. After downgrading to Flutter 1.22.6 and going to the latest commit where the app was still on that version, debugging worked as it always used to.
The issue can be reproduced with the simplest Flutter sample app created using this command:
flutter create flutter_counter_sample
The error I see in the console is:
Launching lib/main.dart on iPhone Xs in debug mode...
lib/main.dart:1
Xcode build done. 8.5s
Connecting to VM Service at ws://127.0.0.1:55869/saA4Pe9POFQ=/ws
Error handling 'checkPlatformOverride' custom request: method not available: ext.flutter.platformOverride
Error handling 'checkBrightnessOverride' custom request: method not available: ext.flutter.brightnessOverride
Error handling 'serviceExtension' custom request: method not available: ext.flutter.inspector.setPubRootDirectories
Error handling 'checkIsWidgetCreationTracked' custom request: method not available: ext.flutter.inspector.isWidgetCreationTracked
Lost connection to device.
Exited (sigterm)
No amount of flutter clean
etc. helps.
To Reproduce Steps to reproduce the behavior:
- Create a sample app:
flutter create flutter_counter_sample
- Open the app in VSCode and start with debugging on.
- Set a breakpoint in
_MyHomePageState.build
. - When the app starts, click the
+
button. The debugger will stop at the breakpoint. - Hover over the
context
local or expand it in the ‘Variables’ view. - The application will crash.
Versions (please complete the following information):
- VS Code version: 1.54.1
- Dart extension version: 3.20.1
- Dart/Flutter SDK version: Flutter 2.0.1 with Dart 2.12.0 (stable channel)
Issue Analytics
- State:
- Created 3 years ago
- Comments:34 (6 by maintainers)
Top GitHub Comments
@wujek-srujek We are trying to reproduce the failure locally, however meanwhile could you add
print
statement to the vmservice.dart per below diff, removeflutter_tools.dart.snapshot
fromflutter/bin/cache
folder, runflutter doctor
to rebuild that snapshot and retry reproducing the crash from the vscode capturingDart: Capture Debugging Logs
again hopefully with that additional printed data?@wujek-srujek it’s probably best to follow up about that in the Flutter issue. I don’t think they pre-announce dates, although there’s a little info in the wiki here which suggests beta releases are approximately monthly (although I don’t know whether using a beta branch is viable for you).
I’ll close this as fixed upstream as there’s nothing to do in the VS Code extension - once upgraded to an SDK with the fix, it will automatically apply without requiring any changes here.