Hi,
I've been running into an issue with the UltraTreeNode object that's part of the UltraWinTree.
There's this scenario where the method GetDataColumnFromDisplayColumn(UltraTreeNodeColumn displayColumn, bool allowNull) throws an exception because something in here is null:
This issue only occurs when one of my custom textbox objects tries to filter list of nodes on the UltraWinTree.
If I click 'Enter' on my custom filter and click on a node in my UltraWinTree at the same time, data is filtered and the winForm triggers a click event on the node that my mouse is currently hovering over. This then trickles down into the UltraTreeNode method I mentioned above and we get an exception.
Stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.at Infragistics.Win.UltraWinTree.UltraTreeNode.GetDataColumnFromDisplayColumn(UltraTreeNodeColumn displayColumn, Boolean allowNull)at Infragistics.Win.UltraWinTree.ColumnSettingsResolved.IsCellEnabled(UltraTreeNode node)at Infragistics.Win.UltraWinTree.UltraTreeNodeColumnEditorOwner.IsEnabled(Object ownerContext)at Infragistics.Win.EditorWithTextDisplayTextUIElement.get_Enabled()at Infragistics.Win.TextUIElementBase.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement)at Infragistics.Win.EditorWithTextDisplayTextUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement)at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e)at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e)at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)at Infragistics.Win.UltraWinTree.UltraTree.OnMouseDown(MouseEventArgs e)at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)at System.Windows.Forms.Control.WndProc(Message& m)at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Now, my only alternatives are to either modify my custom filter to only filter the node list at a point in time where the user wouldn't have their mouse clicking on a node, or to just tell users not to click on a node when a filter is in use. Neither of these are too practical for the situation i'm in and I would like to know what I can do to fix this?
I'm currently under the assumption that I will need to clear or set some data/property to avoid getting that far into the node where the exception occurs, but I don't know what exactly needs to be changed.
Are there any ideas or updates that can help with this?
My dll version is: 16.120161.2156
Hello Firaus,
I have been investigating into the behavior you are seeing to see if there have been any changes since 16.1 to the internal code where this issue is occurring. Looking further into this code, it appears that the only way it can happen is if the DisplayColumnSetResolved returns null, as the getter for DataColumnCache in the return statement will always return something.
I am curious how you are getting into a state where the DisplayColumnSetResolved is returning null in this case though. Would it be possible for you to please provide an isolated sample project that demonstrates the behavior you are seeing?
Please let me know if you have any other questions or concerns on this matter.
Hi Andrew,
It would seem that I fixed the issue by calling into UltraTree.Refresh().
I dug into the data model and tried to pin down exactly where a null object would get passed in, but I couldn't find an exact reason for why this was happening.
As to how I got here, I'm applying a filter to the node list on the UltraTree, and when I click away from my custom search box, it counts as submitting a new filter. Now, if that click happens to be on a node, I believe a click event tries to make that node active. I think there's some issue with node position that changes as the list is being filtered and modified.
So the UltraTree.Refresh() is a nice way to remove any stale references possibly.
I'm not able to provide a sample project at the moment due to time constraints, but I hope this response can help others in similar situations.
Thank you for your update on this matter. I am glad you were able to work around the issue using the Refresh method of the tree.
I can confirm that clicking on one of the nodes from your custom search box should try to activate the node. I am guessing that where the issue lies would be in what the application of your filter is doing between the activation of the node and the application of that filter.
I suppose something we could do in this case is to put some preventative code within the GetDataColumnFromDisplayColumn method to prevent this exception from happening in the future. I will be reaching out to our development teams to have this implemented.