2010/Q1: NullReferenceException in DataBindingHelper

12 posts, 1 answers
  1. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 16 Mar 2010 Link to this post

    Hi Telerik,

    Using the 2010/Q1 Release, I have a NullReferenceException in DataBindingHelper.AssignMappingFiledTypes() in case of en empty ItemsSource (ItemsSource and SeriesMapping declaration in XAML).

    This works fine under 2009/Q3.

    [Edited 17:00] Issue appears also within the latest internal build 2010.1.0312.

    Cheers,
    Jani
  2. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 18 Mar 2010 Link to this post

    Hello Jani,

    Please, set the FieldType properties of all ItemMappings with the corresponding types. That should fix it.

    Kind regards,
    Ves
    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.
  3. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 18 Mar 2010 Link to this post

    Hi Ves,

    How can I set the FieldType within XAML?

    Cheers,
    Jani
  4. Vic
    Vic avatar
    40 posts
    Member since:
    Mar 2009

    Posted 18 Mar 2010 Link to this post

    Looking for the XAML solution as well, thanks.
  5. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 22 Mar 2010 Link to this post

    Hello,

    I am afraid, this is not available at the moment. I have notified our developers of this issue so they will research the possibilities to fix it. Please, accept our apologies for the inconvenience.

    Kind regards,
    Ves
    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.
  6. Vic
    Vic avatar
    40 posts
    Member since:
    Mar 2009

    Posted 23 Mar 2010 Link to this post

    Hi Ves,

    When we bind there is a good chance that some of the series are null.. the base collection chartSeries houses the individual dictionaries and is the ItemSource for the chart.

    var chartSeries = new ObservableCollection<Dictionary<DateTime, double>>(); 
    var priceHistory = new Dictionary<DateTime, double>(); 
    var buyAction = new Dictionary<DateTime, double>(); 
    var sellAction = new Dictionary<DateTime, double>(); 
    var shortAction = new Dictionary<DateTime, double>(); 
    var coverAction = new Dictionary<DateTime, double>(); 

    when lets say buyAction and sellAction are empty, a nullref exception is raised:

    System.NullReferenceException occurred
      Message="Object reference not set to an instance of an object."
      StackTrace:
           at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessZoomScrollSettings(QueryableCollectionView dataEngine, ZoomScrollSettings zoomScrollSettings, SeriesMapping seriesMapping, Boolean isValueDateTime, AxisRangeState axisXRangeState)
      InnerException: 

    Thinking that it might be a type issue I tried your suggestion and implemented it in the loaded event for the control as:

          foreach (var seriesMapping in tradeHistoryChart.SeriesMappings) 
                { 
                    foreach (var itemMapping in seriesMapping.ItemMappings) 
                    { 
                        switch (itemMapping.FieldName) 
                        { 
                            case "Value"
                                itemMapping.FieldType = Type.GetType("System.Double"); 
                                break
                            case "Key"
                                itemMapping.FieldType = Type.GetType("System.DateTime"); 
                                break
                        } 
                    } 
                } 

    and it didn't help, this wasn't a problem in the previous release.

    Any help is appreciated.

    Thanks,
    Vic
  7. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 26 Mar 2010 Link to this post

    Hi everyone,

    Our developers improved the behavior in case of databinding to empty source, so you should not experience such issues anymore. The fix will be available in the latest internal build later today.

    Vic,  please, give this LIB a try and if the issue remains - send us small example, attached to support ticket, so we can review it. Thanks.

    Best regards,
    Ves
    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.
  8. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 29 Mar 2010 Link to this post

    Hi Ves,

    Issue is still present in latest internal build 2010_1_0326:
    Error: Unhandled Error in Silverlight Application  
    Code: 4004     
    Category: ManagedRuntimeError        
    Message: System.NullReferenceException: Object reference not set to an instance of an object. 
       at Telerik.Windows.Controls.Charting.DataBindingHelper.AssignMappingFieldTypes(QueryableCollectionView dataEngine, SeriesMapping seriesMapping) 
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessNoGrouping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount) 
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMapping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount) 
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMappings(SeriesMappingCollection seriesMappings, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState) 
       at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDescriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState) 
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea) 
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData) 
       at Telerik.Windows.Controls.RadChart.Rebind(Object originalData) 
       at Telerik.Windows.Controls.RadChart.Rebind() 
       at Telerik.Windows.Controls.RadChart.InternalRebind() 
       at Telerik.Windows.Controls.RadChart.OnApplyTemplate() 
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)    

    Cheers,
    Jani


  9. Vic
    Vic avatar
    40 posts
    Member since:
    Mar 2009

    Posted 29 Mar 2010 Link to this post

    Hi Ves,

    The internal build 2010.1.319.1030 corrects the issue, thanks.

    Though what is the timeframe for the next release?

    Thanks,
    Vic
  10. Answer
    Ves
    Admin
    Ves avatar
    2927 posts

    Posted 31 Mar 2010 Link to this post

    Hi,

    Jani, the chart works correctly for me. Please, make sure you have upgraded correctly.

    Vic, the official service pack is expected in mid-April.

    Best regards,
    Ves
    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.
  11. Jani
    Jani avatar
    61 posts
    Member since:
    Jan 2008

    Posted 01 Apr 2010 Link to this post

    Hi Ves,

    Thanks for your Feedback.

    I have found the reason for my problem. My chart contains an item mapping (DataPointMember=LegendLabel) to a class property which returns a string. Initially the value of this property is null. After loading the chart data asynchronously, the property value contains a string.

    Initializing the property value to an empty string, seems to be a reasonable workaround.

    Thanks again for your support.

    Cheers,
    Jani
  12. Sunil
    Sunil avatar
    14 posts
    Member since:
    Sep 2012

    Posted 28 Oct 2010 Link to this post

    need help

    {System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.Windows.Controls.Charting.DataBindingHelper.AssignMappingFieldTypes(QueryableCollectionView dataEngine, SeriesMapping seriesMapping)
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessNoGrouping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount)
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMapping(SeriesMapping seriesMapping, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState, Int32 seriesCount)
       at Telerik.Windows.Controls.Charting.DataBindingHelper.ProcessMappings(SeriesMappingCollection seriesMappings, QueryableCollectionView dataEngine, Int32 samplingThreshold, ZoomScrollSettings zoomScrollSettings, ISeriesDefinition defaultSeriesDefinition, AxisRangeState axisXRangeState)
       at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDescriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState)
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea)
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData)
       at Telerik.Windows.Controls.RadChart.Rebind(Object originalData)
       at Telerik.Windows.Controls.RadChart.ItemsSourcePropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
       at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
       at System.Windows.Data.BindingExpression.SendDataToTarget()
       at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
       at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
       at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source)
       at System.Windows.CLRPropertyListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args)
       at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args)
       at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
       at iFIS.ViewModel.ViewModelBase.NotifyPropertyChanged(String propertyName)
       at iFIS.ViewModel.CostDashboardViewModel.set_AssetDashboard(ObservableCollection`1 value)
       at iFIS.ViewModel.CostDashboardViewModel.<>c__DisplayClass4.<clientProxy_GetDataCompleted>b__2()}
Back to Top