Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting DWDS error when deubg on web #2297

Closed
burhankhanzada opened this issue Dec 6, 2023 · 10 comments · Fixed by flutter/flutter#140711
Closed

Getting DWDS error when deubg on web #2297

burhankhanzada opened this issue Dec 6, 2023 · 10 comments · Fixed by flutter/flutter#140711
Assignees
Labels
P2 A bug or feature request we're likely to work on package:dwds

Comments

@burhankhanzada
Copy link

Getting DWDS error when deubg on web on every object which i what to see properties

Screenshot 2023-12-06 at 8 38 34 AM
[✓] Flutter (Channel stable, 3.16.2, on macOS 14.2 23C5055b darwin-arm64, locale en-US)
    • Flutter version 3.16.2 on channel stable at /Users/burhankhanzada/Development/Google/Flutter/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9e1c857886 (5 days ago), 2023-11-30 11:51:18 -0600
    • Engine revision cf7a9d0800
    • Dart version 3.2.2
    • DevTools version 2.28.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/burhankhanzada/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Build 15A5160n
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 14.2 23C5055b darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 119.0.6045.199

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

! Doctor found issues in 1 category.
@kNoAPP
Copy link

kNoAPP commented Dec 10, 2023

I am also having this issue (Flutter 3.16.0/Chrome/Windows 11).
Screenshot 2023-12-10 153243

@BenjiFarquhar
Copy link

I also have this issue while debugging web in vs code.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2023.2.2)
[✓] VS Code (version 1.84.2)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

@elliette elliette added the P2 A bug or feature request we're likely to work on label Dec 13, 2023
@elliette elliette self-assigned this Dec 13, 2023
@elliette
Copy link
Contributor

I fixed the cast error in #2303 but have continued investigating because I want to understand why this is happening when debugging from VS Code but not from DevTools.

This happens when inspecting a Flutter widget, a widget's state or the build context. I haven't been able to reproduce for any other objects.

I added some logging in DWDS to the calls to getObject, and see that when a widget's State is expanded during inspection, VS Code requests some classes that DevTools does not request:

DevTools:

Screenshot 2023-12-19 at 10 21 21 AM

VS Code:

Screenshot 2023-12-19 at 10 24 40 AM

One of those classes is Object_Diagnosticable, and it is this class that is the problem. When we try to evaluate it here we get a null result value. With #2303, we are simply turning a null result into an empty map to suppress any errors, but ideally I would like to return null (which will throw an exception in the getObject call):

getObject: (-32603) Unexpected DWDS error for getObject: Exception: Could not construct class: [ClassRef id: classes|dart:core|Object_Diagnosticable, name: Object_Diagnosticable, library: [LibraryRef id: dart:core, name: dart:core, uri: dart:core]]
#0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:265:34)
#1      VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1771:25)
#2      VmService._call (package:vm_service/src/vm_service.dart:1783:8)
#3      VmService.getObject (package:vm_service/src/vm_service.dart:1003:7)
#4      ProtocolConverter._getterNamesForClassHierarchy (package:dds/src/dap/protocol_converter.dart:740:25)
<asynchronous suspension>
#5      ProtocolConverter.convertVmInstanceToVariablesList (package:dds/src/dap/protocol_converter.dart:300:13)
<asynchronous suspension>
#6      DartDebugAdapter.variablesRequest (package:dds/src/dap/adapters/dart.dart:2008:26)
<asynchronous suspension>
#7      BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:141:7)
<asynchronous suspension>

However, that causes VS Code to show only the error:

Screenshot 2023-12-19 at 10 30 58 AM

@DanTup A couple questions - any idea why Dart-Code is requesting the classes (including Object_Diagnosticable) that DevTools is not? And would it make sense for Dart-Code to catch any errors instead of showing them in the UI (and still displaying all the fields / properties that don't throw exceptions)?

@DanTup
Copy link
Contributor

DanTup commented Dec 19, 2023

A couple questions - any idea why Dart-Code is requesting the classes (including Object_Diagnosticable) that DevTools is not?

In VS Code we show getters, but since they're not included in the objects (like fields), we have to walk up all of the superclasses and fetch them to get their getters:

https://github.com/dart-lang/sdk/blob/fe8a13d0b3aa4a37e1dbf687a3fb58e3f9aa06ff/pkg/dds/lib/src/dap/protocol_converter.dart#L299

My guess is DevTools doesn't do this?

And would it make sense for Dart-Code to catch any errors instead of showing them in the UI (and still displaying all the fields / properties that don't throw exceptions)?

Yes, I think this is a bug. Probably here:

https://github.com/dart-lang/sdk/blob/fe8a13d0b3aa4a37e1dbf687a3fb58e3f9aa06ff/pkg/dds/lib/src/dap/protocol_converter.dart#L739-L740

We should have error handling so that failing to fetch a single object doesn't fail the whole thing (if you're not already making changes in there and want me to fix, please open an SDK and assign to me and I'll take a look) - although it's not clear to me why that particular class isn't valid to call 🤔

@elliette
Copy link
Contributor

Yes, I think this is a bug. Probably here:

https://github.com/dart-lang/sdk/blob/fe8a13d0b3aa4a37e1dbf687a3fb58e3f9aa06ff/pkg/dds/lib/src/dap/protocol_converter.dart#L739-L740

We should have error handling so that failing to fetch a single object doesn't fail the whole thing (if you're not already making changes in there and want me to fix, please open an SDK and assign to me and I'll take a look) - although it's not clear to me why that particular class isn't valid to call 🤔

SG! I opened https://dart-review.googlesource.com/c/sdk/+/342704 for a quick fix

@elliette
Copy link
Contributor

Update: we are working on getting this fixed for everyone.

In the meantime, you can use the following workaround:

From your VS Code settings, got to Extensions > Dart > Run and Debug and then uncheck "Evaluate Getters in Debug Views":

Screenshot 2023-12-20 at 2 53 33 PM

@elliette
Copy link
Contributor

We should have error handling so that failing to fetch a single object doesn't fail the whole thing (if you're not already making changes in there and want me to fix, please open an SDK and assign to me and I'll take a look) - although it's not clear to me why that particular class isn't valid to call 🤔

Hmm it seems like DWDS is looking for it in the wrong library (so it probably is valid to call). I've opened: #2314

@Miiite
Copy link

Miiite commented Dec 21, 2023

Update: we are working on getting this fixed for everyone.

In the meantime, you can use the following workaround:

From your VS Code settings, got to Extensions > Dart > Run and Debug and then uncheck "Evaluate Getters in Debug Views":

Screenshot 2023-12-20 at 2 53 33 PM

I may have misunderstood something, but I don't get why the suggested workaround actually is one ?

I unchecked the specified VSCode setting, and yet in this breakpoint :

Screenshot 2023-12-21 at 17 35 53

I have the following error either in the "variables" tab, or in the "watch" tab

Screenshot 2023-12-21 at 17 34 24

@Reprevise
Copy link

Update: we are working on getting this fixed for everyone.

In the meantime, you can use the following workaround:

From your VS Code settings, got to Extensions > Dart > Run and Debug and then uncheck "Evaluate Getters in Debug Views":

Screenshot 2023-12-20 at 2 53 33 PM

This workaround didn't solve the issue for me. After unchecking the setting, and restarting VS Code, I still get the DWDS cast error (unless that's not what it's meant to solve).

auto-submit bot pushed a commit to flutter/flutter that referenced this issue Jan 3, 2024
…gging from VS Code (#140711)

Update DWDS version on Flutter stable to a hotfix release to resolve dart-lang/webdev#2297

See dart-lang/webdev#2319
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Jan 3, 2024
Bug: dart-lang/webdev#2297
Change-Id: Id7234e7dd758e16ea05fb4b4ccab1593f3ca5ea8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342704
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
@elliette
Copy link
Contributor

This hotfix went out today, so this should now be fixed on Flutter stable. See https://groups.google.com/g/flutter-announce/c/fhCMZHGW36A/m/MeaT3_KiAAAJ

Please run flutter upgrade to upgrade to Flutter 3.16.6

Thank you for your patience!

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