FoxCreek


If we forget to remove a SUSPEND command before deploying a VFP program, the program will throw an error saying ˇ°Feature not available.ˇ±

However, if we forget to remove a ˇ°SET STEP ONˇ± command, the deployed program will not error, but will function as desired, acting as if the ˇ°SET STEP ONˇ± was not in the code.

Are there any known ˇ°side effectsˇ± of leaving a ˇ°SET STEP ONˇ± command in a program code Or in a class method

Thank you.



Re: Side effects of leaving SET STEP ON in code

slarin


Not than I know of. But I always make sure to remove all occurences of SUSPEND and SET STEP in my final code, question of delivering clean code. It is a better approach to use the breakpoint when you can.






Re: Side effects of leaving SET STEP ON in code

dni

May be it is not working in runtime environement ...anyway he needs trace window may be not available at runtime...







Re: Side effects of leaving SET STEP ON in code

FoxCreek

Actually,

The results we like is that SET STEP ON does not cause the program to stop in the runtime environment. If it is accidentally left in the code, the program does not crash after being deployed.





Re: Side effects of leaving SET STEP ON in code

FoxCreek

What is the difference between a breakpoint, SUSPEND, and SET STEP ON





Re: Side effects of leaving SET STEP ON in code

MarciaAkins

FoxCreek wrote:
What is the difference between a breakpoint, SUSPEND, and SET STEP ON

You can set a breakpoint in the debugger by going to Tool->Breakpoints. Don't forget to click the ADD button or else your breakpoint will not actually exist. Then, leaving the debugger open, run your program. A program execution will be suspended whenever you hit a breakpoint.

The nice thing about using breakpoints is that there is no code that you have to rememeber to delete from you source code later.






Re: Side effects of leaving SET STEP ON in code

FoxCreek

However,

There have been times when I have used a breakpoint, and the program did not break on that breakpoint, and I had to go in and actually use a SUSPEND or a SET STEP ON in the code to force the program execution to stop at that point.

So there must be some differences between how a BREAKPOINT, SUSPEND, or a SET STEP ON functions.





Re: Side effects of leaving SET STEP ON in code

dni

SUSPEND "Pauses program execution and returns to interactive Visual FoxPro"*.Execution is restarted with RESUME.

SET STEP ON "Opens the Trace window and suspends program execution for debugging"*

You may set a BREAKPOINT (usually on first line of program)*.

*All needs in order to work interactive vfp and debugger environment.

Normaly SET STEP ON & BREAKPOINT are used in a debugging sesion:

DEBUG

SET STEP ON

SET ECHO ON






Re: Side effects of leaving SET STEP ON in code

dni

If you don't have a BREAKPOINT setted I suppose SET STEP ON is doing nothing ...






Re: Side effects of leaving SET STEP ON in code

FoxCreek

I have used SET STEP ON without preceding it with the command DEBUG.

When I run the program in the interactive FoxPro developing environment, the program stops, the debug window opens, and the program location pointer is set to the next line of executeable code immediately after my SET STEP ON command

I did not use a breakpoint or a SUSPEND command.

So without a BREAKPOINT set, SET STEP ON is not doing nothing.

It is definitely doing something, and you seemed to have previously explained what SET STEP ON does in a previous reply when you stated that: "SET STEP ON "Opens the Trace window and suspends program execution for debugging."

That is what it seems to be doing.

Thank you for your answer, it has been the most complete and thorough so far. It also makes sense, I would believe that is correct.





Re: Side effects of leaving SET STEP ON in code

dni

Text between quotes is not mine, if from vfp9 help






Re: Side effects of leaving SET STEP ON in code

surinder singh

Make habit of writing SET STEP ON or SUSPEND in restrictions like

if you are writting code on 09/17/2007 then

if date() = ctod("09/17/2007")

SET STEP ON

*SUSPEND

endif

Best Regards

Surinder






Re: Side effects of leaving SET STEP ON in code

slarin

surinder singh wrote:

Make habit of writing SET STEP ON or SUSPEND in restrictions like

if you are writting code on 09/17/2007 then

if date() = ctod("09/17/2007")

SET STEP ON

*SUSPEND

endif

I do not agree as this code will incur a performance hit at each execution in production. Better use a compiler directive:

#IFDEF DEBUGON

SET STEP ON

#ENDIF





Re: Side effects of leaving SET STEP ON in code

Tamar E. Granor

Better is to make a habit of not using those commands. I can count on one hand the number of times I've used them since the new Debugger was added in VFP 5.

There are so many ways to set breakpoints:

1) Use the margin in any code window.
2) Use the Breakpoints dialog.
3) Use the margin in the Trace window.
4) Use the margin in the Watch window.

Here are some suggestions for getting into form/class code (which is tricky):

Add an expression "METHODNAME"$PROG() to the Watch window, where METHODNAME is the method where you want code to stop. Set a breakpoint on it.

Add an expression LINENO() in the Watch window and set a breakpoint on it, to stop on the next executable line of code. This is really handy when you want to get to a certain point in the code and then stop on action.

Add an expression USED("ALIAS") in the Watch window and set a breakpoint on it, to stop when a particular table opens or closes.

Hope this helps.

Tamar