zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

Error when as Func<string> #125

Open cesaryuan opened 2 years ago

cesaryuan commented 2 years ago

Execute the code below with EvalManager.DefaultContext.Execute

object handler = "";
if(handler is string)
{
    // anything
    int a = 1;
} 
else if (handler is Func<string>)
{
    (handler as Func<string>)();
}

It will throw Exception like this

Oops! A general error has occurred.Contact our support team for more information or if you believe it's an error on our part: info@zzzprojects.com

Version: 4.0.71

JonathanMagnan commented 2 years ago

Hello @cesaryuan ,

Thank you for reporting, we will look at it.

Best Regards,

Jon

cesaryuan commented 2 years ago

Hi, Any updates here?

JonathanMagnan commented 2 years ago

Hello @cesaryuan ,

Unfortunately supporting it correctly is harder than we initially thought.

The first prototype fix that has been proposed by my employee was refused. This week, we made some progress to better parse this kind of syntax, but we have not completed it yet.

The good thing is that we continue to work on it, so we hope to be able to provide you a fix soon but we do not have any determined date yet.