Using the latest nuget package 1.2.8 of System.Linq.Dynamic.Core.
Exception is thrown when using Trim() on a string field.
Exception
System.Linq.Dynamic.Core.Exceptions.ParseException:
Exception message:
'No applicable method 'Trim' exists in type 'String''
Stack trace:
System.Linq.Dynamic.Core.Exceptions.ParseException
HResult=0x80131500
Message=No applicable method 'Trim' exists in type 'String'
Source=System.Linq.Dynamic.Core
StackTrace:
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseMemberAccess(Type type, Expression expression)
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParsePrimary()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseUnary()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseMultiplicative()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAdditive()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseShiftOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseComparisonOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLogicalAndOrOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIn()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAndOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseOrOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLambdaOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNullCoalescingOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseConditionalOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.Parse(Type resultType, Boolean createParameterCtor)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda[T,TResult](ParsingConfig parsingConfig, Boolean createParameterCtor, String expression, Object[] values)
at TestDynamicLinq.frmTest.btnTest_Click(Object sender, EventArgs e) in D:\Code\System.Linq.Dynamic.Core-master\System.Linq.Dynamic.Core-master\TestDynamicLinq\frmTest.cs:line 29
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at TestDynamicLinq.Program.Main() in D:\Code\System.Linq.Dynamic.Core-master\System.Linq.Dynamic.Core-master\TestDynamicLinq\Program.cs:line 19
3. Code to reproduce
public class Person
{ public string Name { get; set; } }
string query = "Name.Trim()=\"John\"";
var exp = DynamicExpressionParser.ParseLambda<Person, bool>(null, false, query, null); // throws exception
4. Any further technical details
The code works with ToUpper() and ToLower() extensions methods.
e.g string query = "Name.ToUpper()="John""; // does not throw an exception
Trim() works when referencing the github solution directly. But throws the exception when using the latest nuget package. What am I missing? Is there a workaround for this?
Using the latest nuget package 1.2.8 of System.Linq.Dynamic.Core.
Exception is thrown when using Trim() on a string field.
Exception
3. Code to reproduce
4. Any further technical details
The code works with ToUpper() and ToLower() extensions methods.
e.g string query = "Name.ToUpper()="John""; // does not throw an exception
Trim() works when referencing the github solution directly. But throws the exception when using the latest nuget package. What am I missing? Is there a workaround for this?