I am working on a web app and have encountered an error that only happens when the app is run from the web server.
Unhandled OutOfBoundsException
Message:
Stack:
The error does not occur when running in the IDE. The app uses a container control with control sets and the message appears when you scroll the container control. No other information is displayed that gives me any clue what is causing the error. I suspect it may have something to do with control indexes not behaving the same way on the web server as they do in the ID but that is jus a guess at this point. Anybody have any sage wisdom on how to go about tracking down the culprit?
One more bit of info. The app also has a listbox in it that also causes the same error when you click on a cell. If I remove all the code in CellClick the error doesn’t occur but with the following minimal amount of code, (only part of what is supposed to be there), a CellClick will cause the Unhandled OutOfBoundsException:
[code]CellClick(Row As Integer, Column As Integer)
Dim i As Integer
Dim b As Boolean
Dim p As WebPicture
I can only assume that the JobData Array is somehow causing the Unhandled OutOfBoundsException but this makes no sense to me since the opening code for the app works using the same array without any modifications.
Well, that’s interesting. I replaced all the code in CellClick with:
CellClick(Row As Integer, Column As Integer)
MsgBox "Row " + Str(Row) + EndOfLine + "UBound(JobData,1) " + Str(UBound(Session.JobData,1))
AND… I still get the Unhandled OutOfBoundsException.
So next I changed the code to:
CellClick(Row As Integer, Column As Integer)
MsgBox "Row " + Str(Row)
AND… I still get the Unhandled OutOfBoundsException. So, is the problem with the data in the ListBox? I’m clicking on cell one or 2 out of over 4k cells.
Michael I’m as puzzled as you are. That shouldn’t happen with just a MsgBox.
nige. Correct. That is a typo done here.
Randy I was doing a bunch as methods within a container control but I’m in the process of moving all that code to the session just in case. I haven’t finished that and put a build on the web server but hope to do that by morning to test if the problem autmagically goes away.
Initializing visual controls in the “Open” event can be problematic. Unless absolutely necessary, I would suggest moving the code in the “Open” events to the “Shown” events (and see if you still get your OutOfBounds Exception). My guess, and it is purely a guess, is that an event is getting processed before an actual selection is made in the ListBox. This means that the ListBox’s ListIndex is “-1” – which of course would be out of bounds if you were using it to reference an array of some sort.
Of course I have no idea because we all are working blind without seeing your code.
If anything as simple as a Msgbox triggers an exception completely unrelated to the kind of variable used it looks terribly much like a bug deep into Xojo. Have you tried something as innocent as
row = row+1
or
system.debuglog "Row " + Str(Row)
If any one of these two lines by itself in CellClick raises the OutOfBounds Exception it cannot be anything but a blatant bug. Since CellClick cannot be triggered on a non-displayed control, it cannot be an out of scope either. And I checked a click outside of a valid cell does not do anything.
If the run on the host does not do magic, only Greg is probably able to sort this out.
Well… No dice. I move virtually all code to the Session. I eliminated any open events and replaced with Shown events. all code in controls call methods in the Session. Per Michael Bujardet’s suggestion I put the two lines above separately in different builds and tested each variation but still get the same OutOfBoundsException from CellClick but I’ve ONLY ever gottent the error running on a build installed on the W2k8 web server running IIS. If I run a debug version in the IDE everything runs correctly as expected. If I put tat build in I get the exception in the CellClick or when scrolling a ContainerControl that contains a controlset of Images in a WebImageView controls. I somehow suspect the problem may be with the ContainerControl and/or the ControlSets within that ContainerControl. I guess the next step is to remove the ContainerControl or possibly the code that creates and populates the ControlSets.
Another weirdness is that in the IDE debug build the WebPage window size is correctly calculated to display a ProgressWheel horizontally and Vertically centered but the app does not calculate correctly when running on the Web Server build as well as the ContainerControl is the wrong size for the WebPage window. (Testing on a Windows 7 64 desktop).
Lastly all I do for a new build is delete the old executable and replace with the new build executable without making any further changes in the web server since I shouldn’t have to all other things being the same including Libs and Resources.
If you’re using the same version of the IDE each time, this is probably okay unless you add some code that adds another DLL to your project. If that happens, not copying the Libs folder will get you an app that probably won’t run anyway.
Do me a favor, in your JobSelected method, could you log the CurrentJobID and the ubounds of Session.JobData?
[code]LogDebugData(logdata As String)
Dim f As FolderItem
Dim t as TextOutputStream
f = GetFolderItem(“debuglog.txt”)
If Not (f = Nil) Then
If f.Exists Then
t = TextOutputStream.Append(f)
t.Write(logdata + EndOfLine)
t.Close
Else
t = TextOutputStream.Create(f)
t.WriteLine(logdata)
t.Close
End If
End If
[/code]
Running my app in the IDE the output from application launch returns the expected result as did clicking on another cell.
4188
10
4188
as did clicking on another cell once the first collection of thumbnails were shown.
4188
10
4188
4188
10
4188
Running the app on my web server returned the same startup results as in the IDE…
4188
10
4188
but clicking on a cell causes the Unhandled OutOfBoundsException.
Michael, Debug is on Windows 7 64 on a Dell UltraBook. The Web server is Windows server 2008 64 running on a VM server on Cisco UTS blades with a 10GB Network. The MySQL Server is on a separate Windows server 2008 64 also running on a VM server on Cisco UTS.