Closed pawel1708hp closed 1 year ago
I think we don't support dynamic casts yet (the expr as Type
expression). PRs welcome :)
Well, according to documentation it is supported ;)
We have the exact issue since upgrading to a newer version. Expressions which worked before, now break.
It could be a regression. could you help us by telling us from which version it stopped working?
Before: 2.8.1.0 After: 2.10.0.0
Test for As_Operator:
Assert.AreEqual(string.IsNullOrEmpty(a as string), target.Eval("string.IsNullOrEmpty(a as string)"));
Manual bisect:
@IAMJDA thanks for narrowing it down! It's indeed a regression in the way the types are parsed: we don't reset the parser position properly if the type has no modifier. I'll need to ensure it's working for all the possible type modifiers. For example:
string?
string?[]
string?[][]
IEnumerable<string>
IEnumerable<string?[]>?[]
but it shouldn't take too long 🤞
I'm trying to use following expression:
string.IsNullOrEmpty(variable as string)
but it results with exception: DynamicExpresso.Exceptions.ParseException: ')' or ',' expected (at index 40).
Adding extra parenthesis as message suggests solves the issue, but the expression is obviously wrong then
string.IsNullOrEmpty(variable as string))
Seems there is something wrong with parser.