Consider I have the following classes
public class Element
{
public Location Location { get; set; }
}
public class Location
{
public string Name { get; set; }
}
public class LocationPoint : Location
{
public string Point { get; set; }
}
var e = new Element
{
Location = new LocationPoint
{
Name = "N",
Point = "X"
}
};
var engine = new V8ScriptEngine();
engine.AddHostObject("e", e);
Console.WriteLine(engine.Evaluate("e.Location.Point"));
Point value will be undefined. It seems like Clearscript uses reflection to get the property for "Element" but in this case, the property "Location" is not a "Location" but it is a derived class "LocationPoint".