vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

Incoherent behavior on asking for object properties details.

Open ilonatommy opened this issue 3 years ago • 1 comments

For most of fields in following test class, properties expansion in watch results in execution "getProperties" (fields with Ok in name). however, when a field has a custom accessor ("NotOk" in the name), properties expansion results in "callFunctionOn" execution. This behavior is not homogenous and makes it difficult to maintain custom debugger based on commands sent by js-debugger.

    public class Test
    {
            public static List<int> listFieldOk = new List<int>() { 1, 2 };
            public static string textFieldOk = "text";

            public static List<int> listPropOk { get; set; }
            public static string textPropOk { get; set; }

            public List<int> listCustomNotOk { get { return new List<int>() { 1, 2 }; } }
            public string textCustomNotOk { get { return "text"; }
            
            public TestEvaluatePropertiesNone()
            {
                listPropOk = new List<int>() { 1, 2 };
                textPropOk = "text";
            }
    }

To Reproduce Steps to reproduce the behavior:

  1. Create a new Blazor Application with Web Assembly
  2. Add the above class to the app, create instance
  3. Add to watch
  4. Compare behavior on expanding properties of Ok and NotOk properties.

Expected behavior On each properties expansion, OnProperties should be called, regardless of the parent's content.

ilonatommy avatar Dec 15 '21 08:12 ilonatommy

Using callFunctionOn is the same behavior that Chrome/Edge devtools use to retrieve accessor values. I'm not aware of any other way to evaluate accessors (aside from equivalent evaluations like Runtime.evaluate). Do you have any suggestions?

connor4312 avatar Dec 15 '21 16:12 connor4312