The data grid works well, and all string and numeric filters works as expected.
However, when ever i try to filter a boolean column and apply it, it throws an error.
I have explained everything in the photos.
InnerException = {"Incorrect number of arguments supplied for call to method 'System.String ToString(System.IFormatProvider)'"}
stacktrace=>
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.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 VHF.Program.Main() in C:\Users\Kaya\source\repos\VHF\VHF\Program.cs:line 46
Hi Fethullah,
We have checked the reported problem. But we are unable to replicate the issue from our end. Find the tested sample in the attachment.
If you are still facing the reported issue, modify the attached sample and share the video illustration of the reported issue. It will be helpful for us to check on it and provide you with a solution as soon as possible.
Regards,
Vasanthkumar D
Hello,
I'd like to revisit this thread because I am having the exact same problem. I'm going to provide a little more information so that maybe you could guess where the error would occur. I understand that it's very hard for you to re-create this problem because you'd have to actually run my application in debug mode with all databases attached.
In any case, here's how the error occurs. In SfDataGrid, I have 2 Boolean columns. Of all the columns shown below, 3 columns are of Custom Class Type and have overridden the ToString() method (MappedAdvertiser, AdvLevel, AdvType). The rest are primitive types (string, bool, long, float). Data is loaded as a BindingSource
sfDataGrid1.DataSource = new BindingSource() { DataSource = lstAdvertisers };
(lstAdvertisers is a List<Advertiser> where Advertiser is a class consisting of all these below columns (some columns are not shown on the DataGrid)
Then I try to Filter the IsDomain column (Boolean)
I get this Exception
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
InnerException
ArgumentException: Incorrect number of arguments supplied for call to method 'System.String ToString(System.IFormatProvider)'
The filtering function works perfectly fine for all other columns (except the 2 Boolean columns as described). I can also sort the Boolean column just fine (so it's just Filtering that causes the error).
I'll include the full stack trace here.
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
System.Transactions Critical: 0 :http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled Unhandled exception ADCMonitoring.exe System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.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.Linq.Expressions.Expression.ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, Int32 count, ParameterInfo[] pis)
at System.Linq.Expressions.Expression.ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ReadOnlyCollection`1& arguments)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable`1 arguments)
at Syncfusion.Data.Extensions.QueryableExtensions.Predicate(IQueryable source, Object constValue, FilterType filterType, FilterBehavior filterBehaviour, Boolean isCaseSensitive, Type sourceType, Type memberType, Expression memExp, ParameterExpression parameterExpression, String propertyName)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicates(ParameterExpression parameterExpression, IQueryable source, FilterPredicate filterPredicate, String mappingName, CollectionViewAdv view, Delegate displayLambda, Delegate valueLambda)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpression(CollectionViewAdv view, IQueryable source, ParameterExpression parameterExpression, String columnName, Boolean returncolExpression, List`1 filterColumns)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpressionExt(CollectionViewAdv view, IQueryable source, ParameterExpression& parameterExpression, String columnName, Boolean returnColumnExpression)
at Syncfusion.Data.QueryableCollectionView.GetPredicateExpression(IQueryable source, ParameterExpression& parameterExpression)
at Syncfusion.Data.QueryableCollectionView.CreateRowFilterPredicate()
at Syncfusion.Data.QueryableCollectionView.RefreshFilter(Boolean isProgrammatic)
at Syncfusion.Data.CollectionViewAdv.set_FilterPredicates(ObservableCollection`1 value)
at Syncfusion.WinForms.DataGrid.GridModel.ApplyColumnFilter(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridModel.FilterColumn(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridFiltering.DataGridFilterControl.b__4b(Object s, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.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.Linq.Expressions.Expression.ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ReadOnlyCollection`1& arguments)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable`1 arguments)
at Syncfusion.Data.Extensions.QueryableExtensions.Predicate(IQueryable source, Object constValue, FilterType filterType, FilterBehavior filterBehaviour, Boolean isCaseSensitive, Type sourceType, Type memberType, Expression memExp, ParameterExpression parameterExpression, String propertyName)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicates(ParameterExpression parameterExpression, IQueryable source, FilterPredicate filterPredicate, String mappingName, CollectionViewAdv view, Delegate displayLambda, Delegate valueLambda)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpression(CollectionViewAdv view, IQueryable source, ParameterExpression parameterExpression, String columnName, Boolean returncolExpression, List`1 filterColumns)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpressionExt(CollectionViewAdv view, IQueryable source, ParameterExpression& parameterExpression, String columnName, Boolean returnColumnExpression)
at Syncfusion.Data.QueryableCollectionView.GetPredicateExpression(IQueryable source, ParameterExpression& parameterExpression)
at Syncfusion.Data.QueryableCollectionView.CreateRowFilterPredicate()
at Syncfusion.Data.QueryableCollectionView.RefreshFilter(Boolean isProgrammatic)
at Syncfusion.Data.CollectionViewAdv.set_FilterPredicates(ObservableCollection`1 value)
at Syncfusion.WinForms.DataGrid.GridModel.ApplyColumnFilter(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridModel.FilterColumn(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridFiltering.DataGridFilterControl.b__4b(Object s, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)System.ArgumentException: Incorrect number of arguments supplied for call to method 'System.String ToString(System.IFormatProvider)'
at System.Linq.Expressions.Expression.ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, Int32 count, ParameterInfo[] pis)
at System.Linq.Expressions.Expression.ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ReadOnlyCollection`1& arguments)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable`1 arguments)
at Syncfusion.Data.Extensions.QueryableExtensions.Predicate(IQueryable source, Object constValue, FilterType filterType, FilterBehavior filterBehaviour, Boolean isCaseSensitive, Type sourceType, Type memberType, Expression memExp, ParameterExpression parameterExpression, String propertyName)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicates(ParameterExpression parameterExpression, IQueryable source, FilterPredicate filterPredicate, String mappingName, CollectionViewAdv view, Delegate displayLambda, Delegate valueLambda)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpression(CollectionViewAdv view, IQueryable source, ParameterExpression parameterExpression, String columnName, Boolean returncolExpression, List`1 filterColumns)
at Syncfusion.Data.QueryableCollectionViewExtensions.GetPredicateExpressionExt(CollectionViewAdv view, IQueryable source, ParameterExpression& parameterExpression, String columnName, Boolean returnColumnExpression)
at Syncfusion.Data.QueryableCollectionView.GetPredicateExpression(IQueryable source, ParameterExpression& parameterExpression)
at Syncfusion.Data.QueryableCollectionView.CreateRowFilterPredicate()
at Syncfusion.Data.QueryableCollectionView.RefreshFilter(Boolean isProgrammatic)
at Syncfusion.Data.CollectionViewAdv.set_FilterPredicates(ObservableCollection`1 value)
at Syncfusion.WinForms.DataGrid.GridModel.ApplyColumnFilter(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridModel.FilterColumn(GridColumn column, List`1 filterPredicates)
at Syncfusion.WinForms.DataGrid.GridFiltering.DataGridFilterControl.b__4b(Object s, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Exception has been thrown by the target of an invocation.
Dinh,
We have checked the reported issue with the provided details. But we are unable
to reproduce the reported issue on our end. Here we have attached the tested
sample and video demo for your reference. Please review the materials and let
us know if we have missed anything. If you are still experiencing the reported
issue, please share the below things,
How did you populate the columns?
Provide the code snippet related to column generations.
Please modify the attached sample and provide a video illustration of the issue.
This will help us better
understand the problem and provide a solution as quickly as possible.