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?
Hi Lin,
As far as I know, there was never any response to my reply on this thread. So I can only assume that the original poster was using threading and that was the case of the issue.
Are you using multiple threads in your application? If so, then that is almost certainly the problem and not a bug in the control. You really cannot use threading and DataBinding together safely except in very rare and limited cases.
I have also come across this issue and have the following sample that reproduces the described issue. In order to reproduce the issue I hooked up a control with an ultra tree set to dock to fill with a panel of two buttons (Create/Delete) docked to the bottom of the control. To reproduce I clicked the 'Create' button and then scrolled the control down some distance (will not reproduce when the scrollbar has not moved) after which I clicked delete and moved the cursor in/out of the tree area. I do not see anything incorrect in the provided example as all updates of the control are performed on the UI thread. No data is modified outside of the UI thread and the only thing the thread is doing is allowing the message pump to execute while posting UI notifications.
const int TOTAL_NODES = 25000; public Form1() { InitializeComponent(); } private void ubtnCreate_Click(object sender, EventArgs e) { ultraTree1.Nodes.Clear(); for (int i = 0; i < TOTAL_NODES; i++) { string text = string.Format("Test{0}", i); ultraTree1.Nodes.Add(text, text); } } private void ubtnDelete_Click(object sender, EventArgs e) { SetEnabled(false); new Thread(DeleteProc).Start(); } private void DeleteProc() { try { StartDelete(); for (int i = TOTAL_NODES - 1; i >= 0; i--) { Delete(i); } } finally { EndDelete(); } } private void StartDelete() { if (InvokeRequired) { Invoke(new Action(StartDelete)); return; } Application.UseWaitCursor = true; ultraTree1.BeginUpdate(); } private void EndDelete() { if (InvokeRequired) { Invoke(new Action(EndDelete)); return; } ultraTree1.EndUpdate(); Application.UseWaitCursor = false; SetEnabled(true); } private void Delete(int index) { if (InvokeRequired) { Invoke(new Action(Delete), index); return; } ultraTree1.Nodes.RemoveAt(index); } private void SetEnabled(bool enable) { if (InvokeRequired) { Invoke(new Action(SetEnabled), enable); return; } ubtnCreate.Enabled = enable; ubtnDelete.Enabled = enable; }
const int TOTAL_NODES = 25000;
public Form1() { InitializeComponent(); }
private void ubtnCreate_Click(object sender, EventArgs e) { ultraTree1.Nodes.Clear(); for (int i = 0; i < TOTAL_NODES; i++) { string text = string.Format("Test{0}", i); ultraTree1.Nodes.Add(text, text); } }
private void ubtnDelete_Click(object sender, EventArgs e) { SetEnabled(false); new Thread(DeleteProc).Start(); }
private void DeleteProc() { try { StartDelete(); for (int i = TOTAL_NODES - 1; i >= 0; i--) { Delete(i); } } finally { EndDelete(); } }
private void StartDelete() { if (InvokeRequired) { Invoke(new Action(StartDelete)); return; } Application.UseWaitCursor = true; ultraTree1.BeginUpdate(); }
private void EndDelete() { if (InvokeRequired) { Invoke(new Action(EndDelete)); return; } ultraTree1.EndUpdate(); Application.UseWaitCursor = false; SetEnabled(true); }
private void Delete(int index) { if (InvokeRequired) { Invoke(new Action(Delete), index); return; } ultraTree1.Nodes.RemoveAt(index); }
private void SetEnabled(bool enable) { if (InvokeRequired) { Invoke(new Action(SetEnabled), enable); return; } ubtnCreate.Enabled = enable; ubtnDelete.Enabled = enable; }
This is currently being investigated by Infragistics. Figured I would update this post in case anyone else was researching this issue.