Skip to content

[wasm][debugger] Object members that are protected accessors are not displayed in debugger window even though proxy is informed about them #75778

Closed

Description

@thaystg

Code:

    private void IncrementCount()
    {
        JObject myObj = new JObject();
        myObj.Add("thays", new JObject());
    }

Disable JustMyCode in Debugger settings.

Try to look at myObj in locals, you will not see the property ChildrenTokens, and we are able to see it in a .net6 app.

This is the definition of it:
protected override IList<JToken> ChildrenTokens => _properties;

Activity

  1. added this to the 7.0.0 milestone on Sep 16, 2022
  2. ilonatommy commented on Sep 20, 2022

    @ilonatommy
    Member

    Current behavior - no internal members:
    image

    while in the reply we are including them:

    {[Result: IsOk: True, IsErr: False, Value: {
      "result": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":24}",
            "className": "Function",
            "description": "get Type ()"
          },
          "name": "Type",
          "isOwn": true,
          "__section": "result",
          "__state": null,
          "__parentTypeId": 44,
          "__isNewSlot": false
        },
    ... etc ...
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":65}",
            "className": "Function",
            "description": "get Path ()"
          },
          "name": "Path",
          "isOwn": false,
          "__section": "result",
          "__state": null,
          "__parentTypeId": 6,
          "__isNewSlot": false
        }
      ],
      "privateProperties": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":29}",
            "className": "Function",
            "description": "get System.Collections.Generic.IDictionary<System.String,Newtonsoft.Json.Linq.JToken>.Keys ()"
          },
          "name": "System.Collections.Generic.IDictionary<System.String,Newtonsoft.Json.Linq.JToken>.Keys",
          "isOwn": true,
          "__section": "private",
          "__state": null,
          "__parentTypeId": 44,
          "__isNewSlot": true
        },
        ... etc ...
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":72}",
            "className": "Function",
            "description": "get Newtonsoft.Json.IJsonLineInfo.LinePosition ()"
          },
          "name": "Newtonsoft.Json.IJsonLineInfo.LinePosition",
          "isOwn": false,
          "__section": "private",
          "__state": null,
          "__parentTypeId": 6,
          "__isNewSlot": true
        }
      ],
      "internalProperties": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":23}",
            "className": "Function",
            "description": "get ChildrenTokens ()"
          },
          "name": "ChildrenTokens",
          "isOwn": true,
          "__section": "internal",
          "__state": null,
          "__parentTypeId": 44,
          "__isNewSlot": false
        }
      ]
    }, Error:  ]}
    

    When we switch off property level sorting the item is returned fine.
    For a normal, user-code non-overridden protected members the problem does not exist.
    For a user-code overridden protected members the problem is there as well, so it's not connected with JMC.

  3. ilonatommy commented on Sep 20, 2022

    @ilonatommy
    Member

    Mininal repro:

        public class MyObject
        {
            public int publicVar => 0;
            internal int internalVar => 1;
            protected int protectedVar => 2;
            private int privateVar => 3;
        }
        
        private void IncrementCount()
        {
            var testMe = new MyObject(); // NOT OK
        }
    

    image

    We can't have tests for it because the Debugger Proxy response is correct and contains all 4 members.

    Proxy's response is fine:

    {[Result: IsOk: True, IsErr: False, Value: {
      "result": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":19}",
            "className": "Function",
            "description": "get publicVar ()"
          },
          "name": "publicVar",
          "isOwn": true,
          "__section": "result",
          "__state": null,
          "__parentTypeId": 7,
          "__isNewSlot": false
        }
      ],
      "privateProperties": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":22}",
            "className": "Function",
            "description": "get privateVar ()"
          },
          "name": "privateVar",
          "isOwn": true,
          "__section": "private",
          "__state": null,
          "__parentTypeId": 7,
          "__isNewSlot": false
        }
      ],
      "internalProperties": [
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":20}",
            "className": "Function",
            "description": "get internalVar ()"
          },
          "name": "internalVar",
          "isOwn": true,
          "__section": "internal",
          "__state": null,
          "__parentTypeId": 7,
          "__isNewSlot": false
        },
        {
          "get": {
            "type": "function",
            "objectId": "dotnet:method:{\"isStatic\":false,\"containerId\":2,\"isValueType\":false,\"methodId\":21}",
            "className": "Function",
            "description": "get protectedVar ()"
          },
          "name": "protectedVar",
          "isOwn": true,
          "__section": "internal",
          "__state": null,
          "__parentTypeId": 7,
          "__isNewSlot": false
        }
      ]
    }, Error:  ]}
    
  4. changed the title [-][wasm][debugger] protected override property not showing in inspector[/-] [+][wasm][debugger] Object members that are protected accessors are not displayed in debugger window even though proxy is informed about them[/+] on Sep 20, 2022
  5. ilonatommy commented on Sep 20, 2022

    @ilonatommy
    Member

    The reason:
    while grouping the members by protection level we were populating internalProperties part of response with internal/protected members. In fact, internalProperties does not correspond with C#'s protection level internal and describes only properties in the js code that are not acessible to the programmer. When debugging a simple js class:
    image
    we can see that protected member is returned along with public member - in results:
    image. In this issue we should remove populating internalProperties and move its contents to result.

  6. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Sep 20, 2022
  7. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Sep 21, 2022
  8. ghost locked as resolved and limited conversation to collaborators on Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions