Owner base type property calling produce runtime error


I have specified the Owner property for the expression object, and the type of owner object has base type which is not Object. When I get the value of base type property, an runtime exception occurred. My related code is (C#):
public abstract class Constraint
    private string name = "";
    public string Name
        get { return name; }
        set { name = value; }
public class PrimaryKey : Constraint
Template calculate code is:
ExpressionContext expressionContext = new ExpressionContext();
expressionContext.Options.StringComparison = StringComparison.InvariantCultureIgnoreCase;
bool brs = ExpressionFactory.CreateGeneric<bool>("Name<>null", new PrimaryKey(), expressionContext).Evaluate();
When I was debugging into method ExpressionOptions.IsOwnerType(ByVal t As Type), I found that the value of Me.OwnerType is Constraint and t is PrimaryKey. So the IL code Ldarg_0 cannot be generated. And then I modified this method body to Return t.IsAssignableFrom(Me.OwnerType), It works well.


ECiloci wrote Jan 9, 2008 at 3:50 AM

Looks like a simple fix. Thanks for reporting it.

wrote Jan 12, 2008 at 4:48 AM

wrote Feb 22, 2013 at 12:54 AM

wrote May 16, 2013 at 12:24 PM

wrote May 16, 2013 at 12:24 PM

wrote Jun 14, 2013 at 8:28 AM