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

Error when sending lookupPackageUris request #1527

Closed
helin24 opened this issue Mar 7, 2022 · 4 comments
Closed

Error when sending lookupPackageUris request #1527

helin24 opened this issue Mar 7, 2022 · 4 comments

Comments

@helin24
Copy link

helin24 commented Mar 7, 2022

In a previous version of the Flutter Intellij plugin (65.0), we tried using lookupPackageUris to map breakpoints. This did not work when running an app in Chrome - the error the plugin received was:

{"code":-32603,"message":"lookupPackageUris: NoSuchMethodError: Class 'String' has no instance method 'toJson'.\nReceiver: \"package:hello_flutter_external/main.dart\"
Tried calling: toJson()","data":{"details":"
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      UriList.toJson.<anonymous closure> (package:vm_service/src/vm_service.dart:8141:34)
#2      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
#4      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#5      new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#6      new List.of (dart:core-patch/array_patch.dart:51:28)
#7      ListIterable.toList (dart:_internal/iterable.dart:213:44)
#8      UriList.toJson (package:vm_service/src/vm_service.dart:8141:44)
#9      VmServerConnection._delegateRequest (package:vm_service/src/vm_service.dart:1710:28)
<asynchronous suspension>
","request":{"jsonrpc":"2.0","id":"18","method":"lookupPackageUris","params":{"isolateId":"1","uris":["file:///Users/helinx/IdeaProjects/hello_flutter_external/lib/main.dart"]}}}}

The request was: {"isolateId":"1","uris":["file:///Users/helinx/IdeaProjects/hello_flutter_external/lib/main.dart"]}

@annagrin
Copy link
Contributor

annagrin commented Mar 8, 2022

/cc @bkonyi Looks like the problem happens after the response is returned from dwds - should I redirect this to you? It seems that the problem is in VmServerConnection that dwds uses. Dwds responds with a UriList but it fails to convert to json.

@bkonyi
Copy link
Collaborator

bkonyi commented Mar 8, 2022

Ah, I see now. The list of URIs should be List<String?> but is List<dynamic> instead, so the code generator is likely just assuming there's a toJson() method present.

@annagrin
Copy link
Contributor

Fixed in SDK repo. @helin24 pub upgrade should pull the new version of package:vm_service that works with the existing dwds. Please let me know if there is still a problem!

@annagrin
Copy link
Contributor

Closing as fixed, please feel free to reopen if you encounter any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants