Quantcast
Channel: Fast Lightweight Expression Evaluator
Viewing all articles
Browse latest Browse all 96

Closed Issue: Owner base type property calling produce runtime error [3107]

$
0
0
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.

Viewing all articles
Browse latest Browse all 96

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>