I have found exceptions reported in our application specific Event log that are related to the UltraWinTree and/or the UltraTreeNode. At this point I have not been able to reproduce it but it appears in the log daily and I hoping someone might be able to suggest a possible cause. Here's the stack trace:
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
Exception Type: NullReferenceException
Message: Object reference not set to an instance of an object.
Stack Trace:
at Infragistics.Win.UltraWinTree.UltraTreeNode.get_IsLastViewableSibling()
at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.ShouldDrawVerticalConnectorToBottom(TreeNodeUIElement nodeUI)
at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.PositionChildElements()
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements()
at Infragistics.Win.UltraWinTree.UltraTreeUIElement.PositionChildElements()
at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered)
at Infragistics.Win.ControlUIElementBase.get_CurrentCursor()
at Infragistics.Win.UltraControlBase.get_Cursor()
at Infragistics.Win.UltraWinTree.UltraTree.get_Cursor()
at System.Windows.Forms.Control.WmSetCursor(Message& m)
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)
We are using version 9.2.20092.2083 of the WinForms controls.
One other thing, is that I am using one of my personal accounts to report this. The company that I work for has valid licenses for this software but the developer responsible for the licenses information and who usually would post question/help requests is no longer associated with the company. I don't currently have an account associated with those licenses (or his account information), how would I go about creating an account that associates me with the company's licenses?
Mike -
Thanks for the reply. No the tree is not bound to a data source. We create the nodes ourselves and add them to the tree.
The data retrieval is indeed done in a background thread which fills the tree using Invoke calls. Am I correct in thinking that as long as we only touch the tree via Invoked calls there should not be a problem. I have checked our code and I believe that there is no place that we touch the tree other than through an Invoke call.
I believe this likely a cross thread issue but I have not been able to reproduce it in the development environment to prove this.
jcmercure said:The EndUpdate is executed in a method that is Invoked in the finally of a try/catch/finally within a data retrieval method that is executed in a thread.
This sounds like it might be the problem right here. Is your tree bound to a data source? If so, you cannot modify or access the data source on another thread. If you have a data retrieval method that is retrieving data on another thread and updating the data source that the tree is bound to, it's certain to cause problems just like the one you are having because things will get out of synch.
I took a look at the property where the exception is occurring (IsLastViewableSibling) and nothing has been changed in this code since 2005, so it seems unlikely that there's a bug here and no one noticed it until now.
Some additional information, I ran this through RedGate's Performance Profiler and found that an EndUpdate on the UltraWinTree seems to initiate the call stack that leads to this exception; although the exception did not occur when I was diagnosing this.
The EndUpdate is executed in a method that is Invoked in the finally of a try/catch/finally within a data retrieval method that is executed in a thread.
I suppose that the call stack from the posted exception may also result from some other action but the only occurrence of a call to get_IsLastVisibleSibling that I can find comes after our explicit call to EndUpdate.