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

Old issue has come back #901

Closed
OlegNadymov opened this issue Feb 24, 2025 · 4 comments
Closed

Old issue has come back #901

OlegNadymov opened this issue Feb 24, 2025 · 4 comments
Assignees
Labels

Comments

@OlegNadymov
Copy link
Contributor

After updating from 1.3.8 to 1.6.0.2 the issue has come back:
#195

Again I can't use inner double quoutes in my expression. But I have a condiserable number of similar expressions.
Can you fix it again?

@StefH
Copy link
Collaborator

StefH commented Feb 24, 2025

@OlegNadymov
Can you please provide a full code example?

@OlegNadymov
Copy link
Contributor Author

@StefH
For instance this expression gives me "Syntax error":

var innerFilter = System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda<System.Linq.Dynamic.Core.Tests.Helpers.Models.User, bool>(null, true, "UserName = \"\"test\"\"");

More exception info:

 Message:System.Linq.Dynamic.Core.Exceptions.ParseException : Syntax error

 Stack Trace: 
   TextParser.ValidateToken(TokenId tokenId, String errorMessage) line 478
   ExpressionParser.Parse(Type resultType, Boolean createParameterCtor) line 184
   DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) line 120
   DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) line 98
   DynamicExpressionParser.ParseLambda[T,TResult](ParsingConfig parsingConfig, Boolean createParameterCtor, String expression, Object[] values) line 210
   DynamicExpressionParserTests.DynamicExpressionParser_ParseLambda_With_InnerStringLiteral() line 1176
   InvokeStub_DynamicExpressionParserTests.DynamicExpressionParser_ParseLambda_With_InnerStringLiteral(Object, Object, IntPtr*)
   MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@StefH StefH self-assigned this Feb 25, 2025
@StefH StefH added the question label Feb 25, 2025
@StefH
Copy link
Collaborator

StefH commented Feb 25, 2025

@OlegNadymov
In your case, You need to set StringLiteralParsingType to StringLiteralParsingType.EscapeDoubleQuoteByTwoDoubleQuotes

See
https://dynamic-linq.net/advanced-configuration#stringliteralparsingtype-since-v1.4.3

@StefH StefH closed this as completed Feb 25, 2025
@OlegNadymov
Copy link
Contributor Author

@StefH
This is exactly what I needed. Thank you!

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