Hi,
We were on a really old version of Infragistics (11.2) and we recently upgraded to 16.1.
In the latest version, we found that we are getting an exception with the following code:
private void ut_Click(object sender, EventArgs e) { UltraTree utControl = (UltraTree)sender; if (utControl.ActiveCell == null) return;
switch (utControl.ActiveCell.Column.Key) { case "Checked": utControl.ActiveCell.AllowEdit = AllowCellEdit.Full; utControl.ActiveCell.BeginEdit(); if ((CheckState)utControl.ActiveCell.Value == CheckState.Unchecked || (CheckState)utControl.ActiveCell.Value == CheckState.Indeterminate) utControl.ActiveCell.Value = (int)CheckState.Checked; else if ((CheckState)utControl.ActiveCell.Value == CheckState.Checked) utControl.ActiveCell.Value = (int)CheckState.Unchecked;
utControl.ActiveCell.EndEdit(false); utControl.ActiveNode.Update();
Here's the stack trace:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinTree.UltraTreeNode.CommitCellValues() at Infragistics.Win.UltraWinTree.UltraTreeNode.Update() at OptiGlass.ctlOptimizer.ut_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at Infragistics.Win.UltraControlBase.OnClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(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)
I did a
Not sure if we're doing something that was OK in 11.2 but is no longer OK in 16.1 or if this is a bug, but I wasn't able to find any information on this.
Thanks in advance!
Steve
I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 242724. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
I will leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
Please let me know if you need more information.
Hi Steve,
If your goal is to immediately update the underlying data source any time the user changes the Checkbox, then the code you have here won't really work, anyway. For example, the user could toggle the checkbox via the keyboard and the Click event won't fire in that case.
It would be better to use the CellValueChanged event:
private void UltraTree1_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (e.Cell.Column.Key == "Checked") e.Cell.Node.Update(); }
But... good news and bad news here... when I do this, I get the exception again. So it looks like this is a bug we definitely need to look into. I will write this up for developer review and follow up with you in a few minutes with more information.
Hi Mike,
You are correct, the sample you uploaded doesn't cause an issue. I wonder if the problem is that we are trying to update on click not on node change (didn't see how to do that in the UpdateModeEnum). AKA, when the user unchecks the box, the underlying data set should be updated, and remove the node from the tree.
I'll try to resurrect my other issue in your sample project to see what the difference is.
For future reference, you can attach files directly to your post here on the forums by going to the Options tab - you don't have to host them somewhere else.
Anyway, I downloaded your sample and tried it out and this seems like it might be a bug. It looks like this only happens when you call Update in the Click event after modifying a cell. And it only happens when the tree is bound to a child collection and that collection is filtered. So it's pretty obscure.
Then I tried changing the sample so that it uses a CheckEditor and I am not able to reproduce the new exception you are getting. I have attached my modified sample here.
Note that I also changed the DataType of the Checked column in my sample to Boolean, just to make things easier. But I don't think that's related to the issue.
Please try my sample and see if you are still getting the exception. If so, then this must be a problem with the version of the assemblies you are using. You might just need to get the latest service release. If you do not get the exception with my sample, then something else in your application must be a factor and we need to determine what that is so I can reproduce the problem.
Firstly thanks again for the support, much appreciated.
Secondly, I do have a very simple project that throws the exception (it's sloppy but it should illustrate the issue). I'm placing on a file share that can be accessed here:
https://files.rovisys.com/?ShareToken=D637B555EC8B541906DAD01D0AACFBE78A82783D
Third, I'm not opposed to redoing this to a simpler way (for several reasons!), I am running into some strange hurdles. For example, I get this in the application if I remove the click event and do things via CheckEditor.
System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinTree.UltraTreeNode.get_ListObject() at Infragistics.Win.UltraWinTree.UltraTreeNode.get_ListObjectResolved() at Infragistics.Win.UltraWinTree.UltraTreeNode.GetCellValueHelper(UltraTreeNodeColumn column, Boolean useEditorValueWhenInEditMode) at Infragistics.Win.UltraWinTree.UltraTreeNodeColumnEditorOwner.GetValue(Object ownerContext) at Infragistics.Win.EmbeddableEditorBase.GetDataFilterSourceValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext) at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext) at Infragistics.Win.CheckEditor.GetOwnerCheckState(EmbeddableEditorOwnerBase owner, Object ownerContext) at Infragistics.Win.EmbeddableCheckUIElement.GetOwnerCheckState(Boolean forceGetFromOwner) at Infragistics.Win.EmbeddableCheckUIElement.PositionCheckElements(Boolean vertical) at Infragistics.Win.EmbeddableCheckUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) 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.UltraTree.SetActiveNode(UltraTreeNode node, Boolean bringIntoView, Boolean adjustHorizontalPosition, NodeActivationReason reason) at Infragistics.Win.UltraWinTree.UltraTree.SetActiveCellHelper(UltraTreeNode newActiveNode, UltraTreeNodeColumn newActiveCellColumn) at Infragistics.Win.UltraWinTree.UltraTreeNode.OnCellMouseDown(CellMouseDownInfo info) at Infragistics.Win.UltraWinTree.UltraTreeNodeColumnEditorOwner.OnEditorMouseDown(EmbeddableUIElementBase embeddableElem, EmbeddableMouseDownEventArgs e) at Infragistics.Win.EmbeddableUIElementBase.RaiseMouseDownEvent(UIElement sender, MouseEventArgs mouseArgs, Boolean isButton) at Infragistics.Win.CheckEditorCheckBoxUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.UIElement.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)
I haven't had time to get this into a simpler example though (or really investigate much)