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

Fix getProperties invocation passing length for all objects. #2480

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

biggs0125
Copy link
Contributor

The vm_service Instance spec specifies that the length property specifies that length should be the number of non-static fields for plain objects. In order to align with the VM we've updated the DDC debugger API to include this value of length on plain objects.

However, getProperties is assuming that if a length is provided then it should do a range check with the provided offset and count. This was causing the getProperties code to exit early with no value.

To fix this we only pass the length to getProperties if the kind of the object being inspected is not a plain object. Plain objects should never need a range check.

Fixes #2479.

@biggs0125
Copy link
Contributor Author

It's worth noting that prior to the DDC change that caused this regression, this same bad path could've been reached by having a user-defined class with a length getter that returned a non-zero integer. The same test would've passed an offset and ended up in the same code path that returned [] from getProperties.

Copy link
Collaborator

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@biggs0125 biggs0125 merged commit 45df1cc into dart-lang:main Aug 15, 2024
59 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test/instances/instance_inspection_canary_test.dart: type and fields failing
3 participants