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

Exception thrown attempting to Eval Valid c# #64

Closed TehWardy closed 4 years ago

TehWardy commented 4 years ago

I figured i'd just get right to the details and put together the bits in a gist ...

https://gist.github.com/TehWardy/24c22e3131e6cf422b6d5f4be95f08c1

... pull the 3 files in to a new console app (i'm using .Net Core 2.2 in case it matters) then run, it's all good until the func compile.

Let me know if you need anything else to help resolve this.

JonathanMagnan commented 4 years ago

Hello @TehWardy ,

Thank you for reporting, I believe we have enough information.

I'm not sure if there is more error yet but at least we can reproduce the issue and get the first error which happens here Currency = ((dynamic)source).Currency.Value

I will let you know when we will have more information about it.

Best Regards,

Jon

JonathanMagnan commented 4 years ago

Hello @TehWardy ,

Just to let you know, we have made a lot of progression in this issue.

The first 2 cases are now solved and we believe we are on the last one which is caused by the following line in your list initialization:

(((dynamic)source).FunderReference.Value != string.Empty) ? "Funder|FCS|" + ((dynamic)source).FunderReference.Value : string.Empty,
JonathanMagnan commented 4 years ago

Hello @TehWardy ,

One issue is remaining: A constructor with dynamic parameter

A quick fix is simply to cast the dynamic parameter by the right type:

new DateTimeOffset((DateTime)((dynamic)source).PaymentDate.Value)

We will continue to investigate a solution tomorrow. Otherwise, we will probably release the code that fix all other case we got in your expression.

JonathanMagnan commented 4 years ago

Hello @TehWardy ,

The v.3.0.5 has been finally released.

Could you confirm that everything is now working as expected with your expression?

JonathanMagnan commented 4 years ago

Hello @TehWardy,

Since our last conversation, we haven't heard from you.

Did you get the time to try the v.3.0.5?

Don't hesitate to contact us for questions, issues or feedback.

Looking forward to hearing from you,

Jon

TehWardy commented 4 years ago

Thanks @JonathanMagnan, sorry I've been crazy busy. I'll close this out for now and when I get on to this again, if it's still a problem I can always re-open / open a new ticket for that issue.

I have every confidence that it's solved though :)

Thanks again!