Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Bug in HMI: Hidden grid control with 0 rows throws errors when leaving view

    Bug in HMI: Hidden grid control with 0 rows throws errors when leaving view

    MarvinW
    Long-established Member

    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)

     

    1 REPLY 1

    Philipp_Sch
    Member

    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.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist