Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
CalcManager Error
posted

My team and I continually have issues with the CalcManager blowing up when the grid changes due to a sort, group by, or if we leave the form and the grid is disposed but yet the CalcManager continues to run and then blows up when running asynchronously. Such as a user grouping by multiple columns real quick right after each other. We have not been able to produce a sample application because it seems to be somewhat tied to the complexity of our grid with as many columns and rows as it can contain.  We've attempted updating versions a couple times over the past few months, however, the issue has not been resolved. I know the stack posted below says 9.1 but we have tried with newer versions as well. It appears that the problem occurs because the CalcManager is attempting to perform operations on a grid reference that doesn't exist because it has been changed but yet the CalcManager was either not informed or began running shortly before a grid change occurred and so now elements are no longer valid. The stack varies slightly from error to error depending on the action which caused the exception but for the most part contains the same information. It is as follows:

  StackTrace:
       at Infragistics.Win.CalcEngine.RefParser..ctor(String refName)
       at Infragistics.Win.CalcEngine.RefBase.CreateParsedReference()
       at Infragistics.Win.CalcEngine.RefBase.get_ParsedReference()
       at Infragistics.Win.UltraWinGrid.UltraGridRefBase.get_ParsedReference()
       at Infragistics.Win.UltraWinGrid.UltraGridRefBase.ContainsReferenceHelper(IUltraCalcReference inReference, Boolean isProperSubset)
       at Infragistics.Win.UltraWinGrid.UltraGridRefBase.IsSubsetReference(IUltraCalcReference inReference)
       at Infragistics.Win.CalcEngine.UltraCalcEngine.FormulasSubsetOf(IUltraCalcReference baseReference, IUltraCalcReferenceCollection referenceCollection)
       at Infragistics.Win.CalcEngine.UltraCalcEngine.ConnectReferences(IUltraCalcReference reference, Int32 connect)
       at Infragistics.Win.CalcEngine.UltraCalcEngine.ProcessTopologicalEvent(QueueInfo item)
       at Infragistics.Win.CalcEngine.UltraCalcEngine.CleanTopologicalEventQueue(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.OnTick(EventArgs e)
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

In hope of reaching some type of solution I added the infragistics projects to our project and debugged the issue. I can actually resolve the issue by modifying the infragistics code as follows:

-I made the Infragistics.Win.CalcEngine.QueueInfo a public class and then added the following code at the beginning of the timer tick event:

if(this.calcEngine != null && this.calcEngine.EventQueue != null && this.calcEngine.EventQueue.Count > 0)

{

        object[] qi = this.calcEngine.EventQueue.ToArray();  

        for(int i = 0; i < qi.Length; i++) 

        {                if ((qi[i] as UltraCalcEngine.QueueInfo).Reference.ElementName == "()")  

 

              {

 

                    this.StopTimer(); 

                    return

             }

              }

While this does seem to resolve my issues for now I am wary about using a modified control and have not implemented this in our actual application yet. I don't know how looping through this queue will affect performance or other areas. Is this a valid fix? Can this be implemented in some type of patch or hotfix? Is there a way to handle this without modifying the code? Thank you for any input.