Skip to content

[wasm][debugger] Don't fail in presence of multicast delegates#41685

Closed
radical wants to merge 12 commits intodotnet:masterfrom
radical:wasm-multicast-delegates
Closed

[wasm][debugger] Don't fail in presence of multicast delegates#41685
radical wants to merge 12 commits intodotnet:masterfrom
radical:wasm-multicast-delegates

Conversation

@radical
Copy link
Member

@radical radical commented Sep 1, 2020

  • In presence of a MulticastDelegate object as a field/local, we had a bug with handling that member but ended up not being able return any of the members at all. So, try to skip such cases, so we can return others at least.

  • And then fix that multicast delegate case. Essentially, we just return a "symbol" with the typename.

radical added 11 commits August 27, 2020 17:56
- this ensures that we check the datetime, and some property getters on
it, wherever we have a datetime.
- surface inherited fields, and properties
- we try to support `Runtime.getProperties`'s two arguments:
    - `ownProperties`, and `accessorsOnly`

    - `ownProperties`: for JS, this means return only the object's own
    members (not inherited ones)
    - `accessorsOnly`: for JS, this means return all the getters

Actual implementation:

- In practice, VSCode, and Chrome debugger seem to only send
`{ ownProperties: true, accessorsOnly: false }`,
and `{ ownProperties: false, accessorsOnly: true }`. The combination of
which means - that we don't return any inherited fields!

- But we want to show inherited fields too, so to get that behavior we
essentially *ignore* `ownProperties`. IOW,

    - `ownProperties`: we return all fields, and properties
    - `accessorsOnly`: we return only the getters, including the
    inherited ones

- Another thing to note is the case for auto-properties
    - these have a backing field
    - and we usually return the backing field's value, instead of
    returning a getter
    - To continue with that, auto-properties are *not* returned for
    `accessorsOnly`

- The code in `mini-wasm-debugger.c` does handle these two arguments,
but that is currently disabled by not passing the args to debugger.c at
all
    - Instead, we get the *full* list of members, and try to filter it
    in `library_mono.js`
    - which includes handling property overrides, or shadowing by new
    properties/fields in derived classes
- When we have a struct local in an async instance method, it doesn't
get expanded, since we have a containerId (the async object), and we can
expand/access it later.

- When the IDE asks us to expand it with `{accessorPropertiesOnly: true}`:
    - we get the expanded json, but `_filter_automatic_properties` tries
    to return just the accessors, but that doesn't handle the expanded
    members of nested structs!
    - That is done in `extract_and_cache_value_types`, which is run *after*
    `_filter_automatic_properties`, but by that time we have already
    lost the expanded members!

    - So, `_get_vt_properties` fails with `Unknown valuetype id`,
    because it doesn't have anything to return at that point.

- This is being solved by ignoring the getProperties args in case of
expanding valuetypes.
    - that means that we can correctly extract, and cache the whole
    object.
    - And after that, we can return accessors/others, based on the args.
.. property. Some times we might not get a `value`, or `name`, or it
might instead have a `get`. Handle those cases correctly when combining
the name/value/get objects.

This showed up in case of a `MulticastDelegate`, where we didn't have a
`value`, and ended up incorrectly combining the name/value objects, thus
returning incorrect locals.
- Essentially we just surface these as a symbol showing the type name
@ghost
Copy link

ghost commented Sep 1, 2020

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

@radical
Copy link
Member Author

radical commented Sep 1, 2020

Based on #41480 , so it includes changes from that. I can rebase once that gets merged.

@radical radical added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 1, 2020
@radical radical removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 1, 2020
@radical radical closed this Sep 1, 2020
@radical radical deleted the wasm-multicast-delegates branch September 1, 2020 19:01
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants