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

One problem after updating from v.1.0.8.18 #771

Closed
OlegNadymov opened this issue Feb 6, 2024 · 1 comment
Closed

One problem after updating from v.1.0.8.18 #771

OlegNadymov opened this issue Feb 6, 2024 · 1 comment
Labels

Comments

@OlegNadymov
Copy link
Contributor

In continuation of #759

1. Description

If I use public methods from my target type, I have the following exception:

  System.Linq.Dynamic.Core.Exceptions.ParseException : Methods on type 'User' are not accessible.

Demo:

public class User
{
    public bool TestMethod1()
    {
        return true;
    }
}

I try to parse the expression this way:

var config = new ParsingConfig
{
     CustomTypeProvider = new TestCustomTypeProvider()
};
var exp = "TestMethod1()";
var lambda = DynamicExpressionParser.ParseLambda(config, typeof(User), null, exp);

2. Exception

  System.Linq.Dynamic.Core.Exceptions.ParseException : Methods on type 'User' are not accessible

Stack Trace: 
  ExpressionParser.ParseMemberAccess(Type type, Expression expression) line 1814
  ExpressionParser.ParseIdentifier() line 1058
  ExpressionParser.ParsePrimaryStart() line 843
  ExpressionParser.ParsePrimary() line 811
  ExpressionParser.ParseUnary() line 806
  ExpressionParser.ParseArithmetic() line 751
  ExpressionParser.ParseAdditive() line 718
  ExpressionParser.ParseShiftOperator() line 694
  ExpressionParser.ParseComparisonOperator() line 482
  ExpressionParser.ParseLogicalAndOrOperator() line 414
  ExpressionParser.ParseIn() line 325
  ExpressionParser.ParseAndOperator() line 308
  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
  DynamicExpressionParserTests.DynamicExpressionParser_ParseLambda_Operator_Less_Greater_With_Guids() line 1453

3. Fiddle or Project

Again, I have done changes in DynamicExpressionParserTests only locally.

4. Any further technical details

It is not working on the release version 1.3.8.

@OlegNadymov
Copy link
Contributor Author

I'm closing the issue as a duplicate for #689

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