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

cannot view contents of Map<DateTime, List> while debugging #2146

Closed
s-j-a opened this issue Dec 4, 2019 · 11 comments
Closed

cannot view contents of Map<DateTime, List> while debugging #2146

s-j-a opened this issue Dec 4, 2019 · 11 comments
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug
Milestone

Comments

@s-j-a
Copy link

s-j-a commented Dec 4, 2019

I have a structure defined as Map<DateTime, List> , each element of List is also a map. During debugging I cannot view the data in the List maps. Expanding each list element shows only its meta data values (_checkSum, _data, _deletedKeys, _hashMask, _index etc...) not the map key/values. This makes debugging very difficult.

Screen Shot 2019-12-04 at 7 48 33 PM

this worked fine in previous versions

@DanTup DanTup added the is bug label Dec 4, 2019
@DanTup DanTup added this to the v3.8.0 milestone Dec 4, 2019
@DanTup DanTup added the in debugger Relates to the debug adapter or process of launching a debug session label Dec 4, 2019
@DanTup
Copy link
Member

DanTup commented Dec 4, 2019

Thanks, I can reproduce this - seems to only happen when the map has DateTime keys:

Screenshot 2019-12-04 at 4 33 45 pm

I'll see what I can find!

@DanTup
Copy link
Member

DanTup commented Dec 4, 2019

@devoncarew @pq Is there a way to get a log of the VM service traffic from Android Studio? This same code seems to work fine there, but in VS Code we get an object with kind="PlainInstance" and not kind="Map" so I want to figure out what we're doing differently.

Screenshot 2019-12-04 at 5 01 15 pm

@pq
Copy link

pq commented Dec 5, 2019

@DanTup: do you have the Android Studio plugin running from source? I think you'd have to add print statements to the VmServiceManager (IIRC or similar). I'm not in front of the source now but happy to help instrument if you want to spelunk.

@DanTup
Copy link
Member

DanTup commented Dec 5, 2019

do you have the Android Studio plugin running from source?

I don't. Is it simple to set up? (I've never built any java in my life :-))

Or if it's simpler - if I paste the Dart code in here, could you easily run it and capture the VM service traffic?

Failing that - can you point me at the code that is fetching the values for this tree? I'll see if I can see any obvious differences with what you're doing there and I'm doing here. Thanks!

@pq
Copy link

pq commented Dec 6, 2019

Go ahead and paste code here. Setup takes a bit...

@DanTup
Copy link
Member

DanTup commented Dec 9, 2019

@pq Here's the code from above:

import 'dart:convert';

main() {
  final mapOfListOfMaps1 = {
    1: [
      {1: 1, 2: 2},
    ],
  };
  final mapOfListOfMaps2 = {
    DateTime.now(): [
      {1: 1, 2: 2},
    ],
  };

  print('Hello!');
}

If you breakpojnt on the print and expand through mapOfListOfMaps2 to reveal values inside the leaf map (1:1, 2:2) capturing the VM service traffic, that should help my figure out what I'm doing differently.

Thanks!

@DanTup DanTup modified the milestones: v3.8.0, v3.9.0 Jan 16, 2020
@DanTup
Copy link
Member

DanTup commented Mar 11, 2020

@pq ping! I don't support you're able to capture a log for above (or give some hints on how I could do it)?

@DanTup DanTup modified the milestones: v3.9.0, v3.10.0 Mar 24, 2020
@DanTup
Copy link
Member

DanTup commented Apr 14, 2020

@pq ping! :)

(if it's not already possible, maybe there's value in having a way to write logs easily for end users? I'm often wishing I could get logs from Android Studio, and the logs from VS Code come in handy debugging user issues all the time!)

@pq
Copy link

pq commented Apr 14, 2020

Ack! Sorry. Will look today.

EDIT: whoops; looks like this is in the Dart Plugin Debugger -- let me get that setup...

@DanTup
Copy link
Member

DanTup commented Apr 15, 2020

Ok, I finally managed to track this down! It was a silly mistake on my part..

Against the values we track an "evaluateName" (this is a string that evaluates to the value shown, which can be used for "Add Watch", etc.). This only works when the key is a simple type (eg. we can add a watch expression for myMap[1] but not for myMap[someComplexType]).

When fixing up for TypeScript strict mode, I'd incorrectly assumed that value was always present/required to display the map when it's not (it's only required for things like "Add Watch") and caused it to follow a different code path.

@DanTup DanTup closed this as completed in a020575 Apr 15, 2020
@pq
Copy link

pq commented Apr 15, 2020

Good deal @DanTup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug
Projects
None yet
Development

No branches or pull requests

3 participants