We are moving! We are currently migrating our community to the new Bosch Connected Industry Online Portal. The community will be available latest in the new year again, until then it will be in read-only mode. Click here for more information.
06-28-2022 11:09 AM
Hello,
this is tested with HMI 4.11.1 and 4.11.5.
If there is a Grid control with 0 displayed rows, and this grid control was not shown on the view, then leaving that view will throw an error each second time. The error you can see in the log below.
This happens to me in one of my objects. It has a view which contains a tab control. In one of those tabs there is a grid control. In the default case this grid control will be empty, that is the number of visible rows is linked to a variable containing 0. Only in some cases there will be data to display in there. The problem is that this tab is also not the default tab that gets shown when the view is opened. So the grid control is hidden by default and empty. This combination will cause errors when the control is disposed (i.e. when the view is left). The grid control uses the select row mode, this may also be a requirement for this error to occur.
Why this problem only happens every second time when I leave the view I don't know. This probably has something to do with the HMI internal data structures.
I added one view as an example. The problem happens with Mod_GridAdjustmentPoints.
I am aware that this is a very particular problem. Will this be fixed in the future?
2022-06-28 16:50:30 (A:1708324kB M:28261kB) [Error] <Application>
Unhandled exception occured:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Windows.Forms.DataGridViewColumnCollection.get_Item(Int32 index)
at System.Windows.Forms.DataGridView.FlushDisplayedChanged()
at System.Windows.Forms.DataGridView.PerformLayoutPrivate(Boolean useRowShortcut, Boolean computeVisibleRows, Boolean invalidInAdjustFillingColumns, Boolean repositionEditingControl)
at System.Windows.Forms.DataGridView.OnColumnCollectionChanged_PreNotification(CollectionChangeEventArgs ccea)
at System.Windows.Forms.DataGridViewColumnCollection.Clear()
at System.Windows.Forms.DataGridView.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at Bosch.OpCon.HMI.Modulo.Forms.Mod_Grid.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at VisiWinNET.Forms.TabPage.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at VisiWinNET.Forms.TabControl.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at VisiWinNET.Forms.SmartUserControl.Dispose(Boolean disposing)
at Bosch.OpCon.HMI.Modulo.Shared.SmartControl.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at Bosch.OpCon.HMI.Modulo.Shared.SfcProvider.RemoveControl(Control c)
at Bosch.OpCon.HMI.Modulo.Forms.Mod_SmartControlHost.LoadSmartControl()
at Bosch.OpCon.HMI.Modulo.Forms.Mod_SmartControlHost.set_SmartControlName(String value)
at Bosch.OpCon.HMI.Modulo.Workspace.UpdateView()
at Bosch.OpCon.HMI.Modulo.Workspace._ownerUnit_ActiveViewChanged(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Bosch.OpCon.HMI.Modulo.Shared.OpconUnit.FireActiveViewChanged()
at Bosch.OpCon.HMI.Modulo.Shared.OpconUnit.ActivateView(String viewName)
at Bosch.OpCon.HMI.Modulo.Shared.ViewManager.ActivateView(OpconUnit unit, String viewPath, Boolean ignoreActivateViewError, Boolean ignorePanelInactive)
at Bosch.OpCon.HMI.Modulo.ViewSelector.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Bosch.OpCon.HMI.Modulo.Forms.TouchControl.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)
06-30-2022 07:47 AM
Hi Marvin,
Thank you for reporting this bug. I can reproduce it. This problem also occurs with V5.x HMI versions if a grid is used inside a tab control and the VwItem for visible rows is set to 0.
We will fix it with the next 4.11 and 5.5 Version of the HMI.