All,
We are using valid Infragistics License version 6.2. Let me explain my problem.
When I am deleting a Node which is Leaf and there are no siblings for that node also. Assume that it is the only node at the end. Basically when creating the node I alert him if it is a duplicate and provide him with a message box. If the clicks no , I am removing the leaf node in the following event dynamically.
treeControlt_AfterLabelEdit
trePageContent.Nodes.Remove(e.TreeNode)
I placed the complete event in the Try Catch Block but it doesn't throw any exception but when the method returns it is throwing the following exception.
This is happening only when there is only one node at the end. Other than that its workig fine in all other places.
I am placed breakpoints in all the events of the TreeView but its not hitting any event after deleting the node. Please get back to me as it is really a urgent issue.
Message="Object reference not set to an instance of an object." Source="Infragistics2.Win.UltraWinTree.v6.2" StackTrace: at Infragistics.Win.UltraWinTree.UltraTree.EndEdit(UltraTreeNode node, Boolean cancel, Boolean callExitEditMode) at Infragistics.Win.UltraWinTree.UltraTree.EndEdit(UltraTreeNode node, Boolean cancel) at Infragistics.Win.UltraWinTree.UltraTreeNode.EndEdit(Boolean cancel) at Infragistics.Win.UltraWinTree.UltraTree.PerformAction(UltraTreeAction actionCode, Boolean shift, Boolean control) at Infragistics.Win.UltraWinTree.UltraTree.PerformKeyAction(Enum actionCode, Boolean shiftKeyDown, Boolean ctlKeyDown) at Infragistics.Win.UltraWinTree.UltraTreeUIElement.PerformKeyAction(Enum actionCode, Boolean shiftKeyDown, Boolean ctlKeyDown) at Infragistics.Win.ControlUIElementBase.ProcessKeyDown(Object sender, KeyEventArgs e) at Infragistics.Win.UltraControlBase.OnKeyDown(KeyEventArgs e) at Infragistics.Win.UltraWinTree.UltraTree.OnKeyDown(KeyEventArgs e) at Infragistics.Win.UltraWinTree.UltraTree.Infragistics.Win.ISilentTextBoxOwner.OnKeyDown(KeyEventArgs e) at Infragistics.Win.UltraWinTree.LabelEditNodeBase.OnKeyDown(KeyEventArgs e) at Infragistics.Win.UltraWinTree.LabelEditNode.ProcessKeyMessage(Message& msg) at System.Windows.Forms.Control.WmKeyChar(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.TextBoxBase.WndProc(Message& m) at System.Windows.Forms.TextBox.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
This looks like a bug in the control to me. The control is probably trying to access the node after the event has completed without accounting for the fact that it may have been removed.
You should Submit an incident to Infragistics Developer Support so they can check it out.
I have the same problem using 9.2. Unfortunately, I have no way, other than forums, to submit the issue, given that our support has expired. So, I hope someone will take a look and fix this issue:
The exception we receive is:
System.NullReferenceException occurred
Message="Object reference not set to an instance of an object."
Source="Infragistics2.Win.UltraWinTree.v9.2"
StackTrace:
at Infragistics.Win.UltraWinTree.UltraTree.EndEdit(UltraTreeNode node, Boolean cancel, Boolean callExitEditMode)
at Infragistics.Win.UltraWinTree.UltraTree.EndEdit(UltraTreeNode node, Boolean cancel)
at Infragistics.Win.UltraWinTree.UltraTreeNode.EndEdit(Boolean cancel)
at Infragistics.Win.UltraWinTree.UltraTree.LabelEdit_LostFocus(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnLostFocus(EventArgs e)
at System.Windows.Forms.Control.WmKillFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at FLLegislature.SubjectIndex.Desktop.WinForms.LegInfoSubjectIndexMain.manageSubjectCollectionsToolStripMenuItem_Click(Object sender, EventArgs e) in C:\TeamProjects\SubjectIndex\1.0\SubjectIndexSolution\FLLegislature.SubjectIndex.Desktop\WinForms\LegInfoSubjectIndexMain.cs:line 413
InnerException:
This occurs when we call node.Remove on the only node in the tree from within the processing of the AfterLabelEdit event:
/// <summary>
/// After an edit is complete the TAG should be updated
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void subjectCollectionUltraTree_AfterLabelEdit(object sender, NodeEventArgs e)
{
if (e.TreeNode != null)
UltraTreeNode node = e.TreeNode;
SubjectCollectionNodeDO subjectNode = e.TreeNode.ToSubjectCollectionNode();
if (!string.IsNullOrEmpty(node.Text.Trim()))
subjectNode.Value = node.Text;
subjectNode.UniqueGuid = Guid.NewGuid().ToString();
node.Key = subjectNode.UniqueKey;
node.Tag = subjectNode;
node.Text = subjectNode.TreeText(DisplayDO);
this.subjectCollectionUltraTree.SelectedNodes.Clear();
node.Selected = true;
}
else
this.InformationMessage = ExceptionManager.GetExceptionItem(ExceptionItems.Exception1169).Message;
if (string.IsNullOrEmpty(subjectNode.UniqueKey))
node.Remove();
node.Text = subjectNode.TreeText(this.DisplayDO);
In this case, the user has pressed a button, we've created an UltraTreeNode and inserted it into the UltraTree.Nodes Collection:
/// This will handle the click event for the 'New Heading' button.
private void btnNewHeading_Click(object sender, EventArgs e)
if (this.DesignMode == false)
UltraTreeNode node = new UltraTreeNode
AllowCellEdit = AllowCellEdit.Full,
Override = new Override
NodeStyle = NodeStyle.CheckBox,
};
this.subjectCollectionUltraTree.Nodes.Insert(0, node);
node.BeginEdit();
Then, without typing any further characters, the user presses the escape key to cancel the edit. This causes the _AfterLabelEdit method to be called and we attempt to remove this newly added, but empty node by called node.Remove().
It should be noted that if the UltraTree already has more than 1 root node, the exception doesn't occur. This only occurs when the root node is the only node in the tree.
Just wanted to add I am having the same problem in 10.2.
We were able to solve this using the suggested workaround.
Thank you.
HI,
I am just following up on this issue. Please let me know if you require further assistance regarding this forum post.
Sincerely,
MattDeveloper Support Engineer
This seems pretty straightforward. You are attempting to remove the node while it is in the process of exiting edit mode and the tree probably expects that node to still be there after the event has fired. That would indeed be a bug. But if I am right, you can work around it pretty easily by using a BeginInvoke to call a method that removes the node, rather than removing it from directly inside the AfterLabelEdit event.