Got NullReferenceException when invoke CalculateAggregates to update gridview nested in DockPane

12 posts, 0 answers
  1. Ke
    Ke  avatar
    12 posts
    Member since:
    Sep 2011

    Posted 26 Sep 2011 Link to this post

    at Telerik.Windows.Controls.GridView.AggregatesToGroupFooterAggregatesConverter.<>c__DisplayClass4.<Convert>b__1(AggregateResult f)
       at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
       at MS.Internal.Data.EnumerableCollectionView.LoadSnapshotCore(IEnumerable source)
       at MS.Internal.Data.EnumerableCollectionView.LoadSnapshot(IEnumerable source)
       at MS.Internal.Data.EnumerableCollectionView.RefreshOverride()
       at System.Windows.Data.CollectionView.Refresh()
       at Telerik.Windows.Controls.GridView.GridViewFooterCell.AggregateResults_CollectionChanged(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.RadObservableCollection`1.ResumeNotifications()
       at Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
       at Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()

    I have two GridViews both host in a DockPane and with sumfuction aggregation footers, the itemsource is ObservableCollection, Everything works well until I dragged one of the panes and docked somewhere in the RadDocking, the NullReferenceException occrured. the stacktrace (as above shown) is my subscription method on propertychanged called the GridView's CalculateAggregates. I also tried the refresh method and rebind method, both got the same exception.
    This only happened after I updated to 2011 Q2 SP1.
  2. Terje Johansen
    Terje Johansen avatar
    28 posts
    Member since:
    Mar 2010

    Posted 27 Sep 2011 Link to this post

    I get the same error when trying to un-dock a Radpane.
    The Radpane has a grid that uses the AggregateFunctions/SumFunction for values displayed in the grid-footer.
    This worked fine before I installed 2011 Q2 SP1 !
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Sep 2011 Link to this post

    Hi Ke and Terje ,

    Indeed, we are aware of such an issue. It was fixed and the fix will be available with the latest internal build that will be uploaded later today. 

    We apologize for the inconvenience caused. 

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Terje Johansen
    Terje Johansen avatar
    28 posts
    Member since:
    Mar 2010

    Posted 04 Oct 2011 Link to this post

    I have updated to version 2011.2.927.40 (latest Internal build), but I still get the same error!

    "Object reference not set to an instance of an object.
    Stacktrace:    at Telerik.Windows.Controls.GridView.AggregatesToGroupFooterAggregatesConverter.<>c__DisplayClass4.<Convert>b__1(AggregateResult f) at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
       at MS.Internal.Data.EnumerableCollectionView.LoadSnapshotCore(IEnumerable source)
    ...................................................."
    Do I have the correct Internal build or can there be yet another problem with the Aggregate/sum function?
    My gridcolumn looks like this:

    <telerik:GridViewDataColumn DataMemberBinding="{Binding BeloepAar, StringFormat=N2}" Header="Årsbeløp (u/mva)" UniqueName="BeloepAar" IsVisible="False" TextAlignment="Right" FooterTextAlignment="Right" IsReadOnly="True" >
                                    <telerik:GridViewDataColumn.CellStyle>
                                        <Style TargetType="GridView:GridViewCell">
                                            <Setter Property="Foreground" Value="{Binding BeloepAar, Converter={StaticResource PriceToColorConverter}}" />
                                        </Style>
                                    </telerik:GridViewDataColumn.CellStyle>
                                   
    <telerik:GridViewDataColumn.AggregateFunctions>
                                        <telerikData:SumFunction Caption="" SourceField="BeloepAar" ResultFormatString="{}{0:c}" />
                                    </telerik:GridViewDataColumn.AggregateFunctions>
                                </telerik:GridViewDataColumn> 
  6. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 04 Oct 2011 Link to this post

    Hi Terje Johansen,

    Can you download the latest internal build - version .1004 and verify whether the exception occurs?
     
    All the best,
    Yordanka
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Terje Johansen
    Terje Johansen avatar
    28 posts
    Member since:
    Mar 2010

    Posted 04 Oct 2011 Link to this post

    Hi,
    Thanks for quick replay!

    I don't get the error anymore, but the SumFunction is not recalculated when I switch between rows in the grid...
    (It get's the value from the first selected row and when I click on the next row it still shows the value from the previous row).
  8. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 05 Oct 2011 Link to this post

    I'm also getting a NullReferenceException.

    All I do I start edit a row then press ESC to cancel the edition.

    Is this the same error?

    Here is the stacktrace :
    à Telerik.Windows.Controls.GridView.GridViewFooterCell.AggregateResults_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
    à System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
    à System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    à Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    à Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications()
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()
    à Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseRowEditEndedEventAndUpdateGridState(GridViewRow gridViewRow, Object newDataItem, GridViewEditAction editAction, GridViewEditOperationType editOperationType, GridViewDataControl parentGrid)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CancelEditInternal(GridViewRow gridViewRow, IEditableCollectionView editableCollectionView, GridViewDataControl parentGrid)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CancelRowEdit(GridViewRow gridViewRow)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CancelCellEdit(GridViewCell cell)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.CancelEdit(GridViewEditingUnit editingUnit)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.OnCancelCellEditCommand(Object sender, ExecutedRoutedEventArgs e)
    à Telerik.Windows.Controls.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
    à Telerik.Windows.Controls.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
    à Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
    à Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
    à Telerik.Windows.Controls.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
    à Telerik.Windows.Controls.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
    à Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    à Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
    à Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
    à Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
    à Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
    à Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
    à Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
    à Telerik.Windows.Controls.RoutedCommand.ExecuteImpl(Object parameter, UIElement target)
    à Telerik.Windows.Controls.RoutedCommand.Execute(Object parameter, UIElement target)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
    à Telerik.Windows.Controls.GridView.GridViewDataControl.PendAndExecuteCommands(KeyEventArgs e)
    à Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
    à System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
    à MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

    I'm doing very simple stuff (that worked before):
    <telerik:GridViewDataColumn Header="Nbre Titres" DataMemberBinding="{Binding NbTitreClient}" UniqueName="NbTitreClient" TextAlignment="Right" IsReadOnly="True" >
                                <telerik:GridViewDataColumn.AggregateFunctions>
                                    <telerik:SumFunction Caption="Total : " SourceField="NbTitreClient" />
                                </telerik:GridViewDataColumn.AggregateFunctions>
                            </telerik:GridViewDataColumn>

    Very annoying to get such regressions once in a while...

    John.
  9. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 05 Oct 2011 Link to this post

    Sorry this post was meant for the Silverlight controls...
  10. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 06 Oct 2011 Link to this post

    Hi all,

    @Terje:
    The issue with updating the aggregates in our Latest Internal Build has been resolved and the fix will be available in our next Internal Build coming next Monday.

    @John:
    I have tried to reproduce the issue you reported, but still without any success. Would you take a look at the sample project attached to verify whether you can get the same exception on it ? 


    Kind regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 14 Jan 2014 Link to this post

    I have the same problem in Silverlight with the current telerik version, here ist the stacktrace:
       bei Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.ConvertMemberAccessExpressionIfNecessary(Expression memberExpression)
       bei Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.CreateMemberSelectorExpression()
       bei Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilderBase.CreateAggregateExpression()
       bei Telerik.Windows.Data.EnumerableSelectorAggregateFunction.CreateAggregateExpression(Expression enumerableExpression)
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<ProjectionPropertyValueExpressions>b__3(AggregateFunction f)
       bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
       bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<CreateMemberBindings>d__0.MoveNext()
       bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       bei System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)
       bei System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateResultSelectorExpression()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.get_ResultSelectorExpression()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
       bei Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateChildQuery(GroupDescriptorExpressionBuilder childBuilder)
       bei Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery()
       bei Telerik.Windows.Data.QueryableExtensions.GroupBy(IQueryable source, IEnumerable`1 groupDescriptors)
       bei Telerik.Windows.Data.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
       bei Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
       bei Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()
       bei Gdata.AntiVirus.Business.Admin.Controls.Extensions.RadGridViewExtensions.CreateDocument(RadGridView grid, PageInfo pageInfo)
  12. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Jan 2014 Link to this post

    Hi Christian,

    I made a blind fix for that issue since I was not able to reproduce. Please download our next internal build and give a try to verify whether the exception is resolved. 

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  13. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 16 Jan 2014 Link to this post

    Thanks, I will try and let you know
Back to Top
UI for WPF is Visual Studio 2017 Ready