Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Execute method that requires Dictionary<string, object> parameter #138

Open
JamesHill3 opened this issue Aug 10, 2022 · 3 comments
Assignees

Comments

@JamesHill3
Copy link

JamesHill3 commented Aug 10, 2022

I'm trying to call context.Execute() on a method that requires a Dictionary<string, object> to be passed in. When invoked, I received the following message:

No applicable member has been found for the expression

If I change the parameter passed in to something simple like a string, I'm able to call the method without issue. I've also tried to pass in a Dictionary<string, string> and receive the same message. Here's a pared down version of the code:

public class ExpressionStringLibrary : IDisposable
{
    private Dictionary<string, object> _interpolationValDict;
    private string _testString;

    // This call fails with the error described above
    public void SetInterpolationValDict(Dictionary<string, object> interpolationValDict) => _interpolationValDict = interpolationValDict;

    // This call succeeds with the error described above
    public void SetInterpolationValDictWITHSTRING(string testString) => _testString = testString;
}

Invocation:

// Get eval context
var context = new EvalContext();

// Register static helper
context.RegisterGlobalVariable("exprStrLib", new ExpressionStringLibrary(), true);

// Fails
var interpolationValues = new Dictionary<string, object>();
context.Execute("SetInterpolationValDict({0})", interpolationValues);

// Succeeds
context.Execute("SetInterpolationValDictWITHSTRING({0})", "test");

Should I be able to pass a Dictionary<string, object>?

@JonathanMagnan JonathanMagnan self-assigned this Aug 10, 2022
@JonathanMagnan
Copy link
Member

Hello @JamesHill3 ,

Thank you for reporting, my developer will look at it.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @JamesHill3 ,

Just to give you an update, we currently have a fix under review.

If approved, it will be merged next week.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @JamesHill3 ,

Sorry for the long delay on this issue,

The v4.0.88 has been released, which should fix this issue.

Let me know if everything is now working as expected.

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants