Issue 1023: ArgumentOutOfRangeException scrolling "Ion Types" context menu

issues
Status:open
Assigned To: Rita Chupalov
Type: Defect
Area: Skyline
Priority: 2
Milestone: 24.2
Opened:2024-06-03 09:05 by Nick Shulman
Changed:2024-10-02 16:18 by Rita Chupalov
Resolved:
Resolution:
Closed:
2024-06-03 09:05 Nick Shulman
Title»ArgumentOutOfRangeException scrolling "Ion Types" context menu
Assigned To»Rita Chupalov
Type»Defect
Area»Skyline
Priority»3
Milestone»23.2
1. Open the attached "ManyLossFormulas.sky"
2. Right-click on the "Library Match" window and choose the "Ion Types" menu item
3. There will be so many neutral loss options that the sub-menu with have a menu scroll button on it. If you click on the menu scroll button at the bottom of the screen then you get this exception:
Unhandled exception on UI thread: 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.ToolStripItemCollection.get_Item(Int32 index)
   at System.Windows.Forms.ToolStripDropDownMenu.ScrollInternal(Boolean up)
   at System.Windows.Forms.ToolStripScrollButton.Scroll()
   at System.Windows.Forms.ToolStripScrollButton.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.ToolStripControlHost.HandleMouseDown(Object sender, MouseEventArgs e)
   at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

This error was reported on the Exception Web by someone who was working with glycans in MSFragger and there were thousands of possible glycan modifications and each had a neutral loss with a slightly different chemical formula. I simplified their document down to this thing that just has one modification with hundreds of different possible neutral losses.
 
 ManyLossFormulas.sky

2024-07-17 15:15 Brendan MacLean
Priority3»2
Milestone23.2»24.2

2024-10-02 16:18 Rita Chupalov
Notify»Brendan MacLean;Nick Shulman
Is this actually a valid use case? I feel like just limiting the number of neutral losses in the menu to the first 20-30 would be a suitable fix. This is not a critical option, just graph formatting.