Hi,
We have a heterogeneous hierarchical wintree representation, the tree is constructed by binding each to node, the code used for binding is as below,
this.winTree.Nodes.SetDataBinding(dataView, null); - For root binding
treeNode.Nodes.SetDataBinding(dataView, null); - While binding each node in a tree
The binding works perfectly fine, however deleting few nodes and then calling the Clear() method of the datatable results in an "Object reference... " error.
One way to resolve this issue is to the set the deleted treenodes binding to null (this should be done for each deleted node which is tricky because sometimes a delete could happen directly on the datatable) as show below,
ultraTreeNode.Nodes.SetDataBinding(null, null);
We are not sure why the tree should behave in this manner, is this a known issue or is there a generic solution (other than setting the binding to null). Please provide your views on the same.
The stack trace is as below,
1) Exception Information
*********************************************
Exception Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Data: System.Collections.ListDictionaryInternal
TargetSite: Infragistics.Win.UltraWinTree.UltraTreeColumnSet GetColumnSet(Infragistics.Win.UltraWinTree.NodeColumnRelationship)
HelpLink: NULL
Source: Infragistics2.Win.UltraWinTree.v10.2
StackTrace Information
at Infragistics.Win.UltraWinTree.UltraTreeNode.GetColumnSet(NodeColumnRelationship relationship)
at Infragistics.Win.UltraWinTree.UltraTreeNode.get_DisplayColumnSetResolved()
at Infragistics.Win.UltraWinTree.UltraTreeNode.GetDataColumnFromDisplayColumn(UltraTreeNodeColumn displayColumn, Boolean allowNull)
at Infragistics.Win.UltraWinTree.UltraTreeNode.GetDataColumnFromDisplayColumn(UltraTreeNodeColumn displayColumn)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.TreeNodesCollectionComparer.CompareHelper(Object x, Object y, UltraTreeColumnSet columnSet, IComparer sortComparer, SortType sort)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.TreeNodesCollectionComparer.System.Collections.IComparer.Compare(Object x, Object y)
at Infragistics.Win.Utilities.ComparerWrapper`1.Compare(T x, T y)
at Infragistics.Win.Utilities.SortMergeHelper[T](T[] arr, T[] tmpArr, IComparer`1 comparer, Int32 si, Int32 ei)
at Infragistics.Win.Utilities.SortMerge(Object[] arr, Object[] tmpArr, IComparer comparer, Int32 si, Int32 ei)
at Infragistics.Win.Utilities.SortMerge(Object[] arr, Object[] tmpArr, IComparer comparer)
at Infragistics.Win.Utilities.SortMerge(ArrayList arrayList, IComparer comparer)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.Sort(Boolean checkVersion, Boolean checkSortResolved)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.SortByColumns(Boolean checkVersion)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.VerifySortVersion()
at Infragistics.Win.UltraWinTree.TreeNodesCollection.GetEnumerator()
at Infragistics.Win.UltraWinTree.TreeNodesCollection.CacheBoundNodes(Boolean recursive)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.ResetDataBinding()
at Infragistics.Win.UltraWinTree.TreeNodesCollection.dataList_Reset(ListChangedEventArgs e)
at Infragistics.Win.UltraWinTree.TreeNodesCollection.dataList_ListChanged(Object sender, ListChangedEventArgs e)
at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
at System.Data.DataView.OnListChanged(ListChangedEventArgs e)
at System.Data.DataView.IndexListChanged(Object sender, ListChangedEventArgs e)
at System.Data.DataView.IndexListChangedInternal(ListChangedEventArgs e)
at System.Data.DataViewListener.IndexListChanged(ListChangedEventArgs e)
at System.Data.Index.<OnListChanged>b__2(DataViewListener listener, ListChangedEventArgs args, Boolean arg2, Boolean arg3)
at System.Data.Listeners`1.Notify[T1,T2,T3](T1 arg1, T2 arg2, T3 arg3, Action`4 action)
at System.Data.Index.OnListChanged(ListChangedEventArgs e)
at System.Data.Index.FireResetEvent()
at System.Data.Index.Reset()
at System.Data.DataTable.ResetInternalIndexes(DataColumn column)
at System.Data.DataTable.Clear(Boolean clearAll)
at System.Data.DataTable.Clear()
...
Thanks,
spm
The root node and child nodes are bound to a different DataView instances. Also, we have not used threading.... I suspect the problem could be because the nodes collection is unable to relinquish the binding (the binding in done for each node) - setting .Nodes.SetDataBinding(null, null); stops the exception from occurring.
I will try to come up with a sample application using the original implementation (by removing avoidable code)...but as i am currently pressed for time with other tasks it might take several weeks before the sample could be finished....
Thanks for support,
It's really hard to tell what's going on here from the call stack. It looks like you are clearing the DataTable and this triggers a Reset notification from the BindingManager. So the tree processes this by caching the bounds node for the collection and then it would normally try to repopulate the list using the new data. In this case, of course, there is no new data, but that doesn't matter, because the exception is occurring during the caching process.
The process of caching the nodes involves enumerator the nodes in the collection. At this point, things get weird. for some reason, the collection of nodes has a sort operation pending. So there's a strange timing issue here. At some point, the sorting of the data must have changed, but the actual sort has not been processed, yet. This should never happen and the only way I can think of that it might happen is if you are using multiple threads in your application and the threads are getting out of synch. Are you using threading in your application?
Also... I just want to clarify these two lines of code:
spm said: this.winTree.Nodes.SetDataBinding(dataView, null); - For root binding treeNode.Nodes.SetDataBinding(dataView, null); - While binding each node in a tree
Are you binding the parent node and the child nodes to the same dataView instance? I assumed you just wrote "dataView" here for example purposes and that you are actually using two different dataViews, but I just want to make sure my assumption is correct.
If that's the case and you are not using threading, then there's not much else I can think to do without a sample. If you cannot create a sample by starting with a new project and working up, perhaps you could do it the other way - start with a copy of your real application and remove as much as possible to produce a manageable sample we can run.
This issue is not yet resolved, we tried to create a sample application imitating the original implementation however the bug does not occur - the original implementation is large so it may not be possible to implement/share the entire code. I was wondering whether StackTrace provide sufficient information for Infragistics to resolve this issue. If not, do you recommend us downloading the Infragisitics source code and perhaps provide more information to you based on our findings.
Hello,
I am just checking about the progress of this issue. Did you solve your issue ?
Let me know if you need any further assistance.
Thank you for using Infragistics Components.
I'm not aware of any issues like this, but you are using the tree in a pretty unusual way binding each node to a different DataView, so this is most likely a bug that no one else has encountered, yet.
Can you post a small sample project which demonstrates the exception so we can check it out?