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
1425
Unhandled Exception in FormulaBuilderDialog
posted

Hi all,

I've experienced an issue when adding a function in the FormulaBuilderDialog (example is for the cosine function), via this dialog:

If the user types the '{' or '}' character for an argument (no matter what function it is, with or without quotes), an unhandled exception occurs when the user clicks OK, as follows:

I haven't tested many other possible special characters, but this is the first time I've seen this happen.

If the user clicks Continue now, it's fine, but the function hasn't been added to the Formula Builder (as expected).

The stack trace is:

System.FormatException: Input string was not in a correct format.
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
   at System.Text.StringBuilder.AppendFormat(String format, Object[] args)
   at Infragistics.Win.UltraWinCalcManager.FormulaBuilder.FunctionBuilderDialog.get_Function()
   at Infragistics.Win.UltraWinCalcManager.FormulaBuilder.FormulaBuilderDialog.InsertFunction(UltraCalcFunction function)
   at Infragistics.Win.UltraWinCalcManager.FormulaBuilder.FormulaBuilderDialog.functionsTree_DoubleClick(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
   at Infragistics.Win.UltraControlBase.OnDoubleClick(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)

The strange thing about this, is that if the user avoids using the UI for entering the Function parameters, and instead simply types, e.g. cos( "{" ), no unhandled exception occurs and the cells that use this formula show the error value as should be expected.

We haven't made any modifications to the FormulaBuilderDialog, and the stack trace indicates it's not occuring in our code, so we can't catch the exception, of course...

Is this a bug?

Cheers,

Richard

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi Richard,

    Yep, this is definitely a bug. The FunctionBuilder dialog is using a StringBuilder to modify the text you entered in the paramaters grid. Sometimes it has to do this to add or remove quotation marks or to handle nested function calls.

    Anyway, the AppendText method of the StringBuilder class uses "{0}" notation as a replacement code. So a single bracket is not a valid character by itself. So fixing this is just a matter of using the proper escape code.

    Anyway, I will forward this over to Infragistics Developer Support so they can write it up and get it fixed.

Children