We are getting an error that is hard to duplicate and occurs at different points. The common occurrences seem to be when our grid is filtered and the user double clicks on a record to do some editing. When they come back from the editing dialog and we try to refresh the grid, this error occurs and the message "Object reference not set to an instance of an object" pops up.
When we run it in debug mode, it does not error out on any specific line of code, so we are having problems figuring out where the error is happening and on what code. From the detail below, its is happening on some type of calculations, but we have no idea how to figure out what its doing at the time or on what calculation. Any ideas? We are using Infragistics 8.3 still
thanks!
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.UltraWinGrid.RefUtils.GetRowCalcIndex(UltraGridRow row, FormulaRowIndexSource rowIndexType) at Infragistics.Win.UltraWinGrid.RefRowIterator.GetNextRow() at Infragistics.Win.UltraWinGrid.RefRowIterator.MoveNext() at Infragistics.Win.UltraWinGrid.RefRowIterator.MoveNext() at Infragistics.Win.UltraWinGrid.RefRowIterator.MoveNext() at Infragistics.Win.UltraWinGrid.RefCellCollection.RefCellCollectionEnumerator.MoveNext() at Infragistics.Win.CalcEngine.RangeCalcInfo.EvaluateNextRow() at Infragistics.Win.CalcEngine.UltraCalcEngine.Evaluate(Int64 ticks) at Infragistics.Win.CalcEngine.UltraCalcEngine.Recalc(Int64 ticks, Boolean isStartOfRecalcOperation) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalcInternal(Int64 ticks) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalc(Int64 millis) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalc() at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalcSynchronous() at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.VerifyReCalc() at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.DirtyCalc(IUltraCalcReference reference, ValueDirtiedAction action) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.Infragistics.Win.CalcEngine.IUltraCalcManager.RowsCollectionVisibilityChanged(IUltraCalcReference reference) at Infragistics.Win.UltraWinGrid.ViewStyleBase.OnAfterRowListCreated_ProcessBand(UltraGridBand band) at Infragistics.Win.UltraWinGrid.ViewStyleBase.OnAfterRowListCreated(RowScrollRegion rsr) at Infragistics.Win.UltraWinGrid.ViewStyleBase.RecreateRowList(RowScrollRegion rsr) at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible) at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent) at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions() at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered) at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(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)
Hi,
From the call stack, it looks like the error is occurring on a MouseMove. So the mouse must be moving over a cell in the grid which causes the grid to try to verify it's display and this causes the grid to rebuild it's list of rows which was dirtied at some prior point.
The fact that the grid is blowing up while trying to create the rows is in indication that something is out of synch, which leads me to think that this might be a threading issue.
So what exactly are you doing when you "try to refresh the grid". Is your code using threads anywhere?
Hi Mike,
I had a very similar exception seen today. The only difference being that a summary value was being calculated as shown in the RefSummaryValueCollection in the stack trace. I have to admit that I have seen calculator bugs when using filtering since version 7.2 and have never updated the binding list on the grids except from the GUI thread. Their are five bands in the grid and there is a summary for band 2 that has a formula that references a value in the parent row and the sum of a column in the band 2 rows. There is also a summary for band 0 that is just a simple sum of each column.
I add, remove, or update the binding list periodically by doing an Invoke on the GUI thread and have seen calculator bugs (rarely however). I have removed the calculator as much as possible having even resorted to setting Row.Hidden to true instead of using a filter in previous projects but not this one. I am using version 8.2.20082.2204. The CalcFrequency is set to synchronous. I believe part of the problem is the fact that setting a filter is not a synchronous operation in the Grid so sometimes I have resorted to using EnsureSortedAndFiltered which is synchronous. This exception happened to one of our users so I cannot be exactly sure what they were doing when the exception occurred although as you mentioned above it look like a simple cell activation. Any help or suggestions you can give me would be appreciated. I am wondering at this point if I should resort to always using manual calculations to reduce the chance of an exception like this occuring again. However, I would prefer the bug to be simply fixed as opposed to have to jump through hoops to avoid it.
Here is the call stack:
Forgot to mention if there is any workaround for this bug that you can think of. Only thing I can think of trying is to use a custom formula instead of sum.
Now that I have figured out this bug I think this may very well be the bug that has been plaguing me for years with the calculator in conjunction with filters. It was so bad that I resorted to having to set Hidden on a row instead of using a filter because I would often get the NullReferenceException from the calculator.
I believe the calculator was trying to iterate rows for a formula and would call GetRowCalcIndex with null for the row if a filter was applied to a column and filtered out a parent row.
I look forward to you fixing this bug.
Thanks for opening the case to resolve this if it was you. The developer was unable to reproduce it so I modified the Samples\WinCalcManager\CS\WinGrid Summaries CS project.
Frankly I am astonished that this bug has been in infragistics for so long since its a very basic operation that creates the exception. The bug can be summarized as follows: If a row is added to the grid for band 0, and a child band of that new row has summary values, and the filter on band 0 would cause the new row to be filtered out, then the exception occurs.
Here's a screenshot of the application.
Notice the filter icon on the Id column of band 1 and the summary values on band 2. There is a filter on band 0 that checks if any child rows are not Filtered Out. It just loops over the row collection of any child bands and checks the IsFilteredOut. Here's the linq expression that is evaluated in the filter:
row.ChildBands.Cast<
>()).Any(r => !r.Hidden && !r.IsFilteredOut)
So if the filter on band 1 is changed to equal number 5 for example. If a business object for band 0 is created with a single Part object in its Parts binding list and the Id is not 5, and then the business object is added to the binding list that the data source is bound to then the UltraCalcException will be thrown. This is because the CalcEngine cannot create a reference for the cells used in the summary for band 2 since the parent band 0 row is not visible. The exception is invalid scope: band0name(-1)
emarkunger said:The developer was unable to reproduce it
What developer are you referring to?
Can you post your modified sample so we can try it out? I tried running the WinGrid Summaries CS project, but it doesn't even have a child band in the grid.
As for a workaround, try this:
this.ultraGrid1.DisplayLayout.Override.FormulaRowIndexSource = Infragistics.Win.UltraWinGrid.FormulaRowIndexSource.RowIndex;
David is working on the case. He should be able to run my sample now to reproduce. Ths case # is CAS-53752-WM7JTL. I have attached the sample project. I can't use RowIndex since I only want my summaries/formulas to include visible rows.
I ran the sample with version 9.2.20092.2103 installed.
Hi
Has there been any movement in your support case?
I am experiencing a similar problem. In my case i have a reusable component on which the user can group the grid by a number of predefined columns by means of a right click menu (instead of having to drag and drop them manually on the header).
The user can check a checkbox on each row to select rows for further processing. When the user clicks the menu, the grid will be grouped by those columns but immediately after i get the affore mentioned error. Strange thing is that when i don't show the checkbox, i do not get an error on performing the grouping using the right click menu.
I am using version 10.3.20103.1000, debugging shows me that the error is originating from infragistics code.
Kind Regards,
Peter
Hello Sean K,
Thank you for contacting Infragistics Community.
I have tested the fix for the original issue in 2012 vol2 and everything works ok for me. Since you have a slightly different scenario, the MessageBox might have something to do with that behavior. Could you please comment the code that shows that MessageBox and verify if the same exception going to appear again, just for testing purposes?
Also if you are able to duplicate it in a small sample I will be glad to look into it.
Please feel free to let us know if you have any other questions with this matter.
Note that I able to get rid of this error by setting CalcFrequency on my UltraCalcManager to Synchronous...
I'd like to switch it back to asynch since there's a strong chance I'll be taking a performance hit when this grid loads more than a few rows.
User updates column in grid
AfterCellUpdate is fired/caught
Update is passed to database
------ABOVE ERROR------
MessageBox shows stating that save was successful (Note that all updates are properly being passed to DB)
---APP CRASHES-----------
Note:
No multithreading in this app
Summaries exist (but not on the "TradeExecution" band)
Hi, I'm still getting this error in V 12.2....
at Infragistics.Win.UltraWinGrid.RefRowIterator.MoveNext() at Infragistics.Win.UltraWinGrid.RefSummaryValueCollection.RefSummaryValueCollectionEnumerator.MoveNext() at Infragistics.Win.CalcEngine.RangeCalcInfo.EvaluateNextRow() at Infragistics.Win.CalcEngine.UltraCalcEngine.Evaluate(Int64 ticks) at Infragistics.Win.CalcEngine.UltraCalcEngine.Recalc(Int64 ticks, Boolean isStartOfRecalcOperation) at Infragistics.Win.CalcEngine.UltraCalcEngine.Recalc(Int64 ticks) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalcInternal(Int64 ticks) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalc(Int64 millis) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.onTimerTick(Object sender, EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type) at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) at System.Windows.Forms.MessageBox.Show(String text) at FMSClient.SubMenu.TradeEdit.dgEditTrades_AfterCellUpdate(Object sender, CellEventArgs e) in C:\Development\MSMQ\FMSClient\SubMenu\TradeEdit.cs:line 326
Any suggestions?
Hello Srikanth,
This has been already fixed and you could use the latest service release for NetAdvantage for Windows Forms 11.2 - 2074.
This service release is now available under your account at the Infragistics Website. To download the service release, log in to‘My IG’ and select ‘Keys & Downloads’. Select the appropriate tab for this product, then the license key. The available service releases should now be listed on the page.
Please let me know if I can provide any further assistance.