XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

TypedSDK: Collection of issues

Open cpyrgas opened this issue 3 years ago • 1 comments

For now will keep one ticket for many issues and will keep updating it. Can later decide to divide in to multiple ones or not.

  1. ComboBox:FillUsing( {"one","two","three"} ) results to an exception:

TestTypedSDK_FillUsing.zip

System.InvalidCastException: Unable to cast object of type 'ObjectCollection' to type 'System.Collections.Generic.IList`1[System.Object]'.
   at XSharp.VO.SDK.VOComboBox.get_Items() in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\WinForm\ListBox.prg:line 226
   at XSharp.VO.SDK.BaseListBox.get___Items() in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\BaseListBox.prg:line 22
   at XSharp.VO.SDK.BaseListBox.Clear(__Usual[] Xs$Args) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\BaseListBox.prg:line 69
   at XSharp.VO.SDK.ListBox.Clear(__Usual[] Xs$Args) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\ListBox.prg:line 155
   at XSharp.VO.SDK.ListBox.FillUsing(__Usual[] Xs$Args) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\ListBox.prg:line 274
   at XSharp.VO.SDK.ComboBox.FillUsing(__Usual[] Xs$Args) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\ComboBox.prg:line 83

Also not calling FillUsing() at all results to a similar exception when showing the window:

System.InvalidCastException: Unable to cast object of type 'ObjectCollection' to type 'System.Collections.Generic.IList`1[System.Object]'.
   at XSharp.VO.SDK.VOComboBox.get_Items() in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\WinForm\ListBox.prg:line 226
   at XSharp.VO.SDK.BaseListBox.get___Items() in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\BaseListBox.prg:line 22
   at XSharp.VO.SDK.ListBox.__FindRetValue(__Usual uValue) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\ListBox.prg:line 33
   at XSharp.VO.SDK.ListBox.OnHandleCreated(Object o, EventArgs e) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\Controls\ListBox.prg:line 10
   at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.ComboBox.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ComboBox.WndProc(Message& m)
   at XSharp.VO.SDK.VOComboBox.WndProc(Message& m) in C:\xSharp\DevRt\Runtime\VOSdkTyped\Source\VOSdk\GUI_Classes_SDK\WinForm\ListBox.prg:line 216
   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)


cpyrgas avatar Jan 26 '22 11:01 cpyrgas

Ahh, indeed I should had included a sample. Original problem is fixed, but now a new exception is thrown in this code:

System.InvalidCastException: 'Unable to cast object of type 'XSharp.VO.SDK.VOComboBox' to type 'XSharp.VO.SDK.IVOListBox'.'
ACCESS __List AS IVOListBox
		RETURN (IVOListBox) oCtrl

Here's a sample in VS, just run and open the HelpAbout dialog, which contains two ComboBoxes, on with no items fillet at all and the other filled with an array. The exception happens in both of them

VOMDIApp21.zip

cpyrgas avatar Feb 24 '22 17:02 cpyrgas