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

Null reference in ViewTemplate.get

3 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Guillaume Crétot Richert
Top achievements
Rank 1
Guillaume Crétot Richert asked on 11 Sep 2009, 06:14 PM
Hi!

I'm encountering a Null reference when using RadGridView. The context in which it occurs is rather complex, and recreating the issue in a small, contained project will prove to be a lot of work. Before I head this way to get further support, I would like to post a stack trace in the hopes that someone will recognize this type of error and tell me of a solution.

I realize that this isn't a lot of information to help debugging. I'm just hoping for a quickfix before I get my hands dirty,

Here is the part of the stack trace that matters:

  Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridTableElement.ViewTemplate.get() + 0x6 bytes 
  Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridTableElement.InvalidateColumnWidths(Telerik.WinControls.UI.GridViewColumn column = null, int oldWidth = 0) + 0xc bytes 
  Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewTemplate.UpdateColumns(Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e = {Telerik.WinControls.Data.NotifyCollectionChangedEventArgs}) + 0x22e bytes 
  Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewColumnCollection.NotifyListenersCollectionChanged(Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e = {Telerik.WinControls.Data.NotifyCollectionChangedEventArgs}) + 0x55 bytes 
  Telerik.WinControls.dll!Telerik.WinControls.Data.ObservableCollection<System.__Canon>.OnCollectionChanged(Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) + 0x29 bytes 
  Telerik.WinControls.dll!Telerik.WinControls.Data.ObservableCollection<System.__Canon>.EndUpdate(bool notifyUpdates) + 0x62 bytes 
  Telerik.WinControls.dll!Telerik.WinControls.Data.ObservableCollection<System.__Canon>.EndUpdate() + 0x10 bytes 
  Telerik.WinControls.GridView.dll!Telerik.WinControls.Data.DataAccessComponent.AutoGenerateGridColumns() + 0x301 bytes 
  Telerik.WinControls.GridView.dll!Telerik.WinControls.Data.DataAccessComponent.currencyManager_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) + 0xb4 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.OnListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x17 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.List_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) + 0x51c bytes 
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.OnListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x7e bytes 
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.ResetBindings(bool metadataChanged) + 0x35 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.SetList(System.Collections.IList list, bool metaDataChanged, bool applySortAndFilter = true) + 0xf0 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.ResetList() + 0xd1 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.DataSource.set(object value) + 0x34 bytes 

Below this is my user code. The line that throws the exception assigns a generic list of objects to the DataSource of my BindingSource. The RadGridView uses a master-child GridViewTemplate. The error occurs when I try to assign the DataSource of the child.

Thank you.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 14 Sep 2009, 02:41 PM
Hello Guillaume Crétot Richert,

That's strange. We can't recognize this exception as a pattern. Maybe it is related to the data source that you use. Is the exception reoccurring? I will be glad to help you further when you give us more details about the issue.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Guillaume Crétot Richert
Top achievements
Rank 1
answered on 14 Sep 2009, 03:00 PM
All right, I'll start working on a reproductible project. Like I said in my original post however, that will require a lot of work, as the data I use is rather complex to create, and automating the creation of that data will require some time. This issue has become low priority as well, so it will take some time before I can commit to sending you the project. I will get back to you.

Thank you.
0
Jack
Telerik team
answered on 15 Sep 2009, 07:24 AM
Hello Guillaume Crétot Richert,

I understand. Thank you in advance for your cooperation. I am looking forward to your reply.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Guillaume Crétot Richert
Top achievements
Rank 1
Answers by
Jack
Telerik team
Guillaume Crétot Richert
Top achievements
Rank 1
Share this question
or