Skip to content

DetectIdentifiers returns class property as unknown #351

@blahetal

Description

@blahetal

Hello
It looks to me that DetectIdentifiers cannot handle class properties and returns them as undefined even tho the variable was registered through SetVariable.

public class TestClass
{
    public string Name { get; set;}
    public int Age { get; set; }
}

TestClass customer = new() { Age = 1, Name = "abc" };
// was testing different options when creating the Interpreter
Interpreter target = new Interpreter(InterpreterOptions.LateBindObject | InterpreterOptions.LambdaExpressions).Reference(typeof(TestClass)).EnableReflection();
target.SetVariable("test", customer);

IdentifiersInfo detectedIdentifiers = target.DetectIdentifiers("test.Name", DetectorOptions.IncludeChildren);
Console.WriteLine($"unknown - {string.Join(", ", detectedIdentifiers.UnknownIdentifiers)}");

Console.WriteLine(target.Eval("test.Name"));

output is

unknown - test.Name
abc

Is this a known behavior or am I missing something. I expect that DetectIdentifiers.UnknownIdentifiers would be empty.

Regards
Libor

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions