I tested this for you and yes, I also have some troubles with this.
If I create a Int32 variable, using the set variable task, and uses a SUBSTRING function to get a number out of a string, translate to constant checked, I get this error in VC:
Unhandled error in RemoveVariable: There is an error in XML document (1, 2).
System.InvalidCastException: Conversion from string "{STRING(Substring|{TASK(1b77c767" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at UCTaskSetVariable.FillTask()
at ODNKNCFDHHPJPCMOFFIIHIOEPAPDAKPENFKF.LADALDFPFLGCECIEIGFGOAAGDBJAEJBJHCJK.FillTask()
at ODNKNCFDHHPJPCMOFFIIHIOEPAPDAKPENFKF.LADALDFPFLGCECIEIGFGOAAGDBJAEJBJHCJK.INMILFFHMDCABENGMNDEIPJAKDHHMBEBPHHA(Object , EventArgs )
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.UltraControlBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs 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 substring I create contains only numbers.
The client crashes after this and it is aking me to restart the client.
I even tried to add the substring to a value 0 with a MATH function, same problem.
System.InvalidCastException: Conversion from string "{MATH(Add|Integer|0|{TASK(1b77c7" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at UCTaskSetVariable.FillTask()
at ODNKNCFDHHPJPCMOFFIIHIOEPAPDAKPENFKF.LADALDFPFLGCECIEIGFGOAAGDBJAEJBJHCJK.FillTask()
at ODNKNCFDHHPJPCMOFFIIHIOEPAPDAKPENFKF.LADALDFPFLGCECIEIGFGOAAGDBJAEJBJHCJK.INMILFFHMDCABENGMNDEIPJAKDHHMBEBPHHA(Object , EventArgs )
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.UltraControlBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs 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 funny thing is, when I test the MATH.ADD in the variable window, it works fine.
{MATH(Add|Integer|0|{TASK(1b77c767-390e-4d01-aa22-69d5d70cea96,StdOut)}|0)}
After having this error, I can't edit the user defined variable anymore in the variable window. It crashes imediately.
When the variable to add the substring to is a string however, the MATH.ADD went fine, no errors.
Something to look at I think.
Regards
Erik
Uses Visualcron since 2006.