I have an xojoscript object with its source set to call a couple functions.
Those functions are in a class set as the xojoscript context, so xojoscript has access to them.
I was having problems with the result I was expecting, so I set breakpoints in the class methods that the script is calling.
When I execute the script, I get dropped into the debugger on the last method called in the script, even though it’s the last line in the script, so the result it’s trying to work with, which the preceding lines are calculating, is not created yet.
If I step on from that point ,the method calls that’s preceding the last line is then called in the correct order.
Example pseudo script source to clarify:
Func1 '-- Functions in class set as context.
I set breakpoints in Func1,2,3 and run the script… and get dropped into the debugger on Func3
I step over and then get dropped into Func1 and then Func2.
I’ve system.DebugLog’ed the script source prior to .run just to make sure, and everything’s dandy.
As you can imagine, this is less than optimal
I can’t for the life of me figure out why it’s happening.
XojoScript just executes linearly from first to last so I can’t imagine why you’re having such an issue
Would have to see your xojo script code & maybe the context object as well to know
I’ve noticed oddities when trying to use breakpoints in conjunction with Xojoscripts – I’m not sure the debugger works correctly with them.
I don’t know if that’s the problem here, but I wonder if setting up your own logging system as a different type of test might help narrow the problem: just have each function write a value to a text file and then look at the order of the items in the log afterward to see if things really are firing out of order the way you think.
Please report anything you see. This is the first I’ve heard of problems like this.
Hmmm. I’ll watch for it. I don’t remember the specifics – it hadn’t even occurred to me it might be a bug to report. I just assumed that breakpoints didn’t work well with Xojoscripts because the scripts are external to the main app, so I didn’t really investigate it further. (And since I can’t put breakpoints in the actual script itself, which is often where I really want them, I was implementing my own debug system anyway, so it wasn’t a big problem.)
If memory serves, it was something along the lines that the script kept on running even if I had breakpoint in the context, or the IDE would become unstable when stepping through such breakpoints (jumping between the script and the context object). I’ll make a note next time I see it. I have a big app that depends heavily on Xojoscripts and I was noticing it often with that, but it’s on hold until I get the next magazine issue out so when I get back to it I’ll look for such problems.