Execution stops after calling a method?

Inside a webapp method I am method contained inside the same webapp, that does some variable manipulation, a few times in a loop. But whenever I call it, execution does not resume from the lines after invoking that method. Not even a “system.debuglog” executes after I call that method. How can this be?

What kind of loop is it? If you’ve written yourself an infinite loop this is possible.

use this inside of your method to see what it makes or set a break point.

it’s not an infinite loop at all, all I do in that method is remove the last item from an array using array.RemoveAt(array.LastIndex).

I found that in recent Xojo versions often manipulating JSON items or doing array.removeAt silently pauses the webapp without any crash or error. It just stops, period.

I am calling a method that takes a string as parameter. availableUsers() is an array, a list of those strings. After I execute, i remove the last member of the array. When I do that, execution stops. if the removeAt line is commented out, execution continues. How can this be?


i would debugprint this availableUsers.LastIndex and also debug print and read this entry before you remove it.

make this a different?

var index As Integer = availableUsers.LastIndex
system.debuglog "Index to remove" + index.ToString
var item As String = availableUsers(index)
system.debuglog item 
system.debuglog "removed"

does something happen with this array inside of this start() method?

Index to remove7
Item: gC4Km603JE8Br8hu
Index to remove6
Item: zc5XSG07bHD2xXAa

and so on.

that start() method does nothing with this array at all.
when i just comment RemoveAt(index) it all works…

Isn’t your debugger paused on an exception?

1 Like

what happens if you clear this array and fill dummy values in?

availableUsers = Array(“a”,“b”,“c”,“d”)

in past i had only issues with 64bit mode that errors was suppressed and 32bit shows more.

are you using current Xojo 2021r2.1?

can you replicate this issue in a new test project?

I populated this array using availableusers = Array(“a”, “b”, “c”, “d”)

it removed a and b and stopped there. I use 2021r2.1 but this is a built webapp, not run in debugger.

But compared to 2019 versions this is very buggy, imho, especially on Linux.

Seems the only way is to run in debugger and see what’s happening there… built apps seem to have zero output on what’s wrong, just stop.

You mean you haven’t been testing this in the debugger? Why not? And why do you expect a built app to generate any output unless you arrange for that to happen?

1 Like

Hosted server, so it is somewhat harder to run in debugger. Seems will have to adapt.

I was used to older versions of Xojo, and most other languages, to crash with at least something displayed when things went wrong. Here it’s total silence.

I’m doing desktop so it may be different from webapps, but I catch the UnhandledException crash and in that handler, write the call stack to my log file.

You will need to set yourself up a testbed for your webapp, otherwise you’ll be in the dark. Then run under the debugger and step through your method to see what is happening.

Can you post the method in question?

it’s not the called method that causes it it seems, it happens even when calling it is commented out.

it’s removing the array.removeat(array.lastindex) that is the issue. As Tim said, seems only way is to run in debugger, because built Xojo webapps are totally silent on any exceptions. perhaps unlike desktop, that may throw some message boxes.

I was surprised to read this, but can confirm it’s true. If you don’t implement UnhandledException, nothing ever happens. A step backwards from Web 1.0 in my opinion.

1 Like

Is there a trick to add UnhandledException to everything? So at least there is something upon errors, at least to have a clue where it happens.

Like the event in the WebApp class?

Implement the unhandledexception event in the webapp class.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.