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

ParseException after update from v.1.0.8.18 to 1.0.9.0 or any newer (till 1.3.7) #757

Closed
OlegNadymov opened this issue Nov 22, 2023 · 7 comments
Assignees
Labels

Comments

@OlegNadymov
Copy link
Contributor

1. Description

I have string expressions with inner string statements, e.g.:

StaticHelper.First(StaticHelper.SubSelect("Identity", "AdditionalProcessState", "Code = ""New"" ", ""))

The class:

public static class StaticHelper
{
    public static Guid? GetGuid(string name)
    {
        return Guid.NewGuid();
    }
    public static SqlExpression SubSelect(string columnName, string objectClassName, string filter, string order)
    {
        return new SqlExpression();
    }

    public static object First(SqlExpression sqlExpression)
    {
        return Guid.NewGuid().ToString();
    }
}

public class SqlExpression
{
}

This class is already used in TestCustomTypeProvider of your test class DynamicExpressionParserTests.

I try to parse the expression this way:

var exp = @"StaticHelper.First(StaticHelper.SubSelect(""Identity"", ""AdditionalProcessState"", ""Code = """"New"""" "", ""Order""))";
var lambda = DynamicExpressionParser.ParseLambda(config, typeof(User), null, exp);

2. Exception

Message: 

    System.Linq.Dynamic.Core.Exceptions.ParseException : ')' or ',' expected

Stack Trace: 

    TextParser.ValidateToken(TokenId tokenId, String errorMessage) line 451
    ExpressionParser.ParseArgumentList() line 2167
    ExpressionParser.ParseMemberAccess(Type type, Expression expression) line 1794
    ExpressionParser.ParseTypeAccess(Type type, Boolean getNext) line 1701
    ExpressionParser.ParseIdentifier() line 976
    ExpressionParser.ParsePrimaryStart() line 843
    ExpressionParser.ParsePrimary() line 811
    ExpressionParser.ParseUnary() line 806
    ExpressionParser.ParseArithmetic() line 751
    ExpressionParser.ParseAdditive() line 718
    <25 more frames...>
    ExpressionParser.ParseOrOperator() line 290
    ExpressionParser.ParseLambdaOperator() line 270
    ExpressionParser.ParseNullCoalescingOperator() line 257
    ExpressionParser.ParseConditionalOperator() line 241
    ExpressionParser.Parse(Type resultType, Boolean createParameterCtor) line 156
    DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) line 121
    DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) line 98
    DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values) line 357
    DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Type itType, Type resultType, String expression, Object[] values) line 319

3. Fiddle or Project

I have done changes in DynamicExpressionParserTests adding SqlExpression, StaticHelper.SubSelect, StaticHelper.First locally only to check the first version where I can't parse my expressions. I have not done any PR.

4. Any further technical details

It is working on v.1.0.8.18.
But it is not working on versions since 1.0.9.0 till the latest 1.3.7.

I want to upgrade to the latest version because of:

Warning As Error: Package 'System.Linq.Dynamic.Core' 1.0.8.18 has a known critical severity vulnerability, https://github.com/advisories/GHSA-w65q-jcmv-28gj
@StefH StefH self-assigned this Nov 23, 2023
@StefH StefH added the bug label Nov 23, 2023
@StefH
Copy link
Collaborator

StefH commented Nov 24, 2023

#758

@StefH
Copy link
Collaborator

StefH commented Nov 24, 2023

@OlegNadymov
It should be fixed.

please try preview NuGet from
https://www.myget.org/F/system-linq-dynamic-core/api/v3/index.json

@OlegNadymov
Copy link
Contributor Author

@OlegNadymov It should be fixed.

please try preview NuGet from https://www.myget.org/F/system-linq-dynamic-core/api/v3/index.json

@StefH thank you!
I'll be able to check tomorrow. I'll let you know.

@OlegNadymov
Copy link
Contributor Author

@StefH I've done several tests. Everything is Ok! 👍
When are you going to release this fix?

@StefH
Copy link
Collaborator

StefH commented Nov 28, 2023

I cannot give an indication when this will be released, for now use that preview version.

@StefH StefH closed this as completed Nov 28, 2023
@OlegNadymov
Copy link
Contributor Author

Ok. Thank you!

@OlegNadymov
Copy link
Contributor Author

OlegNadymov commented Nov 29, 2023

@StefH I did more tests. Unfortunately, the new version still does not work with more complex expressions. I'll make a new issue with the demo. Here: #759

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

No branches or pull requests

2 participants