Loading nullable types fails

4 posts, 0 answers
  1. Nick
    Nick avatar
    14 posts
    Member since:
    Jun 2013

    Posted 17 Feb 2014 Link to this post

    We are using the DataFilter in unbound mode to define an expression which is exported as XML into a database for another program. We allow the expression to be reloaded (interpreted from XML to a CompositeFilterDescriptorCollection) so that it can be edited.

    This works fine, however we are trying to allow 'IsNull' for all types. To do this we are using decimal? instead of decimal etc.

    This works when creating and exporting to XML but when loading again we get an exception (full text at end) when calling this.radDataFilter.FilterDescriptors.AddRange(collection).

    In debug mode the 2 collections (when saving, and when loading) look identical to me. I have attached a screenshot of the object, with the field names blanked out just in case :). Note that I've tried supplying a dummy decimal as shown, and also OperatorValueFilterDescriptorBase.UnsetValue.

    Is there a way around this? WE are using 2013 Q2 so let me know if an upgrade will fix this. We'd rather avoid that unless necessary. Thanks.

    Exception Message: The binary operator Equal is not defined for the types 'System.Nullable`1[System.Decimal]' and 'System.Object'.
    Stack Trace:
       at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
       at System.Linq.Expressions.Expression.Equal(Expression left, Expression right)
       at Telerik.Windows.Data.Expressions.FilterOperatorExpressionBuilderBase.GenerateIsNull(Expression left)
       at Telerik.Windows.Data.Expressions.FilterOperatorExpressionBuilderBase.CreateExpression(Expression left, Expression right)
       at Telerik.Windows.Data.Expressions.OperatorValueFilterDescriptorExpressionBuilderBase.CreateBodyExpression()
       at Telerik.Windows.Data.FilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
       at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
       at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
       at Telerik.Windows.Data.Expressions.FilterExpressionBuilder.CreateFilterExpression()
       at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
       at Telerik.Windows.Data.QueryableCollectionView.CreateView()
       at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
       at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
       at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
       at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
       at Telerik.Windows.Data.QueryableCollectionView.get_InternalCount()
       at Telerik.Windows.Data.QueryableCollectionView.get_Count()
       at Telerik.Windows.Data.DataItemCollection.get_Count()
       at Telerik.Windows.Data.DataItemCollection.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.Listener`2.ReceiveWeakEvent(Object sender, TArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
       at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
       at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
       at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh()
       at Telerik.Windows.Data.QueryableCollectionView.OnFilterDescriptorsChanged()
       at Telerik.Windows.Data.QueryableCollectionView.OnFilterDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.FilterDescriptorCollection.InsertItem(Int32 index, IFilterDescriptor item)
       at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Insert(Int32 index, Object value)
       at Telerik.Windows.Data.CollectionHelper.Insert(IList target, IEnumerable newItems, Int32 startingIndex, IEqualityComparer itemComparer)
       at Telerik.Windows.Data.ObservableCollectionManager.HandleCollectionChanged(IList sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.ObservableCollectionManager.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
       at Telerik.Windows.Data.FilterDescriptorCollection.InsertItem(Int32 index, IFilterDescriptor item)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
       at Telerik.Windows.Data.RadObservableCollection`1.AddRange(IEnumerable`1 items)
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 20 Feb 2014 Link to this post

    Hello Nick,

    Unfortunately, we have not encountered this issue before. May I ask you to open a support ticket and send a small sample where we can reproduce the problem so we can provide a fix or a workaround as soon as possible? 


    Regards,
    Nik
    Telerik
  3. DevCraft banner
  4. Nick
    Nick avatar
    14 posts
    Member since:
    Jun 2013

    Posted 20 Feb 2014 in reply to Nick Link to this post

    Thanks Nik.

    I will need to set up a simpler standalone project but that might take a couple of days. I'll raise a ticket when it's ready.

  5. Nick
    Nick avatar
    14 posts
    Member since:
    Jun 2013

    Posted 24 Feb 2014 in reply to Nick Link to this post

    Hi Nik

    I tried to raise a ticket but I don't have support on this account :) I could look for our official account details but I think I have the answer.

    I was unable to replicate the bug when using unbound mode. However I noticed (after many hours) that someone had also added a data source to the RadDataFilter for some reason during development.

    So, it seems that the bug arises when we have a bound data source, but also manually add ItemPropertyDefinition objects to the filter. I'm not sure whether this should be allowed or not, but anyway it's causing trouble in our situation.
Back to Top