This is a migrated thread and some comments may be shown as answers.

A first chance exception of type 'System.ArgumentException' occurred in Telerik.Windows.Data.dll

16 Answers 749 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric Kephart
Top achievements
Rank 1
Eric Kephart asked on 29 Oct 2010, 04:00 PM
The following ArgumentException is throwing from Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyDescriptor(PropertyToken token, Type componentType) when a RadGridView binds:

throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Property with name {0} cannot be found on type {1}", new object[] { token.PropertyName, componentType.GetTypeName() }));

gives: "Property with name AfterQty cannot be found on type Object"

Sample:
<telerik2:RadGridView Width="Auto" AutoGenerateColumns="False" HorizontalAlignment="Stretch" ItemsSource="{Binding SelectionList.SelectedItem.Funds}"  >
 <telerik2:RadGridView.Columns>
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding Fund}" Header="Fund" IsReadOnly="True" />
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding BeforeQty}" Header="Before Qty" IsReadOnly="True"/>
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding CurrentQty}" Header="Order Qty" />
   <telerik2:GridViewDataColumn DataMemberBinding="{Binding AfterQty}" Header="After Qty" />
...

SelectionList is an observable collection in another gridview, the details of which load in this one.  Funds is an observable collection on the selected item of the SelectionList.

The first time this binds there is no error.  However, on subsequent selections from the SelectionList, the ArgumentException throws. 


Edit: This happens for each column.  Version 2010.2.924.35

16 Answers, 1 is accepted

Sort by
0
Eric Kephart
Top achievements
Rank 1
answered on 29 Oct 2010, 04:10 PM
Telerik.Windows.Data.dll!Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyDescriptor(Telerik.Windows.Data.Expressions.PropertyToken token, System.Type componentType) Line 86 C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyDescriptorFromToken(Telerik.Windows.Data.Expressions.IMemberAccessToken token, System.Type componentType) Line 70 + 0xc bytes   C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.PropertyPathDescriptor.CreateChildDescriptors(string propertyPath, System.Type type) Line 58 + 0x18 bytes C#
 
mscorlib.dll!System.Collections.Generic.List<System.ComponentModel.PropertyDescriptor>.List(System.Collections.Generic.IEnumerable<System.ComponentModel.PropertyDescriptor> collection) + 0x17a bytes 
 
System.Core.dll!System.Linq.Enumerable.ToList<System.__Canon>(System.Collections.Generic.IEnumerable<System.__Canon> source) + 0x3e bytes  
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.PropertyPathDescriptor.PropertyPathDescriptor(string propertyPath, System.Type componentType) Line 31 + 0x28 bytes    C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyPathInfo.ItemPropertyPathInfo(string propertyPath, System.Type elementType) Line 8 + 0x1c bytes   C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.GetItemProperty(string propertyPath, System.Type elementType) Line 24 + 0x1c bytes C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewBoundColumnBase.TryInitializeItemPropertyInfo() Line 981 + 0x12 bytes    C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridViewBoundColumnBase.InitializeItemPropertyInfo() Line 964 + 0x9 bytes    C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.InitializeNotGeneratedColumnsItemPropertyInfos() Line 2925 + 0xa7 bytes C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.RefreshColumns() Line 3817  C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) Line 3809   C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.RaisePropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) Line 1663    C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.CollectionView.set(Telerik.Windows.Data.QueryableCollectionView value) Line 121    C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.ClearItemsSource() Line 747    C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind.AnonymousMethod__47() Line 3755    C#
 
Telerik.Windows.Controls.dll!Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(System.Windows.FrameworkElement frameworkElement, System.Action action) Line 16 + 0xb bytes   C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(object newValue) Line 3797 C#
 
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(object oldValue, object newValue) Line 3375 + 0xc bytes    C#
 
Telerik.Windows.Data.dll!Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(System.Windows.DependencyObject origin, System.Windows.DependencyPropertyChangedEventArgs args) Line 452 C#
 
WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x4a bytes
0
Vlad
Telerik team
answered on 03 Nov 2010, 09:45 AM
Hi Eric,

 Please open a support ticket and send us small project demonstrating your scenario and these exceptions. 

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tommaso
Top achievements
Rank 1
answered on 07 Jan 2011, 02:22 PM
I have the same issue: I see these ApplicationException when using the DataMemberBinding field in GridViewDataColumn (manually binding in DataTemplate do work without problems).
Is there a fix for this?
0
Vlad
Telerik team
answered on 07 Jan 2011, 02:32 PM
Hello,

 Can you post more info about this binding? 

All the best,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Tommaso
Top achievements
Rank 1
answered on 07 Jan 2011, 02:54 PM
I have a RadGridView, with ItemsSource="{Binding Path=Children}".

Children is a collection of ViewModel classes of type Foo, derived from Bar.

class Bar { ... }

class Foo : Bar { public string Baz {get; set; }}

Inside, I have several GridViewDataColumn.
If I use <Controls:GridViewDataColumn DataMemberBinding="{Binding Baz}" Header="Baz" Name="BazColumn"/>, the application throws ApplicationException

     Telerik.Windows.Data.dll!Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyDescriptor(Telerik.Windows.Data.Expressions.PropertyToken token = {Telerik.Windows.Data.Expressions.PropertyToken}, System.Type componentType = {Name = "ViewModelBase" FullName = "Cosbi.B4B.ViewModel.ViewModelBase"}) Line 86

The message is "Property with name Baz cannot be found on type Bar"
(of course, since Baz is in Foo)


The application do not crash, as the exception is caught elsewhere; however, it is highly undesirable: it is a major performance hit if you have lots of columns, and it jeopardize debugging).

I switch from
<Controls:GridViewDataColumn DataMemberBinding="{Binding Baz}" Header="Baz" Name="BazColumn"/>
to
<Controls:GridViewDataColumn DataMemberBinding="{Binding Baz}" Header="Baz" Name="BazColumn">
                        <Controls:GridViewColumn.CellTemplate>
                            <DataTemplate DataType="TextBlock" >
                                <TextBlock Text="{Binding Baz}" />
                            </DataTemplate>
                        </Controls:GridViewColumn.CellTemplate>
                        <Controls:GridViewColumn.CellEditTemplate>
                            <DataTemplate DataType="TextBox">
                                <TextBox  Text="{Binding Baz}" />
                             </ ... >
                       
which has the same behaviour, but a lot of more typing, I have no exceptions (Binding works perfectly)
I believe is the exact same problem as the OP.
Any fix?
Regards,
0
Vlad
Telerik team
answered on 07 Jan 2011, 03:09 PM
Hi,

 Is this with our latest official version - Q3 2010?

Regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Tommaso
Top achievements
Rank 1
answered on 07 Jan 2011, 03:13 PM
Yes, I think is with 2010 Q3.
Just to be sure: dll version is 2010.3.1110.40

I say it again: the application do not crash, as the exception is caught elsewhere inside the Telerik controls; however, it is highly undesirable: it is a major performance hit if you have lots of columns, and it jeopardize debugging (I have the debugger set to break when an exception is thrown).

Regards,
0
Vlad
Telerik team
answered on 07 Jan 2011, 03:37 PM
Hello,

 I've just tried this however everything worked fine on my end. You can check the attached example application for reference. 

Best wishes,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Tommaso
Top achievements
Rank 1
answered on 07 Jan 2011, 05:25 PM
You are right, the app you submitted is OK
I worked to make it more complex, more similar to our own:
- Use a Resource Dictionay
- More complex class hiearchy

Things started to break when I added the secon View (usercontrol2) with the second "ViewModel" class (Blah)
Find the project in attachment

EDIT: I cannot attach a file.. :( How can I submit it?
I will open a ticket.. Done, ticket ID is: 382159
0
Vlad
Telerik team
answered on 10 Jan 2011, 08:03 AM
Hi,

 I've checked your project however in your case the grid is bound to collection of Bar and such property does not exists on this class. You will get exactly the same problem with standard DataGrid as well. 

Regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Tommaso
Top achievements
Rank 1
answered on 10 Jan 2011, 09:31 AM
The collection is of Bar, but it is filled with Foo objects.
The behaviour is very strange: if I just have one collection (remove Blah, its viewmodel and model) there are no exceptions. Besides, the high level behaviour is correct! So why ApplicationExceptions are risen in the code?
Besides, as I told you, if you explicitly define the binding with CellTemplate and CellEditTemplate, no exception is thrown.
I know it is not a major issue, as the ApplicationException is caught in Telerik code and the overall behaviour is correct, but please do not discard it as a non-issue. If you don't plan to fix it, that's fine, just say it. We will find a workaround.
Best,
Lorenzo
0
Evgeny
Top achievements
Rank 1
answered on 05 Jun 2013, 11:42 AM
The issue persists in the feb13 version as well.
The point is that radgridview wants to be smart and read all prior info about the items it's about to be bound to.
However at times the data is added dynamically and therefore isn't available at the beginning.
Is there any way to tell radgridview to not be that smart and skip the property info loading on items source binding?
0
Dimitrina
Telerik team
answered on 10 Jun 2013, 09:14 AM
Hello,

There is not such a property. What you could try would be to set the ItemType for the GridView.Items collection.

Regards,
Didie
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ollie
Top achievements
Rank 1
answered on 03 Mar 2014, 04:05 PM
Is there a fix for this yet as it is a pain when using dynamic data\columns
0
Dimitrina
Telerik team
answered on 04 Mar 2014, 09:18 AM
Hello,

We have introduced some fixes related to a similar exception. Would you please test with our just released Q1 2014 and let me know about the result? 

Regards,
Didie
Telerik
0
Douwe
Top achievements
Rank 1
answered on 10 Nov 2017, 01:09 PM
I still have the same issues with the 2015.3.930 version of the library; using ExpandoObjects for dynamic columns seems logical but a lot of exceptions are thrown and these have a negative impact on performance. Are there other recommended ways on doing this?
Tags
GridView
Asked by
Eric Kephart
Top achievements
Rank 1
Answers by
Eric Kephart
Top achievements
Rank 1
Vlad
Telerik team
Tommaso
Top achievements
Rank 1
Evgeny
Top achievements
Rank 1
Dimitrina
Telerik team
Ollie
Top achievements
Rank 1
Douwe
Top achievements
Rank 1
Share this question
or