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 2:50 AM

Looks like a simple fix. Thanks for reporting it.

wrote Jan 12, 2008 at 3:48 AM

wrote Feb 21, 2013 at 11:54 PM

wrote May 16, 2013 at 11:24 AM

wrote May 16, 2013 at 11:24 AM

wrote Jun 14, 2013 at 7:28 AM