-
-
Notifications
You must be signed in to change notification settings - Fork 240
Closed
Description
If pass Dictionary as a parameter for a lambda expression, then DynamicInvoke will return the first result each time. It looks like a cached result is returning.
[Fact]
public void EvalDictionaryParams2()
{
object CreateDicParameter(string name) => new Dictionary<string, object>
{{"Name", new Dictionary<string, object> {{"FirstName", name }}}};
var config = new ParsingConfig()
{
CustomTypeProvider = new DefaultDynamicLinqCustomTypeProvider()
};
var parType = new Dictionary<string, object>().GetType();
var lambda = DynamicExpressionParser.ParseLambda(config, new [] {Expression.Parameter(parType, "item")}, typeof(object), "item.Name.FirstName").Compile();
lambda.DynamicInvoke(CreateDicParameter("Julio")).Should().Be("Julio");
lambda.DynamicInvoke(CreateDicParameter("John")).Should().Be("John"); // Failure. DynamicInvoke returns "Julio"
}Metadata
Metadata
Assignees
Labels
No labels