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

Setting ItemsSource to null causing a null reference exception with 2011 Q2 SP1

3 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Prasanthi
Top achievements
Rank 1
Prasanthi asked on 29 Sep 2011, 04:58 PM
Hi,

We have upgarded to the 2011 Q2 SP1 and all of a sudden, we starting experiencing a null reference exception when we try to set the itemssource to null. This happens only if we sort the grid on any column and then try to set the itemsssource to null.
Is this a known issue in this release or Did we miss anything?

I would appreciate, if you can help us on this.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 30 Sep 2011, 07:08 AM
Hi,

 I've tried this however I was unable to reproduce such exception. Can you post the stack trace?

Regards,
Vlad
the Telerik team

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

0
Michael Evans
Top achievements
Rank 1
answered on 25 Oct 2011, 04:26 PM
I'm getting the same issue.  Here is my stack trace:

{System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Data.DataItemCollection.<SetItemsSource>b__3(NotifyCollectionChangedEventArgs c)
   at Telerik.Windows.Data.DataItemCollection.<>c__DisplayClass18.<BindCollections>b__15(NotifyCollectionChangedEventArgs args)
   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.ComponentModel.SortDescriptionCollection.OnCollectionChanged(NotifyCollectionChangedAction action)
   at System.ComponentModel.SortDescriptionCollection.ClearItems()
   at System.Collections.ObjectModel.Collection`1.Clear()
   at Telerik.Windows.Data.CollectionHelper.Reset(IEnumerable source, IList target, Func`2 itemConverter)
   at Telerik.Windows.Data.CollectionHelper.Reset(IEnumerable source, IList target)
   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.ClearItems()
   at Telerik.Windows.Data.RadObservableCollection`1.ClearItems()
   at Telerik.Windows.Data.ObservableItemCollection`1.ClearItems()
   at System.Collections.ObjectModel.Collection`1.Clear()
   at Telerik.Windows.Data.DataItemCollection.ClearLocalDescriptors()
   at Telerik.Windows.Data.DataItemCollection.set_CollectionView(QueryableCollectionView value)
   at Telerik.Windows.Data.DataItemCollection.ClearItemsSource()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass18.<Bind>b__17()
   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(Object oldValue, Object newValue)
   at Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(DependencyObject origin, DependencyPropertyChangedEventArgs args)
   at Telerik.Windows.PropertyMetadata.PropertyChangeHook.OnPropertyChanged(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.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.DataControl.set_ItemsSource(Object value)
   at EclipsXPIDS.EmergencyMessaging.DevicesLoaded(LoadOperation`1 lo)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )}
0
Vlad
Telerik team
answered on 26 Oct 2011, 06:45 AM
Hello,

 Please open support ticket and send us an example project where we can replicate and debug this. 

Greetings,
Vlad
the Telerik team

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

Tags
GridView
Asked by
Prasanthi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Michael Evans
Top achievements
Rank 1
Share this question
or