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
Hi Steve,
I don't see anything inherently wrong with this code. It might be a bug. But I would need a sample project demonstrating the exception in order to know for sure.
I tried to create a sample, but I could not get it to work because there are too many unknowns here and a lot of this code just doesn't make a lot of sense to me.
You seem to be jumping through some pretty big hoops here in order to manually handle clicking on a cell that contains both CheckState and/or integer values. If you just want a Checkbox or CheckState column then there are MUCH easier ways to do that built-in to the tree and there's no reason to write code in the Click event to handle that.
What's the DataType of this column?
Why are you manually handling the Click event to toggle the value?
Also... the code you have will produce some very strange and unexpected results. You are not actually checking to see if the user is clicking on a cell. So if there is an ActiveCell in the tree and the user clicks on the tree's Background, a header, the scrollbar, or basically anything the doesn't change the ActiveCell to null, this code will end up toggling the ActiveCell even though the user clicked somewhere else.
Anyway, presumably this code has been working for you for a long time, so it may not be worth messing with it. If you can provide a sample that reproduce the exception, we will, of course, be happy to look into it. But if all you need is a checkbox cell in the tree, it might be better to just simplify the code and use the built-in functionality instead of jumping through hoops like you are doing here. That might get you up and running faster and avoid the exception.
Mike,
Again, I'm by means an expert on this, but I think what was trying to be accomplished in doing this in the click event:
- Change the image of the checkbox to a static image.
- Change the appearance of the other cells in the node to look disabled.
That's all I can think of at least.
If there's base functionality to accomplish this, can you link or provide a quick example? That would save me some digging.
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.
A fix for this issue has been released and you will receive an update via the support page with a link to download the fix.
Mike, I downloaded the service release in the case, but I get an error trying to run it "The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program...", so I have no way to verify the fix.
All that said, we've worked around it so we're not necessarily in a rush, but I can't verify the fix either for you guys.
The installer is a patch for v2017.1. Do you have that version installed? I think you original said that you were upgrading to 2016.1. The fix is only available in 2017.1 and up. We are no longer updating any older versions.
You are correct, we're on 2016.1, so that explains it, thanks.