StrataFrame Forum

Browse Dialog issue

http://forum.strataframe.net/Topic18418.aspx

By Paul Chase - 8/12/2008

I don't know when or how it happened, but for whatever reason a few of my browse dialogs are crashing with the error below. I have not made any changes to any individual browse dialogs in a very very long time. I know that these browse dialogs worked fine on my last release as it is currently in production and I can't think of anything that I changed since then that might cause this problem.  

 Any ideas on what to look at on this 

ArgumentOutOfRangeException
  Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source     : mscorlib

Stack Trace:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.PositionLabels(Control& ParentControl)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.AddSearchFields()
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow..ctor(BrowseDialog browse, Boolean PopulateOnShow)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog(Boolean PopulateOnShow, IWin32Window ResultsWindowOwner)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog(Boolean PopulateOnShow)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog()
   at ActionLabor.Payroll.UI.WindowsForms.Frmmain.BtnBrowse_ItemClick(Object sender, ItemClickEventArgs e) in C:\Action Labor Payroll\UI\Forms\FrmMain.vb:line 545
   at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarItemLink.OnLinkClick()
   at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
   at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
   at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraBars.Controls.DockedBarControl.WndProc(Message& msg)
   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)

 
By Trent L. Taylor - 8/12/2008

A couple of things here.  First, are you using the standard StrataFrame BrowseDialogs or the DevExpress Wrapper?  Secondly, I was looking and this method hasn't been changed in a very long time...so...we may need to start looking at your environment.  Also, one thing you might try, just for grins, is to create a temp form and drop on a BrowseDialog and see if the error persists on a new browse...the only reason for this is to see if the error pops up immediately here which will give us more to go on when working through your problem.
By Paul Chase - 8/12/2008

Hiya Trent,

I'm using inherited standard SF browse dialogs. For instance I have customerbrowse which in inherits from browse base and EmployeeBrowse which also inherits from browse base. Customer browse works fine but employee bombs, I have several BD's that work and several that do not although all of them did work last release and I haven't changed the browse dialog or the base class in quite awile but I may have changed something else that is making them spit up I am just not sure what on earth it may be that I changed that would cause this. 

I will spend some time poking around and start from the bottom and work my way up till I find the problem i was just hoping you would say oh yeah we know what that is just set the don't crash property to true and you'll be fine.

By Trent L. Taylor - 8/12/2008

I will spend some time poking around and start from the bottom and work my way up till I find the problem i was just hoping you would say oh yeah we know what that is just set the don't crash property to true and you'll be fine.

That would have been nice, huh BigGrin  We actually have a lot of BD's in our medical software as well that use the very same approach that you are in regards to a Browse Base and then inherit from that base BD.  And we have not noticed any issues....so you might just want to build the source in debug mode.

I have just posted a new build in the last minute or so as well as the source code for that build in the My Account area.  So you may want to build the source in debug mode so that you can see where it is breaking. 

By Paul Chase - 8/13/2008

Trent,

The line where it is failing is.

Dim lnTextHeight As Integer = _Controls.Item(0).Height

What happened was there were no search fields visible in the key so the add labels was crashing due because the controls collection was empty. I dont know why they were not visible i guess i must have been screwing around with them.

could you test for this condition (no search fields visible) and allow a browse dialog to come up without visible search fields and allow the user to then add search fields? It sure beats crashing Smile 

Thanks alot Paul

By Trent L. Taylor - 8/13/2008

Done.  I added a test on the PositionLabels and PositionControls to prevent the error if there are no search fields visible within the dialog.  It will be in the next build posted.
By Paul Chase - 8/13/2008

Took you long enough!!!! Jeez almost an hour .. J/K 

Thanks alot Trent as usual you are on top of itSmile