Debugger state and methods

Can the state of the debugger change the way a method executes? I ask this because I’ve got a method that was not working sometimes, and I think I tracked it down to the debugger being disabled.

If it’s enabled the method works perfect, but if it’s not it only works sometimes.

It can hardly have anything todo with the enabled flag of the debugger
-You could use application.output(…) to see if you method did run
-show a dialog to verify if it did run
-check the condition on which it should run
If no answer is found check .log.txt file in your Servoy dir for any errors

Jan,
your idea of using output() help me a lot. I believe what happens is that Servoy fires events in a different order when the debugger is on. Take this little method for example:

//create new invoice

application.output("newInvoice: begin");

if(globals.securityAccess("Invoice") <= 3)
{
	application.output("   newInvoice: newRecord()");
	controller.newRecord();

	application.output("   newInvoice: saveData()");
	controller.saveData();

}

else
{
	globals.showError(1);  //no access
}

I also have a method assigned to onRecordSelection. These are the outputs:

Debugger On
--------------
newInvoice: begin
   newInvoice: newRecord()
   newInvoice: saveData()
onRecordSelection: begin
   onRecordSelection: modify()

Debugger off
--------------
newInvoice: begin
   newInvoice: newRecord()
onRecordSelection: begin
   onRecordSelection: modify()
   newInvoice: saveData()

As you can see, onRecordSelection is triggered immediately after newRecord() when de debugger is off, not so when it’s on.

do you have a breakpoint set?
Or is it just enabled/disable debugger but you don’t do anything else?

Because if you don’t really break (so the scripts are running at once) then there shouldn’t be any difference.
If you are breaking and stepping through the code then maybe there could be a slight difference. I will investigate this.

Jan,
no breakpoints, no stepping, just enabled/disabled.

ok. reproduce it and fixed the problem (2.0.1)

Thanks Johan, I’ve been going nuts over this for months now thinking it was something in code :D